#3914 closed (duplicate)
Self-referencing keys in the list_display kills development server with no error thrown
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | contrib.admin | Version: | dev |
Severity: | Keywords: | self-reference list_display | |
Cc: | None | Triage Stage: | Accepted |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
If you use this model:
class Page(models.Model): title = models.CharField(maxlength=192) default = models.BooleanField() template = models.CharField(maxlength=256) parent = models.ForeignKey('Page') sequence = models.IntegerField() visible_on_menu = models.BooleanField() defined_header = models.CharField(maxlength=256) date_of_creation = models.DateTimeField() class Admin: list_display = ['title','parent','visible_on_menu']
And try to go to the model in the admin interface, the development server just dies. There is no error, it just goes back to a command prompt waiting.
This model is to be used for a newforms-like setup that can have parent/child pages for building heirarchical navigation menus - and it will be handy to see the parent in the display.
Change History (8)
comment:1 by , 18 years ago
Description: | modified (diff) |
---|
comment:3 by , 18 years ago
Whilst this is something we might be able to fix, the workaround -- and the way the documentation recommends to do this -- is to use "self" instead of "Page" in the ForeignKey.
comment:4 by , 18 years ago
This might be something that django.core.management.validate could check for and display a warning?
comment:5 by , 17 years ago
Cc: | added |
---|---|
Keywords: | None added; self-reference list_display removed |
Summary: | Self-referencing keys in the list_display kills development server with no error thrown → None |
Triage Stage: | Accepted → Design decision needed |
Version: | SVN → other branch |
comment:6 by , 17 years ago
Keywords: | self-reference list_display added; None removed |
---|---|
Summary: | None → Self-referencing keys in the list_display kills development server with no error thrown |
Triage Stage: | Design decision needed → Accepted |
Version: | other branch → SVN |
Undo anonymous breakage
comment:7 by , 17 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Marking as duplicate of #4212 because a) this ticket has muted on being about the same issue and b) it has a couple of useful comments about things to consider before implementing validation of FK-to-self declarations.
comment:8 by , 17 years ago
Oops, second try: Marking as duplicate of #4212 because a) it has a couple of useful comments about things to consider before implementing validation of FK-to-self declarations and b) this ticket has mutated to being about the same issue.
(Fixed formatting in description.)