Commit d9e6a44c7b7522c980494a3105099bc436c2ea47
1 parent
e168fc9d
Exists in
master
and in
5 other branches
Consertando os bugs de register user #371
Showing
2 changed files
with
83 additions
and
74 deletions
Show diff stats
core/templates/register_user.html
... | ... | @@ -23,97 +23,106 @@ |
23 | 23 | {% endfor %} |
24 | 24 | {% endif %} |
25 | 25 | <div class="row"> |
26 | - <div class="col-sm-6 col-sm-offset-4 col-md-6 col-md-offset-4 col-xs-6 col-xs-offset-4 col-lg-6 col-lg-offset-4 col-xl-6 col-xl-offset-4 "> | |
27 | - <div class="col-sm-8 col-sm-offset-2 col-md-8 col-md-offset-2 col-xs-8 col-xs-offset-2 col-lg-8 col-lg-offset-2 col-xl-8 col-xl-offset-2"> | |
28 | - <img src="{% static 'img/amadeus.png' %}" class="img-responsive center-block logo-login " alt="logo amadeus"> | |
29 | - </div> | |
30 | - </div> | |
26 | + <div class="col-sm-7 col-sm-offset-4 col-md-6 col-md-offset-4 col-xs-8 col-xs-offset-3 col-lg-6 col-lg-offset-4 col-xl-6 col-xl-offset-4 "> | |
27 | + <div class="col-sm-9 col-sm-offset-2 col-md-8 col-md-offset-2 col-xs-9 col-xs-offset-2 col-lg-8 col-lg-offset-2 col-xl-8 col-xl-offset-2"> | |
28 | + <img src="{% static 'img/amadeus.png' %}" class="img-responsive center-block logo-login " alt="logo amadeus"> | |
29 | + </div> | |
30 | + </div> | |
31 | 31 | </div> |
32 | 32 | |
33 | 33 | <div class="row"> |
34 | - <div class="col-lg-8 col-lg-offset-3 col-md-8 col-md-offset-3 col-sm-8 col-sm-offset-3 col-xs-8 col-xs-offset-3"> | |
34 | + <div class="col-lg-8 col-lg-offset-3 col-md-8 col-md-offset-3 col-sm-9 col-sm-offset-3 col-xs-10 col-xs-offset-2"> | |
35 | 35 | <div class="card"> |
36 | 36 | <div class="card-body"> |
37 | 37 | <div class="row"> |
38 | - <div class="col-md-12 text-center"> | |
39 | - <h2 style="color:#43a251"><strong>{% trans "User Register" %}</strong></h2> | |
40 | - </div> | |
41 | - </div> | |
38 | + <div class="col-md-12 text-center"> | |
39 | + <h2 style="color:#43a251"><strong>{% trans "User Register" %}</strong></h2> | |
40 | + </div> | |
41 | + </div> | |
42 | 42 | |
43 | - <form class="form-horizontal" name="registerForm" method="post" action="" enctype="multipart/form-data"> | |
43 | + <form class="{% if form.has_error %} has-error {% endif %} is-fileinput" method="post" enctype="multipart/form-data"> | |
44 | 44 | {% csrf_token %} |
45 | 45 | {% for field in form %} |
46 | - <div class="form-group is-empty {% if form.has_error %} has-error {% endif %} is-fileinput"> | |
47 | - {% if field.field.required %} | |
48 | - <label for="{{ field.auto_id }}" class="col-md-2 control-label">{{ field.label }}<span>*</span></label> | |
49 | - {% else %} | |
50 | - <label for="{{ field.auto_id }}" class="col-md-2 control-label">{{ field.label }}</label> | |
51 | - {% endif %} | |
52 | - <div class="col-md-10"> | |
53 | - {% if field.auto_id == 'id_birth_date' %} | |
54 | - {% render_field field class='form-control input-sm date-picker' %} | |
55 | - | |
56 | - <span id="helpBlock" class="help-block">{{ field.help_text }}</span> | |
57 | - {% elif field.auto_id == 'id_image' %} | |
58 | - {% render_field field class='form-control input-sm' %} | |
59 | - <div class="input-group"> | |
60 | - <input type="text" readonly="" class="form-control" placeholder="Choose your photo..."> | |
61 | - <span class="input-group-btn input-group-sm"> | |
62 | - <button type="button" class="btn btn-fab btn-fab-mini"> | |
63 | - <i class="material-icons">image</i> | |
64 | - </button> | |
65 | - </span> | |
66 | - </div> | |
67 | - {% elif field.auto_id == 'id_curriculum' %} | |
68 | - {% render_field field class='form-control input-sm' %} | |
69 | - <div class="input-group"> | |
70 | - <input type="text" readonly="" class="form-control" placeholder="{% trans 'Choose the file ...' %}"> | |
71 | - <span class="input-group-btn input-group-sm"> | |
72 | - <button type="button" class="btn btn-fab btn-fab-mini"> | |
73 | - <i class="material-icons">attach_file</i> | |
74 | - </button> | |
75 | - </span> | |
46 | + <div class="col-md-10 col-md-offset-1 col-sm-12 col-xs-12 col-lg-10 col-lg-offset-1"> | |
47 | + <div class="row form-group"> | |
48 | + <div class="col-md-2 col-sm-3 col-xs-5 col-lg-2 text-right"> | |
49 | + {% if field.field.required %} | |
50 | + <label for="{{ field.auto_id }}" class="control-label">{{ field.label }}<span>*</span></label> | |
51 | + {% else %} | |
52 | + <label for="{{ field.auto_id }}" class="control-label">{{ field.label }}</label> | |
53 | + {% endif %} | |
76 | 54 | </div> |
77 | - {% elif field.auto_id == 'id_cpf' %} | |
78 | - {% render_field field class='form-control' onkeypress='campoNumerico(this,event); formatarCpf(this,event);' %} | |
79 | - | |
80 | - {% elif field.auto_id == 'id_year_titration' %} | |
81 | - {% render_field field class='form-control' onkeypress='campoNumerico(this,event);' %} | |
55 | + <div class="col-md-10 col-sm-9 col-xs-7 col-lg-10"> | |
56 | + {% if field.auto_id == 'id_birth_date' %} | |
57 | + {% render_field field class='form-control date-picker' %} | |
58 | + {% elif field.auto_id == 'id_image' %} | |
59 | + {% render_field field class='form-control' %} | |
60 | + <div class="input-group"> | |
61 | + <input type="text" readonly="" class="form-control" placeholder="Choose your photo..."> | |
62 | + <span class="input-group-btn input-group-sm"> | |
63 | + <button type="button" class="btn btn-fab btn-fab-mini"> | |
64 | + <i class="material-icons">image</i> | |
65 | + </button> | |
66 | + </span> | |
67 | + </div> | |
68 | + {% elif field.auto_id == 'id_curriculum' %} | |
69 | + {% render_field field class='form-control' %} | |
70 | + <div class="input-group"> | |
71 | + <input type="text" readonly="" class="form-control" placeholder="{% trans 'Choose the file ...' %}"> | |
72 | + <span class="input-group-btn input-group-sm"> | |
73 | + <button type="button" class="btn btn-fab btn-fab-mini"> | |
74 | + <i class="material-icons">attach_file</i> | |
75 | + </button> | |
76 | + </span> | |
77 | + </div> | |
78 | + {% elif field.auto_id == 'id_cpf' %} | |
79 | + {% render_field field class='form-control' onkeypress='campoNumerico(this,event); formatarCpf(this,event);' %} | |
82 | 80 | |
83 | - {% elif field.auto_id == 'id_phone' %} | |
84 | - {% render_field field class='form-control' onkeypress='campoNumerico(this,event); formatarTelefone(this,event);' %} | |
85 | - {% else %} | |
86 | - {% render_field field class='form-control' %} | |
87 | - <span id="helpBlock" class="help-block">{{ field.help_text }}</span> | |
88 | - {% endif %} | |
89 | - </div> | |
81 | + {% elif field.auto_id == 'id_year_titration' %} | |
82 | + {% render_field field class='form-control' onkeypress='campoNumerico(this,event);' %} | |
90 | 83 | |
91 | - {% if field.errors %} | |
92 | - <div class="alert alert-danger alert-dismissible col-md-offset-1 col-md-10 col-sm-offset-1 col-sm-10 col-xs-offset-1 col-xs-10" role="alert"> | |
93 | - <button type="button" class="close" data-dismiss="alert" aria-label="Close"> | |
94 | - <span aria-hidden="true">×</span> | |
95 | - </button> | |
96 | - <ul> | |
97 | - {% for error in field.errors %} | |
98 | - <li>{{ error }}</li> | |
99 | - {% endfor %} | |
100 | - </ul> | |
84 | + {% elif field.auto_id == 'id_phone' %} | |
85 | + {% render_field field class='form-control' onkeypress='campoNumerico(this,event); formatarTelefone(this,event);' %} | |
86 | + {% else %} | |
87 | + {% render_field field class='form-control' %} | |
88 | + {% endif %} | |
89 | + <span class="help-block">{{ field.help_text }}</span> | |
90 | + {% if field.errors %} | |
91 | + <div class="row"> | |
92 | + <div class="alert alert-danger alert-dismissible" role="alert"> | |
93 | + <button type="button" class="close" data-dismiss="alert" aria-label="Close"> | |
94 | + <span aria-hidden="true">×</span> | |
95 | + </button> | |
96 | + <ul> | |
97 | + {% for error in field.errors %} | |
98 | + <li>{{ error }}</li> | |
99 | + {% endfor %} | |
100 | + </ul> | |
101 | + </div> | |
102 | + </div> | |
103 | + {% endif %} | |
104 | + </div> | |
101 | 105 | </div> |
102 | - {% endif %} | |
103 | 106 | </div> |
104 | 107 | {% endfor %} |
105 | - <div class="col-md-offset-2 col-md-6 col-sm-offset-2 col-sm-6 col-xs-6 col-xs-offset-2 col-xs-6"> | |
106 | - <input type="submit" value="{% trans 'Save' %}" class="btn btn-raised btn-primary" /> | |
107 | - </div> | |
108 | - <div class=" col-md-4 col-sm-4 col-xs-4"> | |
109 | - <a href="{% url 'core:home' %}" class=" btn btn-danger btn-raised" >{% trans 'Cancel' %}</a> | |
108 | + <div class="row"> | |
109 | + <div class="col-md-5 col-xs-6 col-sm-6 col-lg-5 col-lg-offset-1 col-md-offset-1 text-center"> | |
110 | + <input type="submit" value="{% trans 'Register' %}" class="btn btn-raised btn-primary" /> | |
111 | + </div> | |
112 | + <div class="col-md-5 col-xs-6 col-sm-6 col-lg-5 text-center"> | |
113 | + <a href="{% url 'core:home' %}" class="btn btn-Success btn-raised" >{% trans 'Login' %}</a> | |
114 | + </div> | |
110 | 115 | </div> |
111 | - | |
112 | 116 | </form> |
113 | 117 | </div> |
114 | 118 | </div> |
115 | 119 | </div> |
116 | 120 | </div> |
121 | +<script type="text/javascript"> | |
122 | +var locale = navigator.language || navigator.userLanguage; | |
117 | 123 | |
118 | -<br clear="all" /> | |
124 | +$('.date-picker').datepicker({ | |
125 | + language: locale, | |
126 | +}); | |
127 | +</script> | |
119 | 128 | {% endblock %} | ... | ... |
users/models.py
... | ... | @@ -20,14 +20,14 @@ class User(AbstractBaseUser, PermissionsMixin): |
20 | 20 | city = models.CharField(_('City'), max_length = 90, blank = True) |
21 | 21 | state = models.CharField(_('State'), max_length = 30, blank = True) |
22 | 22 | gender = models.CharField(_('Gender'), max_length = 1, choices = (('M', _('Male')), ('F', _('Female')))) |
23 | - image = models.ImageField(verbose_name = _('Image'), null=True, blank = True, upload_to = 'users/') | |
23 | + image = models.ImageField(verbose_name = _('Photo'), null=True, blank = True, upload_to = 'users/') | |
24 | 24 | birth_date = models.DateField(_('Birth Date'), null=True) |
25 | 25 | phone = models.CharField(_('Phone'), max_length = 30, blank = True) |
26 | - cpf = models.CharField(_('Cpf'), max_length = 15) | |
26 | + cpf = models.CharField(_('CPF'), max_length = 15, blank=True, null=True) | |
27 | 27 | type_profile = models.IntegerField(_('Type'), null = True, blank = True, choices = ((1, _('Professor')), (2, _('Student'))), default=2) |
28 | 28 | titration = models.CharField(_('Titration'), max_length = 50, blank = True, null = True) |
29 | 29 | year_titration = models.CharField(_('Year of titration'), max_length = 4, blank = True, null = True) |
30 | - institution = models.CharField(_('Institution where he had titration'), max_length = 50, blank=True, null=True) | |
30 | + institution = models.CharField(_('Institution'), max_length = 50, blank=True, null=True) | |
31 | 31 | curriculum = models.FileField(verbose_name = _('Curriculum'), upload_to='users/curriculum/', null=True, blank=True) |
32 | 32 | date_created = models.DateTimeField(_('Create Date'), auto_now_add = True) |
33 | 33 | is_staff = models.BooleanField(_('Administrador'), default = False) | ... | ... |