Reputation: 391
I'm trying to retrieve the form django-admin uses to create a model.
Django allows the creation of a form matching some model, however the admin is much more powerful with the use of a ModelAdmin.
For instance, this code lets me add multiple tags to an article :
class ArticleAdmin(admin.ModelAdmin):
list_display = ('author', 'type', 'date')
inlines = [
TagInline,
]
I believe Django offers some way to get the resulting HTML and logic, do you know how to do it?
Upvotes: 1
Views: 240
Reputation: 111
Create inline model for Class TagInline given below:
class TagInline(admin.TabularInline):
model = Tag
Upvotes: 0
Reputation: 517
Please Use tabular Inline.....
class Name(admin.TabularInline):
model = name
Upvotes: 0
Reputation: 1013
You can use Inline Model Admin objects to create Inline tags
For ex:
class TagInline(admin.TabularInline):
model = Tag
extra = 3
Upvotes: 1