Changeset 722ae18 in OpenWorkouts-current for ow/views


Ignore:
Timestamp:
Dec 17, 2018, 5:13:45 PM (5 years ago)
Author:
borja <borja@…>
Branches:
current, feature/docs, master
Children:
c90d245
Parents:
affc3f7
Message:

(#32) Improvements on the edit profile form:

  • Added field for nickname, set as not required
  • Applied classes to add some styling based on the new code in forms.css
  • Ensure the error messages are displayed clearly by the field that caused the errors.
  • Loaded pickadate js date picker for the birth date field
File:
1 edited

Legend:

Unmodified
Added
Removed
  • ow/views/user.py

    raffc3f7 r722ae18  
    150150        request.POST['picture'] = ''
    151151
    152     form = Form(request, schema=UserProfileSchema(), obj=context)
     152    nicknames = request.root.lowercase_nicknames
     153    if context.nickname:
     154        # remove the current user nickname from the list, preventing form
     155        # validation error
     156        nicknames.remove(context.nickname.lower())
     157    state = State(emails=request.root.lowercase_emails, names=nicknames)
     158    form = Form(request, schema=UserProfileSchema(), state=state, obj=context)
    153159
    154160    if 'submit' in request.POST and form.validate():
Note: See TracChangeset for help on using the changeset viewer.