Opened 6 years ago

Closed 6 years ago

Last modified 4 years ago

#10537 closed (fixed)

list_editable: ForeignKey widget points to wrong add_view

Reported by: bartTC Owned by: nobody
Component: contrib.admin Version: master
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: UI/UX:

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)

screenshot.png (191.4 KB) - added by bartTC 6 years ago.
changelist_foreignkey.diff (3.6 KB) - added by Alex 6 years ago.
changelist_foreignkey.2.diff (3.6 KB) - added by Alex 6 years ago.
changelist_foreignkey.3.diff (3.6 KB) - added by jezdez 6 years ago.
Fixed a problem with wrong order

Download all attachments as: .zip

Change History (11)

Changed 6 years ago by bartTC

comment:1 Changed 6 years ago by Alex

  • milestone set to 1.1
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted
  • Version changed from 1.0 to SVN

Changed 6 years ago by Alex

Changed 6 years ago by Alex

comment:2 Changed 6 years ago by kratorius

  • Has patch set

Changed 6 years ago by jezdez

Fixed a problem with wrong order

comment:3 Changed 6 years ago by jezdez

  • Triage Stage changed from Accepted to Ready for checkin

comment:4 Changed 6 years ago by jacob

  • Resolution set to fixed
  • Status changed from new to closed

(In [10235]) Fixed #10537: Fixed the foreign key add-another link in list_editable. Thanks, Alex and jezdez.

comment:5 follow-up: Changed 6 years ago by JP

  • 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)

comment:6 in reply to: ↑ 5 Changed 6 years ago by kmtracey

Replying to JP:
Opened #11532 to report this as a comment on a closed ticket can easily be overlooked.

comment:7 Changed 4 years ago by jacob

  • milestone 1.1 deleted

Milestone 1.1 deleted

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