开发者

Django admin: 'add' page, want to add multiple objects on one page

class Country(models.Model):
    na开发者_开发百科me = fields.CharField()

In admin, I want to display multiple forms for Country so I can add multiple different country objects at once. I don't know where to start? Please help, thanks.


I can't think of any way to do this inside the admin. The admin is a ready-made interface for editing single objects (and, optionally, multiple objects related to that object), but doesn't give you any way to edit multiple objects at once.

If you need this, write your own view using a formset.


My idea is you could extend the admin template change_form.html to display a formset, and have the 'add' url point to a view that would handle the page rendering. You will also need to override the url in your urls.py. Not the best but it would work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜