python - Add many in Django Admin -
in models list view in django admin, there button add 1 model. extend bit , able add multiple items @ once. models images, , nice able add multiple images @ 1 time.
i've had success @ creating custom fields within individual model view, don't know begin on list view. can @ least point me in right direction?
edit:
i want change view, , add button on top right "add multiple images"
i think want use tabularinline or stackedinline assuming have model has set of images , model each image (so e.g.
class portfolio(models.model): name = models.charfield(max_length=100) class image(models.model): port = models.foreignkey(portolio) name = models.charfield(max_length=100) img = models.imagefield() # or you're storing image, e.g. url,
you can create in admin.py
class imageinline(admin.tabularinline): model = image class portfolioadmin(admin.modeladmin): inlines = [ imageinline, ]
(you can specify extras, e.g. how many inline model forms start with, should started, assuming meant)
Comments
Post a Comment