burke-software / django-mass-edit

Make bulk changes in the Django admin interface
152 stars 67 forks source link

Incorrect quatation of special characters in string primary keys #116

Open insspb opened 9 months ago

insspb commented 9 months ago
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.