Opened 11 years ago

Closed 11 years ago

#5587 closed (invalid)

Sorting by ForeignKey

Reported by: anonymous Owned by: nobody
Component: Uncategorized Version: newforms-admin
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


I'm using newforms-admin r6399 and don't understand how sorting by
ForeignKey works in the admin site.

consider this:

class Box(models.Model):
   serial = models.CharField(max_length=25, primary_key=True)
   group = models.ForeignKey(Group)
   force_fw = models.ForeignKey(release.Firmware,
related_name='force_fw', blank=True, null=True)
   blocked = models.BooleanField(default=False)
   reported_fw = models.ForeignKey(release.Firmware,
related_name='reported_fw', blank=True, null=True)
   reported_time = models.DateTimeField(blank=True, null=True)
   reported_ip = models.IPAddressField(blank=True, null=True, default=None)

If i set force_fw to "blank=True, null=True" (optional field to store
as NULL if not given), i cannot sort by this field in the admin page.
If i set it to "blank=True" the admin page only shows entries with a
non-null force_fw.

Any idea?

Change History (1)

comment:1 Changed 11 years ago by Malcolm Tredinnick

Resolution: invalid
Status: newclosed

Please ask support questions on the mailing list, not in the bug tracker.

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