November 2015
Beginner to intermediate
840 pages
26h 30m
English
Profile to UserAdmin Thanks to Inline InstancesOur User model is associated with our Profile model on a one-to-one basis. When we create a user, both in the admin and elsewhere, we automatically create a Profile. It would be really nice if the Profile instance associated with the User instance were displayed while we edited a User.
To allow for the display of other objects in the form pages (add and edit pages), the admin provides inline objects: InlineModelAdmin and its two subclasses, TabularInline and StackedInline. The difference between the two is how they are displayed.
To display the Profile instance, we can create a class that inherits from either TabularInline or StackedInline and declare the model attribute to Profile ...
Read now
Unlock full access