1

I have an Artwork and ArtworkPhoto models in Django. ArtworkPhoto has an FK to the Artwork and stores some additional data on the photo.

class ArtworkPhoto(models.Model):
   title = models.CharField(max_length=200, verbose_name='Omschrijving', blank=True)
   photo = FileBrowseField("Image", max_length=200, directory="artwork/",
                        extensions=[".jpg", ".png"], blank=False, null=False)
   artwork = models.ForeignKey(Artwork, null=False, verbose_name='kunstwerk')

Every Artwork has X photos, all working fine. Now I want to provide authenticated visitors with an upload form to add an artwork and photo's.

How can I save a posted file to the ArtworkPhotoModel? It's a Grapelli FileBrowser > Filebrowsefield ...

Thanks, i'm a bit stuck here. ...

Brown Bear
  • 19,655
  • 10
  • 58
  • 76
Yoeri
  • 1,876
  • 15
  • 24

0 Answers0