You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Membership drops the TimeStamped ordering its siblings keep #335
Membership drops the ordering that every other TimeStamped model keeps. Membership.objects.latest() raises as a result.
Work reference: branch codingjoe-weekly-digest, commits 2ace45d to 6f28eac, weekly sending digest (superJoe crew, out of scope for that change).
side quest: accounts.models.Membership.Meta does not inherit TimeStamped.Meta, so Membership silently drops the modified_at/created_at ordering and get_latest_by that every sibling model keeps. [accounts/models.py]:L83
abstract.models.TimeStamped.Meta sets ordering = ("-modified_at", "-created_at") and get_latest_by = "created_at" (abstract/models.py:31-34). Membership.Meta declares only the unique constraint. The model therefore has no default ordering, while every other TimeStamped child inherits one. Membership.objects.latest() raises.
The change is one line, but it alters the ordering of any unordered membership queryset. It needs a check of its callers, not a drive-by fix.
Activity