I'm trying to implement basic uploading of images to a gallery in Django, however I'm not quite sure of how to perform multiple files upload as a standalone app. How can I create a gallery form whereby images can be added and deleted from?
models.py
from django.db import models
from PIL import Image
class Gallery(models.Model):
name = models.CharField(max_length=20)
class Image(models.Model):
title = models.CharField(max_length=60, blank=True, null=True)
description = models.TextField(blank=True, null=True)
image = models.ImageField(upload_to='testimg/profile_images', blank=True, null=True)
gallery = models.ForeignKey(Gallery, related_name="images", blank=True)
hidden = models.BooleanField()
created = models.DateTimeField(auto_now_add=True)
It will help you to make upload multiple files.
Formsets: https://docs.djangoproject.com/en/1.7/topics/forms/formsets/
Form wizard: https://docs.djangoproject.com/en/1.7/ref/contrib/formtools/form-wizard/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.