.
This commit is contained in:
+3
-5
@@ -34,7 +34,7 @@ from easy_thumbnails.exceptions import InvalidImageFormatError
|
||||
|
||||
image_storage = FileSystemStorage(
|
||||
# Physical file location ROOT
|
||||
location=u"{0}/longs/".format(settings.MEDIA_ROOT),
|
||||
location=u"{0}longs/".format(settings.MEDIA_ROOT),
|
||||
# Url for file
|
||||
base_url=u"{0}longs/".format(settings.MEDIA_URL),
|
||||
)
|
||||
@@ -144,12 +144,10 @@ class Long(models.Model):
|
||||
|
||||
|
||||
def test_image_validator(file):
|
||||
if 100 == 200:
|
||||
raise ValidationError("Error")
|
||||
return True
|
||||
pass
|
||||
|
||||
class LongSeriesImage(models.Model):
|
||||
image = models.ImageField(upload_to=image_directory_path, storage=image_storage, validators=[test_image_validator])
|
||||
image = models.FileField(upload_to=image_directory_path, storage=image_storage)
|
||||
position = models.IntegerField(default=0)
|
||||
series = models.ForeignKey(
|
||||
"LongSeries", related_name="images", on_delete=models.SET_NULL, null=True
|
||||
|
||||
Reference in New Issue
Block a user