0

I have a model to upload pictures:

class Snap(models.Model):
    image = models.ImageField(upload_to=get_upload_file_name)
    caption = models.CharField(max_length=150, blank=True, null=True)
    pubdate = models.DateTimeField(default=timezone.now)

In the admin it contains all the Snap's field (i.e. one field to upload an image ,its caption and the pubdate) which is as expected. How do I add multiple record of Snap's in one go. I hope I was clear, if not please ask. Your help and guidance will be very much appreciated. Thank you.

admin.py:

class SnapAdmin(admin.ModelAdmin):
    class Meta:
        model = Snap

admin.site.register(Snap, SnapAdmin)
4
  • Like having an inline that can allow you to add multiple items? Maybe there is a way to use that? Commented Jun 12, 2015 at 20:09
  • @PhoebeB Yes. To add multiple Snaps in one place. Commented Jun 13, 2015 at 2:31
  • 1
    @Robin That can be done by admin.StackedInline or admin.TabularInline if Snap has a ForeignKey to another model. Commented Jun 13, 2015 at 6:51
  • possible duplicate of Create multiple objects in django admin at once Commented Oct 9, 2015 at 17:32

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.