Bug #6766
Regression Django 1.7 Unknown field(s) for user
100%
Description
If you have specific attributes on the User object, when you try to edit a user you have the following traceback (https://idp-montpellier.dev.entrouvert.org/admin/auth/user/1569/?_changelist_filters=q%3Djschneider):
File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response 111. response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/usr/lib/python2.7/dist-packages/django/contrib/admin/options.py" in wrapper 584. return self.admin_site.admin_view(view)(*args, **kwargs) File "/usr/lib/python2.7/dist-packages/django/utils/decorators.py" in _wrapped_view 105. response = view_func(request, *args, **kwargs) File "/usr/lib/python2.7/dist-packages/django/views/decorators/cache.py" in _wrapped_view_func 52. response = view_func(request, *args, **kwargs) File "/usr/lib/python2.7/dist-packages/django/contrib/admin/sites.py" in inner 204. return view(request, *args, **kwargs) File "/usr/lib/python2.7/dist-packages/django/contrib/admin/options.py" in change_view 1457. return self.changeform_view(request, object_id, form_url, extra_context) File "/usr/lib/python2.7/dist-packages/django/utils/decorators.py" in _wrapper 29. return bound_func(*args, **kwargs) File "/usr/lib/python2.7/dist-packages/django/utils/decorators.py" in _wrapped_view 105. response = view_func(request, *args, **kwargs) File "/usr/lib/python2.7/dist-packages/django/utils/decorators.py" in bound_func 25. return func.__get__(self, type(self))(*args2, **kwargs2) File "/usr/lib/python2.7/dist-packages/django/db/transaction.py" in inner 394. return func(*args, **kwargs) File "/usr/lib/python2.7/dist-packages/django/contrib/admin/options.py" in changeform_view 1394. ModelForm = self.get_form(request, obj) File "/usr/lib/python2.7/dist-packages/django/contrib/auth/admin.py" in get_form 77. return super(UserAdmin, self).get_form(request, obj, **defaults) File "/usr/lib/python2.7/dist-packages/django/contrib/admin/options.py" in get_form 671. % (e, self.__class__.__name__)) Exception Type: FieldError at /admin/auth/user/1569/ Exception Value: Unknown field(s) (ville, code_postal, mobile, adresse, phone, civilite) specified for User. Check fields/fieldsets/exclude attributes of class AuthenticUserAdmin.
Fichiers
Révisions associées
Make UserEditForm of the manager handle custom attributes (fixes #6766)
Work around regression with model forms when a non-model form is passed to modelform_factory by the django.contrib.admin (refs #6766)
Historique
Mis à jour par Benjamin Dauvergne il y a environ 9 ans
- Fichier 0001-Work-around-regression-with-model-forms-when-a-non-m.patch 0001-Work-around-regression-with-model-forms-when-a-non-m.patch ajouté
- Fichier 0002-Make-UserEditForm-of-the-manager-handle-custom-attri.patch 0002-Make-UserEditForm-of-the-manager-handle-custom-attri.patch ajouté
C'est une vrai régression coté Django, j'ai ouvert un ticket: https://code.djangoproject.com/ticket/24502 .
En attendant voilà un contournement et aussi l'ajout à /manage/
de l'édition des champs particuliers des utilisateurs, c'est plus propre que ce qu'on fait dans l'admin.
Mis à jour par Benjamin Dauvergne il y a environ 9 ans
- Statut changé de En cours à Résolu (à déployer)
- % réalisé changé de 0 à 100
Appliqué par commit 1e86f0a2a79aea771e5654c5a8e916f2617e94c3.
Mis à jour par Benjamin Dauvergne il y a presque 9 ans
- Statut changé de Résolu (à déployer) à Fermé
Work around regression with model forms when a non-model form is passed to modelform_factory by the django.contrib.admin (refs #6766)