Django — upload many photos?

Good day!
models.py

class Location(models.Model):
 user = models.ForeignKey(settings.AUTH_USER_MODEL, default=1)
 name = models.CharField(max_length=100, verbose_name="Location", default=u")
 photos = models.ImageField(upload_to='photos', null=True)

forms.py

class LocationForm(forms.ModelForm):

 class Meta:
 model = Location
 fields = ['name', 'photos']

views.py

 class AddLocationPageView(FormView):
 template_name = 'add_location.html'
 form_class = LocationForm

 def form_valid(self, form):
form.save()
 return super(AddLocationPageView, self).form_valid(form)

I need to be able to upload multiple photos at a time.

How to do it?

Thank you!
July 9th 19 at 13:21
2 answers
July 9th 19 at 13:23
Do for photos of individual model and associated with the location via m2m field.
July 9th 19 at 13:25
formset Google

Find more questions by tags Django