[Django]-Including fields from a OneToOneField in Django Admin

2👍

The answer would be to use Django Reverse Admin

From its documentation:

Module that makes django admin handle OneToOneFields in a better way. A common use case for one-to-one relationships is to "embed" a model inside another one. For example, a Person may have multiple foreign keys pointing to an Address entity, one home address, one business address and so on. Django admin displays those relations using select boxes, letting the user choose which address entity to connect to a person. A more natural way to handle the relationship is using inlines. However, since the foreign key is placed on the owning entity, django admins standard inline classes can’t be used.

class CustomerAdmin(ReverseModelAdmin):
    inline_type = 'stacked'
    inline_reverse = ['secondary_information']
👤Artem

Leave a comment