I’m just starting out with Django writing my first app – a chore chart manager for my family. In the tutorial it shows you how to add related objects in a tabular form. I don’t care about the related objects, I just want to add the regular object in a tabular form. This is what I have in my admin.py
from chores.models import Chore
from django.contrib import admin
class ChoreAdmin(admin.ModelAdmin):
fieldsets = [
(None, {'fields': ['description', 'frequency', 'person']})
]
admin.site.register(Chore, ChoreAdmin)
and I want when I click “add chore” that rather than seeing:
Description: _____
Frequency: ______
Person: _____
I want it to show:
Description: __________ | Frequency: _______ | Person: _____
Is this trivial to do, or would it take a lot of custom effort? And if it is easy, how do I do it?
Thanks!
OP is probably all set, but for new users reading this, refer to: https://docs.djangoproject.com/en/dev/ref/contrib/admin/
Basically following part in above link:
The
field_optionsdictionary can have the following keys:fields: A tuple of field names to display in this fieldset. This key is required.Example:
Just like with the
fieldsoption, to display multiple fields on the same line, wrap those fields in their own tuple. In this example, thefirst_nameandlast_namefields will display on the same line: