I have a Photo-Model that helps me achieve storing each image as a thumbnail aswell:
class Photo(models.Model):
image = models.ImageField(upload_to=upload_path, default=default_image)
thumbnail = models.ImageField(upload_to=upload_path_2, editable=False, default=default_image_2)
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
class Meta:
abstract = True
Now I have another Model, lets call it User, which inherits from Photo:
class User(Photo):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
Now lets say there are multiple classes inheriting from Photo and depending on the inheriting class, I want to set another upload_path and default_image. How Do I achieve that? Can I somehow use the constructor?
Thanks in Advance!
Photodjango will either be very inefficient or only provide you with the basemodel references (which you'll need to resolved 1 by 1). I urge you to reconsider inheritance and/or test thoroughly before continuingabstract = True. This might be more what you are looking for. This won't allow you to query allPhoto's but it will allow you to re-use code between modelsabstract = True-Line in this post, I already used it. But I still dont know how to go on, could you help me further?