.
This commit is contained in:
@@ -0,0 +1,20 @@
|
|||||||
|
# Generated by Django 3.1.3 on 2021-02-09 22:39
|
||||||
|
|
||||||
|
import anatomy.models
|
||||||
|
import django.core.files.storage
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('anatomy', '0028_auto_20210206_0905'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='anatomyquestion',
|
||||||
|
name='image',
|
||||||
|
field=models.ImageField(storage=django.core.files.storage.FileSystemStorage(base_url='/media/anatomy/', location='/home/ross/rad/media//anatomy/'), upload_to=anatomy.models.image_directory_path),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# Generated by Django 3.1.3 on 2021-02-11 18:27
|
||||||
|
|
||||||
|
import django.core.files.storage
|
||||||
|
from django.db import migrations, models
|
||||||
|
import longs.models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('longs', '0013_auto_20210206_2147'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='longseriesimage',
|
||||||
|
name='image',
|
||||||
|
field=models.FileField(storage=django.core.files.storage.FileSystemStorage(base_url='/media/longs/', location='/home/ross/rad/media/longs/'), upload_to=longs.models.image_directory_path),
|
||||||
|
),
|
||||||
|
]
|
||||||
+3
-5
@@ -34,7 +34,7 @@ from easy_thumbnails.exceptions import InvalidImageFormatError
|
|||||||
|
|
||||||
image_storage = FileSystemStorage(
|
image_storage = FileSystemStorage(
|
||||||
# Physical file location ROOT
|
# Physical file location ROOT
|
||||||
location=u"{0}/longs/".format(settings.MEDIA_ROOT),
|
location=u"{0}longs/".format(settings.MEDIA_ROOT),
|
||||||
# Url for file
|
# Url for file
|
||||||
base_url=u"{0}longs/".format(settings.MEDIA_URL),
|
base_url=u"{0}longs/".format(settings.MEDIA_URL),
|
||||||
)
|
)
|
||||||
@@ -144,12 +144,10 @@ class Long(models.Model):
|
|||||||
|
|
||||||
|
|
||||||
def test_image_validator(file):
|
def test_image_validator(file):
|
||||||
if 100 == 200:
|
pass
|
||||||
raise ValidationError("Error")
|
|
||||||
return True
|
|
||||||
|
|
||||||
class LongSeriesImage(models.Model):
|
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)
|
position = models.IntegerField(default=0)
|
||||||
series = models.ForeignKey(
|
series = models.ForeignKey(
|
||||||
"LongSeries", related_name="images", on_delete=models.SET_NULL, null=True
|
"LongSeries", related_name="images", on_delete=models.SET_NULL, null=True
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# Generated by Django 3.1.3 on 2021-02-09 22:39
|
||||||
|
|
||||||
|
import django.core.files.storage
|
||||||
|
from django.db import migrations, models
|
||||||
|
import rapids.models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('rapids', '0012_auto_20210206_0905'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='rapidimage',
|
||||||
|
name='image',
|
||||||
|
field=models.ImageField(storage=django.core.files.storage.FileSystemStorage(base_url='/media/rapids/', location='/home/ross/rad/media//rapids/'), upload_to=rapids.models.image_directory_path),
|
||||||
|
),
|
||||||
|
]
|
||||||
Reference in New Issue
Block a user