While we're on the subject of null vs '' (empty string),
here's a
perverse case:
class TestSlug(models.Model):
sluggy=models.SlugField(maxlength=17,
primary_key=True,blank=True,null=False, editable=True)
name=models.CharField(maxlength=40)
def __str__(self): return "'%s': %s"
%(self.sluggy,self.name)
class Admin: pass
class TestSlugRef(models.Model):
testslug= models.ForeignKey(TestSlug, default=HOME_SLUG,
blank=True,
null=False)
viewed_by = models.CharField(maxlength=40)
class Admin: pass
Create some testslugs, give one a blank "sluggy"
primary key.
Create some TestSlugRefs- if you try selecting the testslug
with an
empty primary key, the admin says:
OperationalError at /admin/test/testslugref/2
(1263, "Column was set to data type implicit default;
NULL supplied for
NOT NULL column ...")
admin ought not be trying to use a null when the field is
explicitly
null=False...
tried to submit a ticket, got 'Askimet rejected spam'
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-users googlegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribe googlegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|