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,7 +39,7 @@ class UserForm(RegisterUserForm): | ||
39 | 39 | ||
40 | class Meta: | 40 | class Meta: |
41 | model = User | 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 | class UpdateUserForm(forms.ModelForm): | 44 | class UpdateUserForm(forms.ModelForm): |
45 | 45 | ||
@@ -59,6 +59,7 @@ class UpdateUserForm(forms.ModelForm): | @@ -59,6 +59,7 @@ class UpdateUserForm(forms.ModelForm): | ||
59 | def clean_birth_date(self): | 59 | def clean_birth_date(self): |
60 | birth_date = self.cleaned_data['birth_date'] | 60 | birth_date = self.cleaned_data['birth_date'] |
61 | if birth_date >= date.today(): | 61 | if birth_date >= date.today(): |
62 | + print('===============' + date.today() + '================') | ||
62 | raise forms.ValidationError(_('Please enter a valid date')) | 63 | raise forms.ValidationError(_('Please enter a valid date')) |
63 | return birth_date | 64 | return birth_date |
64 | 65 |
users/templates/users/create.html
@@ -55,6 +55,22 @@ | @@ -55,6 +55,22 @@ | ||
55 | </button> | 55 | </button> |
56 | </span> | 56 | </span> |
57 | </div> | 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 | {% elif field.auto_id == 'id_is_staff' or field.auto_id == 'id_is_active' %} | 74 | {% elif field.auto_id == 'id_is_staff' or field.auto_id == 'id_is_active' %} |
59 | <div class="checkbox"> | 75 | <div class="checkbox"> |
60 | <label for="{{ field.auto_id }}"> | 76 | <label for="{{ field.auto_id }}"> |
@@ -69,6 +85,14 @@ | @@ -69,6 +85,14 @@ | ||
69 | {% endif %} | 85 | {% endif %} |
70 | {% render_field field class='form-control' onkeypress='campoNumerico(this,event); formatarCpf(this,event);' %} | 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 | {% elif field.auto_id == 'id_phone' %} | 96 | {% elif field.auto_id == 'id_phone' %} |
73 | {% if field.field.required %} | 97 | {% if field.field.required %} |
74 | <label for="{{ field.auto_id }}">{{ field.label }}<span>*</span></label> | 98 | <label for="{{ field.auto_id }}">{{ field.label }}<span>*</span></label> |
@@ -86,7 +110,7 @@ | @@ -86,7 +110,7 @@ | ||
86 | {% endif %} | 110 | {% endif %} |
87 | <span id="helpBlock" class="help-block">{{ field.help_text }}</span> | 111 | <span id="helpBlock" class="help-block">{{ field.help_text }}</span> |
88 | {% if field.errors %} | 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 | <button type="button" class="close" data-dismiss="alert" aria-label="Close"> | 114 | <button type="button" class="close" data-dismiss="alert" aria-label="Close"> |
91 | <span aria-hidden="true">×</span> | 115 | <span aria-hidden="true">×</span> |
92 | </button> | 116 | </button> |
@@ -100,10 +124,10 @@ | @@ -100,10 +124,10 @@ | ||
100 | </div> | 124 | </div> |
101 | {% endfor %} | 125 | {% endfor %} |
102 | <div class="col-md-offset-2 col-md-2 col-sm-2 col-xs-2"> | 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 | </div> | 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 | </div> | 131 | </div> |
108 | </form> | 132 | </form> |
109 | </div> | 133 | </div> |
@@ -113,7 +137,3 @@ | @@ -113,7 +137,3 @@ | ||
113 | </br> | 137 | </br> |
114 | </br> | 138 | </br> |
115 | {% endblock %} | 139 | {% endblock %} |
116 | - | ||
117 | -{% block javascript %} | ||
118 | - <script src="{% static 'js/base/amadeus.js' %}"></script> | ||
119 | -{% endblock %} |