Commit cdfeb78fc4b75857fdb88796cf6d0e946249f84b
1 parent
526896a8
Exists in
master
and in
5 other branches
Fixing bug in create user #186
Showing
3 changed files
with
33 additions
and
10 deletions
Show diff stats
core/static/js/main.js
users/forms.py
... | ... | @@ -39,7 +39,7 @@ class UserForm(RegisterUserForm): |
39 | 39 | |
40 | 40 | class Meta: |
41 | 41 | model = User |
42 | - fields = ['username', 'name', 'email', 'birth_date', 'city', 'state', 'gender', 'type_profile', 'cpf', 'phone', 'image', 'is_staff', 'is_active'] | |
42 | + fields = ['username', 'name', 'email', 'birth_date', 'city', 'state', 'gender', 'type_profile', 'cpf', 'phone', 'image', 'titration', 'year_titration', 'institution', 'curriculum', 'is_staff', 'is_active'] | |
43 | 43 | |
44 | 44 | class UpdateUserForm(forms.ModelForm): |
45 | 45 | |
... | ... | @@ -59,6 +59,7 @@ class UpdateUserForm(forms.ModelForm): |
59 | 59 | def clean_birth_date(self): |
60 | 60 | birth_date = self.cleaned_data['birth_date'] |
61 | 61 | if birth_date >= date.today(): |
62 | + print('===============' + date.today() + '================') | |
62 | 63 | raise forms.ValidationError(_('Please enter a valid date')) |
63 | 64 | return birth_date |
64 | 65 | ... | ... |
users/templates/users/create.html
... | ... | @@ -55,6 +55,22 @@ |
55 | 55 | </button> |
56 | 56 | </span> |
57 | 57 | </div> |
58 | + | |
59 | + {% elif field.auto_id == 'id_curriculum' %} | |
60 | + {% if field.field.required %} | |
61 | + <label for="{{ field.auto_id }}">{{ field.label }}<span>*</span></label> | |
62 | + {% else %} | |
63 | + <label for="{{ field.auto_id }}">{{ field.label }}</label> | |
64 | + {% endif %} | |
65 | + {% render_field field class='form-control' %} | |
66 | + <div class="input-group"> | |
67 | + <input type="text" readonly="" class="form-control" placeholder="{% trans 'Choose your file...' %}"> | |
68 | + <span class="input-group-btn input-group-sm"> | |
69 | + <button type="button" class="btn btn-fab btn-fab-mini"> | |
70 | + <i class="material-icons">attach_file</i> | |
71 | + </button> | |
72 | + </span> | |
73 | + </div> | |
58 | 74 | {% elif field.auto_id == 'id_is_staff' or field.auto_id == 'id_is_active' %} |
59 | 75 | <div class="checkbox"> |
60 | 76 | <label for="{{ field.auto_id }}"> |
... | ... | @@ -69,6 +85,14 @@ |
69 | 85 | {% endif %} |
70 | 86 | {% render_field field class='form-control' onkeypress='campoNumerico(this,event); formatarCpf(this,event);' %} |
71 | 87 | |
88 | + {% elif field.auto_id == 'id_year_titration' %} | |
89 | + {% if field.field.required %} | |
90 | + <label for="{{ field.auto_id }}">{{ field.label }}<span>*</span></label> | |
91 | + {% else %} | |
92 | + <label for="{{ field.auto_id }}">{{ field.label }}</label> | |
93 | + {% endif %} | |
94 | + {% render_field field class='form-control' onkeypress='campoNumerico(this,event);' %} | |
95 | + | |
72 | 96 | {% elif field.auto_id == 'id_phone' %} |
73 | 97 | {% if field.field.required %} |
74 | 98 | <label for="{{ field.auto_id }}">{{ field.label }}<span>*</span></label> |
... | ... | @@ -86,7 +110,7 @@ |
86 | 110 | {% endif %} |
87 | 111 | <span id="helpBlock" class="help-block">{{ field.help_text }}</span> |
88 | 112 | {% if field.errors %} |
89 | - <div class="alert alert-danger alert-dismissible col-md-offset-4 col-md-8" role="alert"> | |
113 | + <div class="alert alert-danger alert-dismissible" role="alert"> | |
90 | 114 | <button type="button" class="close" data-dismiss="alert" aria-label="Close"> |
91 | 115 | <span aria-hidden="true">×</span> |
92 | 116 | </button> |
... | ... | @@ -100,10 +124,10 @@ |
100 | 124 | </div> |
101 | 125 | {% endfor %} |
102 | 126 | <div class="col-md-offset-2 col-md-2 col-sm-2 col-xs-2"> |
103 | - <input type="submit" value="{% trans 'Save' %}" class="btn btn-sm btn-success" onclick="validarCpfSemAlert(id_cpf, CPF, idElementoMensagemErro)'" /> | |
127 | + <input type="submit" value="{% trans 'Save' %}" class="btn btn-raised btn-success" onclick="validarCpfSemAlert(id_cpf, CPF, idElementoMensagemErro)'" /> | |
104 | 128 | </div> |
105 | - <div class="col-md-offset-3 col-md-2 col-sm-2 col-xs-2"> | |
106 | - <a href="{% url 'users:manage' %}" class="btn btn-sm btn-default" >{% trans 'Cancel' %}</a> | |
129 | + <div class="col-md-offset-4 col-md-2 col-sm-2 col-xs-2"> | |
130 | + <a href="{% url 'users:manage' %}" class="btn btn-raised btn-danger" >{% trans 'Cancel' %}</a> | |
107 | 131 | </div> |
108 | 132 | </form> |
109 | 133 | </div> |
... | ... | @@ -113,7 +137,3 @@ |
113 | 137 | </br> |
114 | 138 | </br> |
115 | 139 | {% endblock %} |
116 | - | |
117 | -{% block javascript %} | |
118 | - <script src="{% static 'js/base/amadeus.js' %}"></script> | |
119 | -{% endblock %} | ... | ... |