accounts/edit: deprecate (buggy) multiple attribute edition (#86937)
This commit is contained in:
parent
a03e111bab
commit
20b357071f
|
@ -113,13 +113,13 @@ class EditProfile(HomeURLMixin, cbv.HookMixin, cbv.TemplateNamesMixin, UpdateVie
|
|||
else:
|
||||
field_name = field
|
||||
try:
|
||||
attribute = models.Attribute.objects.get(name=field_name)
|
||||
attribute = models.Attribute.objects.get(name=field_name, multiple=False)
|
||||
except models.Attribute.DoesNotExist:
|
||||
editable_profile_fields.append(field)
|
||||
else:
|
||||
if attribute.user_editable:
|
||||
editable_profile_fields.append(field)
|
||||
attributes = models.Attribute.objects.filter(user_editable=True)
|
||||
attributes = models.Attribute.objects.filter(user_visible=True, user_editable=True, multiple=False)
|
||||
if scopes:
|
||||
scopes = set(scopes)
|
||||
default_fields = [
|
||||
|
|
|
@ -348,7 +348,9 @@ def test_attribute_model(app, db, settings, mailoutbox):
|
|||
models.Attribute.objects.create(
|
||||
label='Nom', name='nom', asked_on_registration=True, user_visible=True, kind='string'
|
||||
)
|
||||
models.Attribute.objects.create(label='Profession', name='profession', user_editable=True, kind='string')
|
||||
models.Attribute.objects.create(
|
||||
label='Profession', name='profession', user_visible=True, user_editable=True, kind='string'
|
||||
)
|
||||
|
||||
response = app.get(reverse('registration_register'))
|
||||
response.form.set('email', 'testbot@entrouvert.com')
|
||||
|
@ -398,8 +400,8 @@ def test_attribute_model(app, db, settings, mailoutbox):
|
|||
|
||||
assert 'Nom' in response.text
|
||||
assert 'Doe' in response.text
|
||||
assert 'Profession' not in response.text
|
||||
assert 'pompier' not in response.text
|
||||
assert 'Profession' in response.text
|
||||
assert 'pompier' in response.text
|
||||
assert 'Prénom' not in response.text
|
||||
assert 'John' not in response.text
|
||||
|
||||
|
|
Loading…
Reference in New Issue