Reputation: 7
please help solve the problem.
have an object:
class Product:
title = models.CharField(max_length=255)
active = models.BooleanField(default=False)
I create a new object:
class Book(Product):
slogan = models.CharField(max_length=255)
active = models.BooleanField(default=True) #???????
I need to override the attribute active. that is, to attribute always been active=True
at the same time I can not change the Product since I do not have access to it
Upvotes: 0
Views: 81
Reputation: 699
You have two options. You can use save() method in your model or you can use pre_save() signal.
Upvotes: 1
Reputation: 29977
Unfortunately, that is not possible, see https://docs.djangoproject.com/en/dev/topics/db/models/#field-name-hiding-is-not-permitted
Upvotes: 0