Ticket #33175: admin_quote_object_pk.diff

File admin_quote_object_pk.diff, 828 bytes (added by Alexander Pervakov, 3 years ago)
  • django/contrib/admin/widgets.py

    diff --git a/django/contrib/admin/widgets.py b/django/contrib/admin/widgets.py
    index f1002cac6c..ea431d277f 100644
    a b import json  
    66
    77from django import forms
    88from django.conf import settings
     9from django.contrib.admin.utils import quote
    910from django.core.exceptions import ValidationError
    1011from django.core.validators import URLValidator
    1112from django.db.models import CASCADE
    class ForeignKeyRawIdWidget(forms.TextInput):  
    184185                    obj._meta.app_label,
    185186                    obj._meta.object_name.lower(),
    186187                ),
    187                 args=(obj.pk,)
     188                args=(quote(obj.pk),)
    188189            )
    189190        except NoReverseMatch:
    190191            url = ''  # Admin not registered for target model.
Back to Top