Code

Opened 6 years ago

Closed 6 years ago

#9729 closed (invalid)

Saving a model instance without CharField primary key does not raise IntegrityError

Reported by: sinapam Owned by: nobody
Component: Uncategorized Version: 1.0
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Hi,

I have a model with a CharField as primary key. I then write a unit test where I'm not inserting the primary key but other required fields. I save the instance with force_insert=True (I'm using Django 1.0.2). Django saves this as blank string "" and not raising IntegrityError. I even tried adding Blank=False, but still gets the same result. Is this an expected behavior?

Regards,
Pam

Attachments (0)

Change History (1)

comment:1 Changed 6 years ago by mtredinnick

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

Please ask usage questions on the django-users list. This isn't a bug (since an empty string is a valid value). If you need more details, please use the mailing list.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.