[Django] #30386: Admin foreign key widgets don't quote keys

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

[Django] #30386: Admin foreign key widgets don't quote keys

Django
#30386: Admin foreign key widgets don't quote keys
-----------------------------------------+------------------------
               Reporter:  jclgoodwin     |          Owner:  nobody
                   Type:  Bug            |         Status:  new
              Component:  contrib.admin  |        Version:  2.2
               Severity:  Normal         |       Keywords:
           Triage Stage:  Unreviewed     |      Has patch:  0
    Needs documentation:  0              |    Needs tests:  0
Patch needs improvement:  0              |  Easy pickings:  0
                  UI/UX:  0              |
-----------------------------------------+------------------------
 In django.contrib.admin.ModelAdmin, _changeform_view,  _delete_view and
 history_view and do unquote(object_id):

 https://github.com/django/django/blob/917fd9d03fdd21538864af4b412ac30b36d99268/django/contrib/admin/options.py#L1537

 However, ForeignKeyRawIdWidget and RelatedFieldWidgetWrapper create links
 to this view without calling quote():

 https://github.com/django/django/blob/89a2216486fa8a0513cbb1d49d2d587d4116c60b/django/contrib/admin/widgets.py#L191

 Steps to reproduce:

 1. Create two models: Topping with a CharField primary key, and Pizza with
 a ForeignKey to Topping. Register both models with the admin site.
 2. Create a Topping with the primary key '_40', and a Pizza with that
 topping
 3. In the admin site, go the the /change/ page for the Pizza, and click on
 the 'change' icon for the Topping foreign key, or (if using
 ForeignKeyRawIdWidget) the link to the Topping '_40'.
 4. See message 'Topping with ID "@" doesn't exist. Perhaps it was
 deleted?'.

--
Ticket URL: <https://code.djangoproject.com/ticket/30386>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/053.f3f2b530761bb45e50a3562f816e4e54%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #30386: Admin foreign key widgets don't quote keys. (was: Admin foreign key widgets don't quote keys)

Django
#30386: Admin foreign key widgets don't quote keys.
--------------------------------+------------------------------------
     Reporter:  Joshua Goodwin  |                    Owner:  nobody
         Type:  Bug             |                   Status:  new
    Component:  contrib.admin   |                  Version:  master
     Severity:  Normal          |               Resolution:
     Keywords:                  |             Triage Stage:  Accepted
    Has patch:  0               |      Needs documentation:  0
  Needs tests:  0               |  Patch needs improvement:  0
Easy pickings:  0               |                    UI/UX:  0
--------------------------------+------------------------------------
Changes (by felixxm):

 * version:  2.2 => master
 * stage:  Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/30386#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/068.622a8bf86fbea899739d055ed06bf7db%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #30386: Admin foreign key widgets don't quote keys.

Django
In reply to this post by Django
#30386: Admin foreign key widgets don't quote keys.
--------------------------------+------------------------------------
     Reporter:  Joshua Goodwin  |                    Owner:  zeynel
         Type:  Bug             |                   Status:  assigned
    Component:  contrib.admin   |                  Version:  master
     Severity:  Normal          |               Resolution:
     Keywords:                  |             Triage Stage:  Accepted
    Has patch:  0               |      Needs documentation:  0
  Needs tests:  0               |  Patch needs improvement:  0
Easy pickings:  0               |                    UI/UX:  0
--------------------------------+------------------------------------
Changes (by zeynel):

 * owner:  nobody => zeynel
 * status:  new => assigned


Comment:

 I believe there are two main parts to handle to fix this bug.

 - Quoting `obj.pk` value on
 https://github.com/django/django/blob/89a2216486fa8a0513cbb1d49d2d587d4116c60b/django/contrib/admin/widgets.py#L191
 - Quoting object pk(or sending quoted values in context)  on client side
 when user changes the selection on RelatedFieldWidget
 https://github.com/django/django/blob/89a2216486fa8a0513cbb1d49d2d587d4116c60b/django/contrib/admin/static/admin/js/admin/RelatedObjectLookups.js#L69

--
Ticket URL: <https://code.djangoproject.com/ticket/30386#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/068.a2108ce7eb53fb963231334fcf3e16b3%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #30386: Admin foreign key widgets don't quote keys.

Django
In reply to this post by Django
#30386: Admin foreign key widgets don't quote keys.
--------------------------------+------------------------------------
     Reporter:  Joshua Goodwin  |                    Owner:  zeynel
         Type:  Bug             |                   Status:  assigned
    Component:  contrib.admin   |                  Version:  master
     Severity:  Normal          |               Resolution:
     Keywords:                  |             Triage Stage:  Accepted
    Has patch:  1               |      Needs documentation:  0
  Needs tests:  0               |  Patch needs improvement:  0
Easy pickings:  0               |                    UI/UX:  0
--------------------------------+------------------------------------
Changes (by zeynel):

 * has_patch:  0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/30386#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/068.f76529fc84ceef8f3ad60e51cfa3f5c3%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #30386: Admin foreign key widgets don't quote keys.

Django
In reply to this post by Django
#30386: Admin foreign key widgets don't quote keys.
-------------------------------------+-------------------------------------
     Reporter:  Joshua Goodwin       |                    Owner:  zeynel
         Type:  Bug                  |                   Status:  assigned
    Component:  contrib.admin        |                  Version:  master
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Ready for
                                     |  checkin
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

 * stage:  Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/30386#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/068.f34e1b197ee973a6d8f645a57be3f667%40djangoproject.com.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #30386: Admin foreign key widgets don't quote keys.

Django
In reply to this post by Django
#30386: Admin foreign key widgets don't quote keys.
--------------------------------+------------------------------------
     Reporter:  Joshua Goodwin  |                    Owner:  zeynel
         Type:  Bug             |                   Status:  assigned
    Component:  contrib.admin   |                  Version:  master
     Severity:  Normal          |               Resolution:
     Keywords:                  |             Triage Stage:  Accepted
    Has patch:  1               |      Needs documentation:  0
  Needs tests:  0               |  Patch needs improvement:  1
Easy pickings:  0               |                    UI/UX:  0
--------------------------------+------------------------------------
Changes (by felixxm):

 * needs_better_patch:  0 => 1
 * stage:  Ready for checkin => Accepted


Comment:

 I still have some issue when saving models, please check attached project
 and try to add a new pizza with e.g. `_40` topping on
 `admin/test_one/pizza/add/`.

--
Ticket URL: <https://code.djangoproject.com/ticket/30386#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/068.a8ef232b4969542b7081e5f60e00ccc4%40djangoproject.com.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #30386: Admin foreign key widgets don't quote keys.

Django
In reply to this post by Django
#30386: Admin foreign key widgets don't quote keys.
--------------------------------+------------------------------------
     Reporter:  Joshua Goodwin  |                    Owner:  zeynel
         Type:  Bug             |                   Status:  assigned
    Component:  contrib.admin   |                  Version:  master
     Severity:  Normal          |               Resolution:
     Keywords:                  |             Triage Stage:  Accepted
    Has patch:  1               |      Needs documentation:  0
  Needs tests:  0               |  Patch needs improvement:  1
Easy pickings:  0               |                    UI/UX:  0
--------------------------------+------------------------------------
Changes (by felixxm):

 * Attachment "ticket_30386.zip" added.


--
Ticket URL: <https://code.djangoproject.com/ticket/30386>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/068.62615ab918b926b2586d518555fcddbd%40djangoproject.com.