I am trying to show a shared foreign key in a Django admin, but cannot make it work. I have a FullCitation class that can be associated with either the NonSupportedProgram class or the SupportedProgram class. So, I used a shared foreign key.
In admin, I want users to be able to select only “NonSupportedProgram” or “SupportedProgram” from the content_type drop-down list, and then from the object_id field I need users to be able to select existing NonSuportedPrograms or existing supported programs from the drop-down list, with the possibility of creating a new one. Is it possible? Where am I mistaken?
models.py
class FullCitation(models.Model)
admin.py
class FullCitationAdmin(reversion.VersionAdmin): fieldsets = ( ('Which Program', { 'fields': ('content_type', 'object_id', ), }), ('Citation Information', { 'fields': ('is_primary',), }),)
python django django-models django-admin generic-foreign-key
steph
source share