Let's have 2 models that extends the user model called Ext1
and Ext2
declared as follow:
class ExtN(models.Model):
user = models.OneToOneField(User)
extra_param = models.xxxField()
then I declare in application specific admin.py
file something like:
class ExtNInline(admin.StackedInline):
model = ExtN
can_delete = False
in which file do I need to put the following code, in order to see the form to edit both models related to the user?
class UserAdmin(UserAdmin):
inlines = (Ext1Inline, Ext2Inline, )
admin.site.unregister(User)
admin.site.register(User, UserAdmin)
Thanks in advance.
You should put it in the same admin.py
file
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.