Opened 17 years ago
Closed 17 years ago
#9729 closed (invalid)
Saving a model instance without CharField primary key does not raise IntegrityError
| Reported by: | Pam | 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: | no | UI/UX: | no |
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
Note:
See TracTickets
for help on using tickets.
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.