I have a CharField in my model which declares uniqueness and is nullable:
class MyModel(models.Model):
myfield = models.CharField(unique=True, null=True, max_length=100)
The reason for doing this is that Django doesn't consider equal for purposes of uniqueness two null values.
When I instantiate some of these objects with model mommy it automatically fills the field with data, Even when I explicitly say myfield=None or myfield=lambda: None. Is there any way of getting around this?
I have a
CharField
in my model which declares uniqueness and is nullable:The reason for doing this is that Django doesn't consider equal for purposes of uniqueness two null values.
When I instantiate some of these objects with model mommy it automatically fills the field with data, Even when I explicitly say
myfield=None
ormyfield=lambda: None
. Is there any way of getting around this?