-
Notifications
You must be signed in to change notification settings - Fork 20
Model Schema Graph
EduLite includes django-schema-graph as a development tool for visualizing how our models connect. It serves an interactive diagram at /schema/ that reads directly from your models — so it's always up to date.
Once the backend is running locally, browse to:
http://localhost:8000/schema/
That's it. You'll see a graph of every model in the project with lines showing their relationships.
The diagram shows all Django models across all installed apps. Each node is a model, each edge is a relationship (ForeignKey, OneToOne, ManyToMany, or GenericForeignKey).
The sidebar on the left lets you:
- Toggle apps on/off — useful for focusing on just the apps relevant to what you're building.
- Toggle individual models — hide noise, zoom into what matters.
- Toggle relationship types — show only ForeignKeys, or only ManyToMany, etc.
Proxy models appear with a white background to distinguish them from concrete models.
-
You're new to the project — browse
/schema/before reading any code. It'll give you the big picture in 30 seconds. - You're designing a new feature — toggle on the apps you're touching to see existing relationships before adding new ones.
- You're reviewing a PR that adds or changes models — check the diagram before and after to see what changed visually.
-
You're writing serializers — quickly see which related models you might need to include via
select_relatedorprefetch_related.
Some non-obvious connections in the EduLite data layer:
-
CourseModule uses a
GenericForeignKey— it can point to aSlideshow, aNote, or any future content type without tight coupling. -
CourseMembership is the join table between
UserandCourse, carryingrole(teacher/student/assistant) andstatus(pending/enrolled/invited). -
CourseChatRoom links a
Courseto aChatRoom, meaning chat functionality is connected to but not embedded in the courses app.
Toggle on courses, slideshows, chat, and users simultaneously to see this full picture.
The schema view is only accessible when DEBUG=True, which means it's available in local development but not in production. This is the default behavior from django-schema-graph — no additional configuration needed.
If you need to customize access (e.g. allow it in a staging environment), you can subclass the view and override access_permitted:
from schema_graph.views import Schema
class CustomSchemaView(Schema):
def access_permitted(self):
return self.request.user.is_staffPage is blank or 403: Make sure DEBUG=True in your settings. The schema view is hidden in production by default.
Models are missing: The diagram reads from INSTALLED_APPS. If an app isn't installed, its models won't appear.
Too many Django internals showing: Use the sidebar to toggle off auth, contenttypes, sessions, admin, etc. and focus on EduLite's own apps.