chem1st
chem1st

Reputation: 1634

Create multiple objects in django admin at once

For example, I have a Post model:

Class Post(models.Model):
    title = models.Charfield(max_length=200)
    # other fields

I wonder is there a way to create multiple posts at once in admin. In other words, I need a formset instead of single form on post creation page.

Upvotes: 5

Views: 6771

Answers (2)

Fernando Freitas Alves
Fernando Freitas Alves

Reputation: 3777

Possibly, the best way to do exactly what you want is extend the ModelAdmin class, because it has no formsets on it, except for those used on InlineFormsets.

After that you could customize the admin change_form template, to include your formsets

The quick-and-dirty way to do it using admin is wrap your Post model as an inline formset of another modeladmin and add the extra option to it.

Upvotes: 2

Agate
Agate

Reputation: 3232

I've heard recently about a django app that exactly does this job. It's called django-bulk-admin and enables bulk add/update in the admin.

Upvotes: 7

Related Questions