- In Wagtail, How to add custom folder in Media and sync it into the database (Example) ?
- NOTE: The Wagtail's Collection function is good, but for more than 1000 images/documents into a single folder will be pretty awkward to manage for I in the future (Ex: migration,...), so there is nothing to mention about Collection function in this question.
# If in Django (models.py) works:
class post(models.Model):
img = models.ImageField(upload_to='posts')
# So how in Wagtail (models.py) works:
class Posts(models.Model):
img = models.ForeignKey(
"wagtailimages.Image",
upload_to='posts', # How to add this line correctly ?
on_delete=models.SET_NULL,
null=True,
blank=False,
related_name="+",
)
Idea for Media Folder in Wagtail:
- Media
- authors
- posts
- images
- original_images
...