Overriding save() is the best place to put that logic and it should
work well with the admin also
(other way is by means of signals)
On Oct 18, 3:45 pm, Tomasz Zieliński
wrote:
> Maybe you can use something like this:
>
> http://stackoverflow.com/questions/1346765/unique-constraint-that-all...
>
Maybe you can use something like this:
http://stackoverflow.com/questions/1346765/unique-constraint-that-allows-empty-values-in-mysql
This would probably mean converting is_master to:
is_master = models.BooleanField(null=True, blank=True, unique=True)
- and possibly overriding save to convert
Hi all,
Let's say I have a model like so:
class Thing(models.Model):
is_master = models.BooleanField()
name = models.CharField()
Now I want to be sure that only one Thing is_master at any given time.
The rest of the Things must not be master and end users shouldn't be
able to make a sen
3 matches
Mail list logo