I am trying to override some default values in a inherited Django model. I have a bunch of different image sizes for models I need and the fields needed are 90% the same.
I have tried creating a base model to use and was going to add any additional fields needed to the child models.
The problem I am having is that the images are only using the "default" values I have set and are not being overwritten in the child model. Is what I am trying to accomplish possible?
Thanks!
class ImageLink(models.Model):
#Default Image Sizes
SIZED_WIDTH = 500
SIZED_HEIGHT = 400
THUMB_WIDTH = 50
THUMB_HEIGHT = 50
#Name of the link
name = models.CharField(max_length = 15)
#Images used for link
image_original = models.ImageField(upload_to="imageLink/images/%Y/%m/%d")
image_sized = ImageSpecField( source='image_original',
processors=[ResizeToFill(SIZED_WIDTH, SIZED_HEIGHT)],
format='JPEG',
options={'quality' : 60 })
image_thumb = ImageSpecField( source='image_original',
processors=[ResizeToFill(THUMB_WIDTH, THUMB_HEIGHT)],
format='JPEG',
options={'quality' : 60 })
class Meta:
abstract = True
# Model for all poster links
class PosterLink(ImageLink):
#Image sizes
SIZED_WIDTH = 200
SIZED_HEIGHT = 263
THUMB_WIDTH = 50
THUMB_HEIGHT = 66