20.2 Understanding contenttypes
and Generic Relations
By default, Django includes the contenttypes
contributed app in every new project, as shown in Example 20.1.
suorganizer/settings.py
in 97c4234a4a
35 INSTALLED_APPS = ( . ... 38 'django.contrib.contenttypes', . ... 48 )
The app keeps track of all of the types of content in our project, as shown in Example 20.2.
>>> from django.contrib.contenttypes.models import ContentType >>> ContentType.objects.all() [<ContentType: log entry>, <ContentType: permission>, <ContentType: group>, <ContentType: user>, <ContentType: content type>, <ContentType: ...
Get Django Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.