#10537 closed (fixed)
list_editable: ForeignKey widget points to wrong add_view
Reported by: | Martin Mahner | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | dev |
Severity: | Keywords: | list_editable, foreignkey | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
If a ForeignKey is a field of a list_editable row, the link to the add_view (plus sign next to the dropdown) points to a url ../../../<applabel>/<modulename>/add/
which is wrong from the changlist view.
I've attached a screenshot for understanding.
Attachments (4)
Change History (11)
by , 16 years ago
Attachment: | screenshot.png added |
---|
comment:1 by , 16 years ago
milestone: | → 1.1 |
---|---|
Triage Stage: | Unreviewed → Accepted |
Version: | 1.0 → SVN |
by , 16 years ago
Attachment: | changelist_foreignkey.diff added |
---|
by , 16 years ago
Attachment: | changelist_foreignkey.2.diff added |
---|
comment:2 by , 16 years ago
Has patch: | set |
---|
by , 16 years ago
Attachment: | changelist_foreignkey.3.diff added |
---|
comment:3 by , 16 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
comment:4 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
follow-up: 6 comment:5 by , 15 years ago
Has patch: | unset |
---|
This is happening again with 1.1 RC.. (is this related to the backward incompatible changes in http://code.djangoproject.com/ticket/10061?)
Instead of the correct link "/admin/bar/spam/add" I get "/bar/spam/add". The link in edit view is still correct though..
Here's my simple failing example:
1 from django.db import models 2 3 class Spam(models.Model): 4 x = models.CharField(max_length=10) 5 y = models.IntegerField(null=True, blank=True) 6 7 def __unicode__(self): 8 return self.x 9 10 11 class Egg(models.Model): 12 spam = models.ForeignKey('Spam') # <--------- 13 e = models.CharField(max_length=200) 14 15 def __unicode__(self): 16 return self.e
1 from foo.bar.models import Spam, Egg 2 from django.contrib import admin 3 4 5 class EggAdmin(admin.ModelAdmin): 6 fields = ('spam', 'e',) 7 list_display = ('e', 'spam',) 8 list_editable = ('spam',) # <--------- 9 10 class SpamAdmin(admin.ModelAdmin): 11 fields = ('x', 'y',) 12 list_display = ('x', 'y',) 13 14 admin.site.register(Spam, SpamAdmin) 15 admin.site.register(Egg, EggAdmin)
Fixed a problem with wrong order