Opened 13 years ago

Closed 13 years ago

#16060 closed Bug (invalid)

Model entry does not get verified and no error raised

Reported by: m.vovcu@… Owned by: nobody
Component: Database layer (models, ORM) Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Model:

class DestMail(models.Model):

user = models.ForeignKey(User)

mail = models.EmailField()

class Meta:

unique_together = (("user", "mail"),)

def unicode(self):

return self.mail

First of all, even on the command line you can enter anything in the mail-field. No verification.

While used this code:

## user defined, mail defined

m, created = DestMail.objects.get_or_create(user=user,mail=mail)

Object got created even if it existed. Neither "unique_together" does help.

I have to check anytime something is entered if it's not blank, because even blank entries got entered. Although there is no "blank=True" directive.

Didn't seem to have that problem with previous Django release. That's all I noticed so far.

marius

Change History (1)

comment:1 by Matt McClanahan, 13 years ago

Resolution: invalid
Status: newclosed
Type: UncategorizedBug

Model validation does not happen automatically when you're manipulating a model object directly. See http://docs.djangoproject.com/en/1.3/ref/models/instances/#validating-objects

Note: See TracTickets for help on using tickets.
Back to Top