Changes between Initial Version and Version 1 of Ticket #23130, comment 6


Ignore:
Timestamp:
Aug 4, 2014, 6:01:27 AM (10 years ago)
Author:
Tushar Bhatia

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #23130, comment 6

    initial v1  
    1 I've just confirmed that I get this same behaviour as described by jonash. I am willing to work on a patch for this if this bug is accepted.
     1I've just confirmed that I get this same behaviour as described by jonash. I don't believe that disallowing the overriding of choices is an appropriate solution as it is useful in cases where the Boolean values resemble a meaning. I think the way forward is to disable the override in the init method. Here's a quick update for the __init__ method:
     2
     3{{{
     4    def __init__(self, *args, **kwargs):
     5        if 'choices' not in kwargs:
     6            kwargs['blank'] = True
     7        super(BooleanField, self).__init__(*args, **kwargs)
     8}}}
     9
     10This code gives the desired behaviour: if a Null value is specified when choices are overridden, then it will not be updated.
Back to Top