Opened 9 years ago

Last modified 9 years ago

#25343 closed Bug

pk attribute not set when having own primary key — at Initial Version

Reported by: eng. Ilian Iliev Owned by: nobody
Component: Database layer (models, ORM) Version: 1.8
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

Example:

# models.py
class Language(models.Model):
    language = models.IntegerField(primary_key=True)
    code = models.CharField(verbose_name='Language code (2 chars)', blank=False, max_length=2)

# views.py
l = Language.objects.create(code='x')
print l.pk  # return None

The above mention problem happens only if we have "primary_key=True"

Change History (0)

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