Answer the question
In order to leave comments, you need to log in
How to edit such a form in Django?
The situation is
models.py
class Album(models.Model):
title = models.CharField()
cover = models.ImageField()
class Screenshots(models.Model):
is_author = models.ForeignKey(Album, on_delete=models.CASCADE,)
image = models.ImageField()
class AlbumForm(forms.ModelForm):
class Meta:
model = Author
fields = ('cover', 'title', )
class ScreenshotsForm(forms.ModelForm):
class Meta:
model = Screenshot
fields = ('image', )
ScreenshotsForm
inline with AlbumForm
. Everything is fine, everything is added / saved. Only one thing is not clear to me: how to display this matter in the edit form? inlineformset_factory
). How can I get the url's of the images saved when creating a post in the template? Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question