Commit c7f0223c83e0469422da5c3a3d01885ec27537e3
Exists in
master
and in
5 other branches
Merge branch 'dev' of https://github.com/amadeusproject/amadeuslms into dev
Showing
14 changed files
with
161 additions
and
111 deletions
Show diff stats
core/static/js/base/amadeus.js
... | ... | @@ -16,7 +16,7 @@ function campoNumerico(campo, evento){ |
16 | 16 | evento.returnValue = false; |
17 | 17 | return false; |
18 | 18 | } |
19 | -} | |
19 | +}; | |
20 | 20 | |
21 | 21 | function formatarCpf(campo, evento){ |
22 | 22 | var codTecla; |
... | ... | @@ -47,85 +47,37 @@ function formatarCpf(campo, evento){ |
47 | 47 | return false; |
48 | 48 | } |
49 | 49 | return false; |
50 | -} | |
50 | +}; | |
51 | 51 | |
52 | -function validarCpfSemAlert(campo,nome,idElementoMensagemErro){ | |
53 | - //alert("teste"); | |
54 | - cpf = campo.value; | |
55 | - | |
56 | - cpf = cpf.replace(".",""); | |
57 | - cpf = cpf.replace("-",""); | |
58 | - cpf = cpf.replace(".",""); | |
59 | - retorno = true; | |
52 | +function formatarTelefone(campo, evento){ | |
53 | + var codTecla; | |
54 | + var tamanho; | |
55 | + if( document.all ) { // Internet Explorer | |
56 | + codTecla = evento.keyCode; | |
57 | + } else if( document.layers ) { // Nestcape | |
58 | + codTecla = evento.which; | |
59 | + } else if( evento ) { // Firefox | |
60 | + codTecla = evento.which; | |
61 | + } | |
62 | + tamanho = campo.value.length; | |
60 | 63 | |
61 | - if(trim(cpf).length > 0){ | |
62 | - //alert("teste2"); | |
63 | - cpfstr= ''; | |
64 | - temp = cpf + ''; | |
65 | - | |
66 | - cpfstr = temp.substring(0,3); | |
67 | - cpfstr = cpfstr + temp.substring(3,6); | |
68 | - cpfstr = cpfstr + temp.substring(6,9); | |
69 | - cpfstr = cpfstr + temp.substring(9,11); | |
70 | - | |
71 | - | |
72 | - | |
73 | - retorno = false; | |
74 | - if(cpf != null){ | |
75 | - //alert("teste3"); | |
76 | - soma = 0; | |
77 | - digito1 = 0; | |
78 | - digito2 = 0; | |
79 | - for(i = 0; i < 9; i = i + 1) { | |
80 | - soma = soma + ((parseInt(cpf.substring(i,i+1)))*(11-(i+1))); | |
81 | - } | |
82 | - soma = soma % 11; | |
83 | - if (soma == 0 || soma == 1) { | |
84 | - digito1 = 0; | |
85 | - } else { | |
86 | - digito1 = 11 - soma; | |
87 | - } | |
88 | - soma = 0; | |
89 | - | |
90 | - for(i = 0; i < 9; i = i + 1) { | |
91 | - soma = soma + ((parseInt(cpf.substring(i,i+1)))*(12-(i+1))); | |
92 | - } | |
93 | - soma = soma + (digito1*2); | |
94 | - soma = soma % 11; | |
95 | - if (soma == 0 || soma == 1) { | |
96 | - digito2 = 0; | |
97 | - } | |
98 | - else{ | |
99 | - digito2 = 11 - soma; | |
100 | - } | |
101 | - digito = digito1 +''+ digito2; | |
102 | - | |
103 | - | |
104 | - //alert(cpfstr.substring(9,11)); | |
105 | - if(digito == (cpfstr.substring(9,11))){ | |
106 | - retorno = true; | |
107 | - } else{ | |
108 | - //alert("teste4"); | |
109 | - retorno = false; | |
110 | - | |
111 | - } | |
112 | - } else { | |
113 | - retorno = false; | |
64 | + if((codTecla > 47 && codTecla < 58) && tamanho < 14){ | |
65 | + | |
66 | + if(tamanho == 0){ | |
67 | + campo.value = "(" + campo.value; | |
68 | + }else if( tamanho == 3 ){ | |
69 | + campo.value = campo.value + ")"; | |
70 | + }else if(tamanho == 9){ | |
71 | + campo.value = campo.value + "-"; | |
114 | 72 | } |
115 | - }else{ | |
116 | - retorno = false; | |
117 | - } | |
118 | - //alert(retorno); | |
119 | - if(retorno == false){ | |
120 | - //alert('E-mail informado invalido! Por favor, especifique um E-mail válido para o campo \"' + nome + '\".'); | |
121 | - document.getElementById(idElementoMensagemErro).style.display = ''; | |
122 | - campo.focus(); | |
123 | - return false; | |
124 | - }else{ | |
125 | - document.getElementById(idElementoMensagemErro).style.display = 'none'; | |
126 | 73 | return true; |
74 | + } else if(codTecla == 0 || codTecla == 8){ | |
75 | + return true; | |
76 | + } else { | |
77 | + evento.returnValue = false; | |
78 | + return false; | |
127 | 79 | } |
128 | - return retorno; | |
80 | + return false; | |
129 | 81 | } |
130 | 82 | |
131 | 83 | /* | ... | ... |
core/tests.py
... | ... | @@ -165,21 +165,21 @@ class UpdateUserTestCase(TestCase): |
165 | 165 | data = {'username': 'test', 'password': 'testing1'} |
166 | 166 | response = self.client.post(reverse('core:home'), data) |
167 | 167 | self.assertRedirects(response, reverse('app:index')) |
168 | - | |
169 | 168 | |
170 | 169 | data={ |
171 | - 'username': 'testeamadeus', | |
172 | - 'email': 'teste@amadeus.com', | |
170 | + 'username': 'test', | |
171 | + 'birth_date': '12/12/2000', | |
172 | + 'email': 'testing@amadeus.com', | |
173 | + 'cpf': '705.089.884-89', | |
173 | 174 | 'name': 'Teste Amadeus', |
174 | 175 | 'city': 'Praia', |
175 | 176 | 'state': 'PE', |
176 | 177 | 'gender': 'F', |
177 | 178 | } |
178 | - # self.assertRedirects(response1, reverse('app:index')) | |
179 | 179 | response = self.client.get(self.url) |
180 | 180 | self.assertEqual(response.status_code, 200) |
181 | 181 | response = self.client.post(self.url, data) |
182 | - self.assertEqual(response.status_code, 302) | |
182 | + self.assertRedirects(response, reverse('users:profile')) | |
183 | 183 | |
184 | 184 | def test_update_error(self): |
185 | 185 | |
... | ... | @@ -195,12 +195,13 @@ class UpdateUserTestCase(TestCase): |
195 | 195 | 'username': '', |
196 | 196 | 'email': 'teste@amadeus.com', |
197 | 197 | 'name': 'Teste Amadeus', |
198 | + 'birth_date': '12/12/2000', | |
198 | 199 | 'city': 'Praia', |
199 | 200 | 'state': 'PE', |
200 | 201 | 'gender': 'F', |
201 | 202 | } |
202 | 203 | response = self.client.post(self.url, data) |
203 | - self.assertFormError(response, 'form', 'username', 'This field is required.') | |
204 | + self.assertFormError(response, 'form', 'username', _('This field is required.')) | |
204 | 205 | |
205 | 206 | |
206 | 207 | class DeleteUserTestCase(TestCase): | ... | ... |
courses/templates/subject/form_view_student.html
forum/static/js/forum.js
... | ... | @@ -57,7 +57,9 @@ function createForum(url, topic) { |
57 | 57 | $(".forum_form").html(data); |
58 | 58 | $("#id_topic").val(topic); |
59 | 59 | |
60 | - $('.date-picker').datepicker(); | |
60 | + $('.date-picker').datepicker({ | |
61 | + format: 'dd/mm/yyyy', | |
62 | + }); | |
61 | 63 | |
62 | 64 | var frm = $('#forum_create'); |
63 | 65 | frm.submit(function () { |
... | ... | @@ -92,15 +94,16 @@ function createForum(url, topic) { |
92 | 94 | * Function to load edit forum's form and set the submit function |
93 | 95 | * |
94 | 96 | */ |
95 | -function editForum(url, forum) { | |
97 | +function editForum(url, forum, success_message) { | |
96 | 98 | $.ajax({ |
97 | 99 | url: url, |
98 | 100 | data: {'pk': forum}, |
99 | 101 | success: function(data) { |
100 | 102 | $(".forum_form").html(data); |
101 | - //$("#id_topic").val(topic); | |
102 | 103 | |
103 | - $('.date-picker').datepicker(); | |
104 | + $('.date-picker').datepicker({ | |
105 | + format: 'dd/mm/yyyy', | |
106 | + }); | |
104 | 107 | |
105 | 108 | var frm = $('#forum_create'); |
106 | 109 | frm.submit(function () { |
... | ... | @@ -111,6 +114,8 @@ function editForum(url, forum) { |
111 | 114 | success: function (data) { |
112 | 115 | $('.forum_view').html(data); |
113 | 116 | |
117 | + alertify.success(success_message); | |
118 | + | |
114 | 119 | $("#editForum").modal('hide'); |
115 | 120 | }, |
116 | 121 | error: function(data) { | ... | ... |
forum/templates/forum/forum_view.html
... | ... | @@ -41,7 +41,7 @@ |
41 | 41 | </div> |
42 | 42 | <div class="panel-body"> |
43 | 43 | <ul class="nav nav-pills nav-stacked"> |
44 | - <li><a href="javascript:editForum('{% url 'course:forum:update' forum.id %}', '{{ forum.id }}')">{% trans 'Edit' %}</a></li> | |
44 | + <li><a href="javascript:editForum('{% url 'course:forum:update' forum.id %}', '{{ forum.id }}', '{% trans 'Forum edited successfully!' %}')">{% trans 'Edit' %}</a></li> | |
45 | 45 | <li><a href="javascript:delete_forum('{% url 'course:forum:delete' forum.id %}', '{{ forum.id }}', '{% trans "Are you sure you want to delete this forum?" %}', '{% url 'course:view_subject' forum.topic.subject.slug %}')">{% trans 'Delete' %}</a></li> |
46 | 46 | </ul> |
47 | 47 | </div> | ... | ... |
... | ... | @@ -0,0 +1,12 @@ |
1 | +from django import forms | |
2 | +from .models import Link | |
3 | + | |
4 | +class CreateLinkForm(forms.ModelForm): | |
5 | + class Meta: | |
6 | + model = Link | |
7 | + fields = ['name','link','description'] | |
8 | + | |
9 | +class UpdateLinkForm(forms.ModelForm): | |
10 | + class Meta: | |
11 | + model = Link | |
12 | + fields = ['name','link','description'] | ... | ... |
links/views.py
1 | 1 | from django.shortcuts import render |
2 | +from django.views import generic | |
3 | +from django.core.urlresolvers import reverse_lazy | |
4 | +from django.contrib import messages | |
5 | +from django.utils.translation import ugettext_lazy as _ | |
6 | + | |
7 | + | |
8 | +from .models import Link | |
9 | +from .forms import * | |
2 | 10 | |
3 | 11 | # Create your views here. |
12 | +class CreateLink(generic.CreateView): | |
13 | + template_name = 'links/' | |
14 | + form_class = CreateLinkForm | |
15 | + success_url = reverse_lazy() | |
16 | + def form_valid(self, form): | |
17 | + form.save() | |
18 | + messages.success(self.request, _('Link created successfully!')) | |
19 | + return super(CreateLink, self).form_valid(form) | |
20 | + | |
21 | + | |
22 | +class DeleteLink(generic.DeleteView): | |
23 | + | |
24 | +class UpdateLink(generic.UpdateView): | |
25 | + template_name = 'links/' | |
26 | + form_class = UpdateLinkForm | |
27 | + success_url = reverse_lazy() | |
28 | + def form_valid(self, form): | |
29 | + form.save() | |
30 | + messages.success(self.request, _('Link updated successfully!')) | |
31 | + | |
32 | + return super(UpdateLink, self).form_valid(form) | ... | ... |
users/admin.py
1 | 1 | from django.contrib import admin |
2 | 2 | from .models import User |
3 | -from .forms import UserForm | |
3 | +from .forms import AdminUserForm | |
4 | 4 | |
5 | 5 | class UserAdmin(admin.ModelAdmin): |
6 | 6 | list_display = ['username', 'name', 'email', 'is_staff', 'is_active'] |
7 | 7 | search_fields = ['username', 'name', 'email'] |
8 | - # form = UserForm | |
8 | + form = AdminUserForm | |
9 | 9 | |
10 | 10 | admin.site.register(User, UserAdmin) |
11 | 11 | \ No newline at end of file | ... | ... |
users/forms.py
1 | 1 | # coding=utf-8 |
2 | -import os | |
2 | +import os, re | |
3 | +from datetime import date | |
4 | +from pycpfcnpj import cpfcnpj | |
3 | 5 | from django.conf import settings |
4 | 6 | from django import forms |
5 | 7 | from django.utils.translation import ugettext_lazy as _ |
... | ... | @@ -8,20 +10,27 @@ from django.contrib.auth.forms import UserCreationForm |
8 | 10 | from core.forms import RegisterUserForm |
9 | 11 | from .models import User |
10 | 12 | |
11 | - | |
12 | -class ProfileForm(forms.ModelForm): | |
13 | - | |
13 | +class AdminUserForm(forms.ModelForm): | |
14 | 14 | def save(self, commit=True): |
15 | - super(ProfileForm, self).save(commit=False) | |
15 | + super(AdminUserForm, self).save(commit=False) | |
16 | 16 | |
17 | 17 | self.instance.set_password(self.cleaned_data['password']) |
18 | 18 | self.instance.save() |
19 | 19 | |
20 | + if self.instance.is_staff: | |
21 | + assign_role(self.instance, 'system_admin') | |
22 | + elif self.instance.type_profile == 2: | |
23 | + assign_role(self.instance, 'student') | |
24 | + elif self.instance.type_profile == 1: | |
25 | + assign_role(self.instance, 'professor') | |
26 | + | |
27 | + self.instance.save() | |
28 | + | |
20 | 29 | return self.instance |
21 | 30 | |
22 | 31 | class Meta: |
23 | 32 | model = User |
24 | - fields = ['username', 'name', 'email', 'password', 'birth_date', 'city', 'state', 'gender', 'cpf', 'phone', 'image'] | |
33 | + fields = ['username', 'name', 'email', 'password', 'birth_date', 'city', 'state', 'gender', 'type_profile', 'cpf', 'phone', 'image', 'is_staff', 'is_active'] | |
25 | 34 | widgets = { |
26 | 35 | 'password':forms.PasswordInput |
27 | 36 | } |
... | ... | @@ -32,16 +41,33 @@ class UserForm(RegisterUserForm): |
32 | 41 | model = User |
33 | 42 | fields = ['username', 'name', 'email', 'birth_date', 'city', 'state', 'gender', 'type_profile', 'cpf', 'phone', 'image', 'is_staff', 'is_active'] |
34 | 43 | |
35 | -class EditUserForm(forms.ModelForm): | |
44 | +class UpdateUserForm(forms.ModelForm): | |
45 | + | |
46 | + def validate_cpf(self, cpf): | |
47 | + cpf = ''.join(re.findall('\d', str(cpf))) | |
48 | + | |
49 | + if cpfcnpj.validate(cpf): | |
50 | + return True | |
51 | + return False | |
52 | + | |
53 | + def clean_cpf(self): | |
54 | + cpf = self.cleaned_data['cpf'] | |
55 | + if not self.validate_cpf(cpf): | |
56 | + raise forms.ValidationError(_('Please enter a valid CPF')) | |
57 | + return cpf | |
58 | + | |
59 | + def clean_birth_date(self): | |
60 | + birth_date = self.cleaned_data['birth_date'] | |
61 | + if birth_date >= date.today(): | |
62 | + raise forms.ValidationError(_('Please enter a valid date')) | |
63 | + return birth_date | |
36 | 64 | |
37 | 65 | class Meta: |
38 | 66 | model = User |
39 | - fields = ['username', 'name', 'email', 'birth_date', 'city', 'state', 'gender', 'cpf', 'phone', 'image'] | |
67 | + fields = ['username', 'name', 'email', 'city', 'state', 'birth_date', 'gender', 'type_profile', 'cpf', 'phone', 'image', 'is_staff', 'is_active'] | |
40 | 68 | |
41 | -# Ailson | |
42 | -class UpdateUserForm(forms.ModelForm): | |
43 | - company_logo = forms.ImageField(label=_('Company Logo'),required=False, error_messages = {'invalid':_("Image files only")}) | |
69 | +class UpdateProfileForm(UpdateUserForm): | |
44 | 70 | |
45 | 71 | class Meta: |
46 | 72 | model = User |
47 | - fields = ['username', 'name', 'email', 'city', 'state', 'birth_date', 'gender', 'cpf', 'phone', 'image'] | |
48 | 73 | \ No newline at end of file |
74 | + fields = ['username', 'name', 'email', 'birth_date', 'city', 'state', 'gender', 'cpf', 'phone', 'image'] | ... | ... |
users/templates/users/edit_profile.html
... | ... | @@ -31,7 +31,7 @@ |
31 | 31 | <div class="form-group{% if form.has_error %} has-error {% endif %} is-fileinput"> |
32 | 32 | <label for="{{ field.auto_id }}">{{ field.label }}</label> |
33 | 33 | {% if field.auto_id == 'id_birth_date' %} |
34 | - <input type="date" class="form-control"name="{{field.name}}" value="{% if field.value.year %}{{field.value|date:'Y-m-d'}}{% else %}{{field.value}}{% endif %}" min="{{now|date:'Y-m-d'}}" id="{{ field.auto_id }}"> | |
34 | + <input type="text" class="form-control date-picker"name="{{field.name}}" value="{% if field.value.year %}{{field.value|date:'Y-m-d'}}{% else %}{{field.value}}{% endif %}" min="{{now|date:'Y-m-d'}}" id="{{ field.auto_id }}"> | |
35 | 35 | <span id="helpBlock" class="help-block">{{ field.help_text }}</span> |
36 | 36 | {% elif field.auto_id == 'id_image' %} |
37 | 37 | {% render_field field class='form-control input-sm' %} |
... | ... | @@ -49,11 +49,16 @@ |
49 | 49 | {% render_field field type='checkbox' %} |
50 | 50 | </label> |
51 | 51 | </div> |
52 | + {% elif field.auto_id == 'id_cpf' %} | |
53 | + {% render_field field class='form-control' onkeypress='campoNumerico(this,event); formatarCpf(this,event);' %} | |
54 | + | |
55 | + {% elif field.auto_id == 'id_phone' %} | |
56 | + {% render_field field class='form-control' onkeypress='campoNumerico(this,event); formatarTelefone(this,event);' %} | |
52 | 57 | {% else %} |
53 | 58 | {% render_field field class='form-control' %} |
54 | 59 | <span id="helpBlock" class="help-block">{{ field.help_text }}</span> |
55 | 60 | {% endif %} |
56 | - {% if field.errors.length > 0 %} | |
61 | + {% if field.errors %} | |
57 | 62 | <div class="alert alert-danger alert-dismissible" role="alert"> |
58 | 63 | <button type="button" class="close" data-dismiss="alert" aria-label="Close"> |
59 | 64 | <span aria-hidden="true">×</span> |
... | ... | @@ -64,7 +69,6 @@ |
64 | 69 | {% endfor %} |
65 | 70 | </ul> |
66 | 71 | </div> |
67 | - </div> | |
68 | 72 | {% endif %} |
69 | 73 | </div> |
70 | 74 | {% endfor %} | ... | ... |
users/templates/users/profile.html
... | ... | @@ -27,6 +27,17 @@ |
27 | 27 | {% endblock %} |
28 | 28 | |
29 | 29 | {% block content %} |
30 | + {% if messages %} | |
31 | + {% for message in messages %} | |
32 | + <div class="alert alert-success alert-dismissible" role="alert"> | |
33 | + <button type="button" class="close" data-dismiss="alert" aria-label="Close"> | |
34 | + <span aria-hidden="true">×</span> | |
35 | + </button> | |
36 | + <p>{{ message }}</p> | |
37 | + </div> | |
38 | + {% endfor %} | |
39 | + {% endif %} | |
40 | + | |
30 | 41 | <div class="row"> |
31 | 42 | <div class="col-lg-offset-4 col-lg-2"> |
32 | 43 | <img src="" class="img-responsive center-block " alt="logo amadeus"> | ... | ... |
users/templates/users/update.html
... | ... | @@ -34,7 +34,7 @@ |
34 | 34 | <div class="form-group{% if form.has_error %} has-error {% endif %} is-fileinput"> |
35 | 35 | <label for="{{ field.auto_id }}">{{ field.label }}</label> |
36 | 36 | {% if field.auto_id == 'id_birth_date' %} |
37 | - <input type="date" class="form-control"name="{{field.name}}" value="{% if field.value.year %}{{field.value|date:'Y-m-d'}}{% else %}{{field.value}}{% endif %}" min="{{now|date:'Y-m-d'}}" id="{{ field.auto_id }}"> | |
37 | + <input type="text" class="form-control date-picker"name="{{field.name}}" value="{% if field.value.year %}{{field.value|date:'Y-m-d'}}{% else %}{{field.value}}{% endif %}" min="{{now|date:'Y-m-d'}}" id="{{ field.auto_id }}"> | |
38 | 38 | <span id="helpBlock" class="help-block">{{ field.help_text }}</span> |
39 | 39 | {% elif field.auto_id == 'id_image' %} |
40 | 40 | {% render_field field class='form-control input-sm' %} |
... | ... | @@ -48,6 +48,16 @@ |
48 | 48 | </div> |
49 | 49 | {% elif field.auto_id == 'id_cpf' %} |
50 | 50 | {% render_field field class='form-control' onkeypress='campoNumerico(this,event); formatarCpf(this,event);' %} |
51 | + | |
52 | + {% elif field.auto_id == 'id_phone' %} | |
53 | + {% render_field field class='form-control' onkeypress='campoNumerico(this,event); formatarTelefone(this,event);' %} | |
54 | + | |
55 | + {% elif field.auto_id == 'id_is_staff' or field.auto_id == 'id_is_active' %} | |
56 | + <div class="checkbox"> | |
57 | + <label for="{{ field.auto_id }}"> | |
58 | + {% render_field field %}<span class="checkbox-material"><span class="check"></span></span> {{field.label}} | |
59 | + </label> | |
60 | + </div> | |
51 | 61 | {% else %} |
52 | 62 | {% render_field field class='form-control' %} |
53 | 63 | <span id="helpBlock" class="help-block">{{ field.help_text }}</span> | ... | ... |
users/urls.py
... | ... | @@ -11,6 +11,6 @@ urlpatterns = [ |
11 | 11 | url(r'^profile/$', views.Profile.as_view(), name='profile'), |
12 | 12 | url(r'^profile/editar/(?P<username>[\w_-]+)/$', views.EditProfile.as_view(), name='edit_profile'), |
13 | 13 | # |
14 | - url(r'^profile/update/$', views.UpdateUser.as_view(), name='update_profile'), | |
14 | + url(r'^profile/update/$', views.UpdateProfile.as_view(), name='update_profile'), | |
15 | 15 | url(r'^profile/delete/$', views.DeleteUser.as_view(), name='delete_profile'), |
16 | 16 | ] | ... | ... |
users/views.py
... | ... | @@ -8,7 +8,7 @@ from django.core.urlresolvers import reverse_lazy |
8 | 8 | from django.utils.translation import ugettext_lazy as _ |
9 | 9 | from rolepermissions.shortcuts import assign_role |
10 | 10 | from .models import User |
11 | -from .forms import UserForm, ProfileForm, UpdateUserForm | |
11 | +from .forms import UserForm, UpdateProfileForm, UpdateUserForm | |
12 | 12 | |
13 | 13 | # ================ ADMIN ======================= |
14 | 14 | class UsersListView(HasRoleMixin, LoginRequiredMixin, generic.ListView): |
... | ... | @@ -103,13 +103,13 @@ def delete(request,username): |
103 | 103 | |
104 | 104 | |
105 | 105 | |
106 | -class UpdateUser(LoginRequiredMixin, generic.edit.UpdateView): | |
106 | +class UpdateProfile(LoginRequiredMixin, generic.edit.UpdateView): | |
107 | 107 | |
108 | 108 | allowed_roles = ['student'] |
109 | 109 | login_url = reverse_lazy("core:home") |
110 | 110 | template_name = 'users/edit_profile.html' |
111 | - form_class = UpdateUserForm | |
112 | - success_url = reverse_lazy('users:update_profile') | |
111 | + form_class = UpdateProfileForm | |
112 | + success_url = reverse_lazy('users:profile') | |
113 | 113 | |
114 | 114 | def get_object(self): |
115 | 115 | user = get_object_or_404(User, username = self.request.user.username) |
... | ... | @@ -119,7 +119,7 @@ class UpdateUser(LoginRequiredMixin, generic.edit.UpdateView): |
119 | 119 | form.save() |
120 | 120 | messages.success(self.request, _('Profile edited successfully!')) |
121 | 121 | |
122 | - return super(UpdateUser, self).form_valid(form) | |
122 | + return super(UpdateProfile, self).form_valid(form) | |
123 | 123 | |
124 | 124 | class DeleteUser(LoginRequiredMixin, generic.edit.DeleteView): |
125 | 125 | allowed_roles = ['student'] | ... | ... |