Skip to content

Incorrect quatation of special characters in string primary keys #116

@insspb

Description

@insspb
class LocationMunicipality(models.Model):

    name = models.TextField(blank=False, primary_key=True)

obj = LocationMunicipality(name='Carlow/Mayo')
obj.save()

Mass admin will raise the following, if we will try to open one particular object, or several objects at once:

NoReverseMatch

Reverse for 'massadmin_change_view' with keyword arguments '{'app_name': 'location', 'model_name': 'locationmunicipalitydistrict', 'object_ids': 'Carlow/Mayo'}' not found. 1 pattern(s) tried: ['admin/(?P<app_name>[^/]+)/(?P<model_name>[^/]+)\\-masschange/(?P<object_ids>[^/]+)/\\Z']

The problem can be seen here:
Screenshot_20230919_111812

Value not quoted as expected by django admin.

Django admin use own pk quotation quote function from: django.contrib.admin.utils

Patch coming soon.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions