AnonymousUser should have a 'pk' attribute
|Reported by:||lamby||Owned by:|
|Cc:||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
I like the "pk" field on models as it means I can refer to the primary key of any instance without having to know some implementation detail about the model.
However, this idea breaks down with the AnonymousUser pseudo-model; it has an id element (of None) but it has no pk element. This requires some special-casing which I would like to be rid of.
Sure, it's not a real model. But if AnonymousUser has an 'id' element and can exist where a "real" auth.User may exist, it might as well have an 'pk' too.
Patch is trivial.
Change History (9)
comment:1 Changed 4 years ago by guettli
- Has patch unset
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:2 Changed 4 years ago by ptone
- Component changed from Uncategorized to contrib.auth
- Summary changed from AnonymousUser should have a 'pk' element to AnonymousUser should have a 'pk' attribute
- Triage Stage changed from Unreviewed to Accepted
- Type changed from Uncategorized to New feature
comment:3 Changed 4 years ago by smuss
- Has patch set
- Owner changed from nobody to smuss
- Status changed from new to assigned
comment:5 Changed 4 years ago by smuss
- Owner smuss deleted
- Status changed from assigned to new
- Version changed from 1.4 to SVN