You should use InlineModelAdmin
. Docs.
class TeachSubjectInline(admin.TabularInline):
model = TeachSubject
extra = 2 # how many rows to show
class SchoolClassAdmin(admin.ModelAdmin):
inlines = (TeachSubjectInline,)
admin.site.register(SchoolClass, SchoolClassAdmin)
Related Contents:
- Django “xxxxxx Object” display customization in admin action sidebar
- Tying in to Django Admin’s Model History
- Override default queryset in Django admin
- Using Django auth UserAdmin for a custom user model
- How can I restrict Django’s GenericForeignKey to a list of models?
- Django – How to specify which field a validation fails on?
- How to add a sortable count column to the Django admin of a model with a many-to-one relation?
- Django Admin: how to display properties defined on model in an inline?
- Django max_length for IntegerField
- How to force Django Admin to use select_related?
- Custom error message in Django admin actions
- “settings.DATABASES is improperly configured” error performing syncdb with django 1.4
- How to query Case-insensitive data in Django ORM?
- Get model’s fields in Django
- Get class name of django model
- How to set a Django model field’s default value to a function call / callable (e.g., a date relative to the time of model object creation)
- Django admin: How to display a field that is marked as editable=False’ in the model?
- Default value for field in Django model
- Django admin, hide a model
- In a Django QuerySet, how to filter for “not exists” in a many-to-one relationship
- django – get() returned more than one topic
- Django Admin Show Image from Imagefield
- “Post Image data using POSTMAN”
- Django filter the model on ManyToMany count?
- Django query datetime for objects older than 5 hours
- ‘RelatedManager’ object is not iterable Django
- How to hide some fields in django-admin?
- In Django Admin how do I disable the Delete link
- Multiple images per Model
- Django: Query using contains each value in a list
- Django data migration when changing a field to ManyToMany
- Django – Simple custom template tag example
- Django comparing model instances for equality
- Django: Populate user ID when saving a model
- Understanding ManyToMany fields in Django with a through model
- What is the canonical way to find out if a Django model is saved to db?
- Django admin – inline inlines (or, three model editing at once)
- ChoiceField in Django model
- Manipulating Data in Django’s Admin Panel on Save
- Why does django ORM’s `save` method not return the saved object?
- Django accessing ManyToMany fields from post_save signal
- Django: accessing the model instance from within ModelAdmin?
- Django Overriding Model Clean() vs Save()
- How can you create a non-empty CharField in Django?
- Django model validator not working on create
- Query for top x elements in Django
- Django Admin – save_model method – How to detect if a field has changed?
- Blank, Null, and Required in Django Models and ModelForms
- Register every table/class from an app in the Django admin page
- Access tuple in django template