Commit ee5a5f239ba39207ff77d614d674c2063783aec3
Exists in
master
and in
5 other branches
conflit
Showing
19 changed files
with
244 additions
and
142 deletions
Show diff stats
app/templates/home_teacher_student_content.html
@@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
7 | 7 | ||
8 | <div class="row"> | 8 | <div class="row"> |
9 | <div class="col-xs-2 col-md-1"> | 9 | <div class="col-xs-2 col-md-1"> |
10 | - <img class="imgTimeLine" src="{{ notification.user.image_url }}"> | 10 | + <img class="imgTimeLine" src="{{ notification.actor.image_url }}"> |
11 | </div> | 11 | </div> |
12 | <div class="col-xs-10 col-md-11"> | 12 | <div class="col-xs-10 col-md-11"> |
13 | <h4 class="resource_inline"><b>{{ notification.actor.username }}</b></h4> | 13 | <h4 class="resource_inline"><b>{{ notification.actor.username }}</b></h4> |
core/mixins.py
@@ -56,6 +56,8 @@ class NotificationMixin(object): | @@ -56,6 +56,8 @@ class NotificationMixin(object): | ||
56 | 56 | ||
57 | if resource.exists(): | 57 | if resource.exists(): |
58 | resource = resource[0] | 58 | resource = resource[0] |
59 | + resource.url = resource_link | ||
60 | + resource.save() | ||
59 | else: | 61 | else: |
60 | resource = Resource(name = resource_name, url= resource_link) | 62 | resource = Resource(name = resource_name, url= resource_link) |
61 | resource.save() | 63 | resource.save() |
core/static/css/base/amadeus.css
core/templates/notifications.html
@@ -5,8 +5,13 @@ | @@ -5,8 +5,13 @@ | ||
5 | <li> | 5 | <li> |
6 | <a href="{% url 'core:notification_read' notification.id %}"><div class="list-group-item"> | 6 | <a href="{% url 'core:notification_read' notification.id %}"><div class="list-group-item"> |
7 | <div class="row-picture"> | 7 | <div class="row-picture"> |
8 | - <img class="circle" src="http://lorempixel.com/56/56/people/1" alt="icon"> | ||
9 | - <div class="least-content ">{{ notification.datetime }}</div> | 8 | + {% if notification.actor.image %} |
9 | + <img class="circle user-notification-img" src="{{ notification.actor.image.url }}" alt="icon"> | ||
10 | + {% else %} | ||
11 | + <img class="circle user-notification-img" src="{{ notification.actor.image_url }}" alt="icon"> | ||
12 | + {% endif %} | ||
13 | + | ||
14 | + <div class="least-content "> {{ notification.datetime|timesince }} </div> | ||
10 | </div> | 15 | </div> |
11 | <div class="row-content"> | 16 | <div class="row-content"> |
12 | <p class="list-group-item-text">{{ notification.message }}</p> | 17 | <p class="list-group-item-text">{{ notification.message }}</p> |
@@ -19,11 +24,11 @@ | @@ -19,11 +24,11 @@ | ||
19 | <a href="{% url 'core:notification_read' notification.id %}"> | 24 | <a href="{% url 'core:notification_read' notification.id %}"> |
20 | <div class="list-group-item"> | 25 | <div class="list-group-item"> |
21 | <div class="row-action-primary"> | 26 | <div class="row-action-primary"> |
22 | - <i class="material-icons">folder</i> | 27 | + <i class="material-icons"></i> |
23 | </div> | 28 | </div> |
24 | <div class="row-content"> | 29 | <div class="row-content"> |
25 | 30 | ||
26 | - <div class="least-content pull-right">{{ notification.datetime }}</div> | 31 | + <div class="least-content pull-right">{{ notification.datetime|timesince }}</div> |
27 | 32 | ||
28 | <p class="list-group-item-text">{{ notification.message }}</p> | 33 | <p class="list-group-item-text">{{ notification.message }}</p> |
29 | </div> | 34 | </div> |
courses/templates/subject/index.html
@@ -57,17 +57,17 @@ | @@ -57,17 +57,17 @@ | ||
57 | </div> | 57 | </div> |
58 | </div> | 58 | </div> |
59 | <div class="panel-body"> | 59 | <div class="panel-body"> |
60 | - <p><b>Professor:</b> {{subject.professors}}</p> | 60 | + <p><b>{% trans "Professor" %}:</b> {{subject.professors}}</p> |
61 | <p> | 61 | <p> |
62 | - <b>Description:</b> | 62 | + <b>{% trans "Description" %}:</b> |
63 | {{subject.description|linebreaks}} | 63 | {{subject.description|linebreaks}} |
64 | </p> | 64 | </p> |
65 | <div class="row"> | 65 | <div class="row"> |
66 | <div class="col-xs-6 col-md-6"> | 66 | <div class="col-xs-6 col-md-6"> |
67 | - <p><b>Begining:</b> {{subject.init_date}}</p> | 67 | + <p><b>{% trans "Beginning" %}:</b> {{subject.init_date}}</p> |
68 | </div> | 68 | </div> |
69 | <div class="col-xs-6 col-md-6"> | 69 | <div class="col-xs-6 col-md-6"> |
70 | - <p><b>End:</b> {{subject.end_date}}</p> | 70 | + <p><b>{% trans "End" %}:</b> {{subject.end_date}}</p> |
71 | </div> | 71 | </div> |
72 | </div> | 72 | </div> |
73 | </div> | 73 | </div> |
courses/views.py
@@ -197,7 +197,7 @@ class DeleteCourseView(LoginRequiredMixin, HasRoleMixin, generic.DeleteView): | @@ -197,7 +197,7 @@ class DeleteCourseView(LoginRequiredMixin, HasRoleMixin, generic.DeleteView): | ||
197 | return context | 197 | return context |
198 | 198 | ||
199 | 199 | ||
200 | -class CourseView(LoginRequiredMixin, NotificationMixin, generic.DetailView): | 200 | +class CourseView( NotificationMixin, generic.DetailView): |
201 | 201 | ||
202 | login_url = reverse_lazy("core:home") | 202 | login_url = reverse_lazy("core:home") |
203 | redirect_field_name = 'next' | 203 | redirect_field_name = 'next' |
@@ -214,7 +214,7 @@ class CourseView(LoginRequiredMixin, NotificationMixin, generic.DetailView): | @@ -214,7 +214,7 @@ class CourseView(LoginRequiredMixin, NotificationMixin, generic.DetailView): | ||
214 | subjects = course.subjects.all() | 214 | subjects = course.subjects.all() |
215 | elif has_role(self.request.user,'professor'): | 215 | elif has_role(self.request.user,'professor'): |
216 | subjects = course.subjects.filter(professors__in=[self.request.user]) | 216 | subjects = course.subjects.filter(professors__in=[self.request.user]) |
217 | - elif has_role(self.request.user, 'student'): | 217 | + elif has_role(self.request.user, 'student') or self.request.user is None: |
218 | subjects = course.subjects.filter(visible=True) | 218 | subjects = course.subjects.filter(visible=True) |
219 | context['subjects'] = subjects | 219 | context['subjects'] = subjects |
220 | 220 | ||
@@ -224,12 +224,16 @@ class CourseView(LoginRequiredMixin, NotificationMixin, generic.DetailView): | @@ -224,12 +224,16 @@ class CourseView(LoginRequiredMixin, NotificationMixin, generic.DetailView): | ||
224 | courses = self.request.user.courses_professors.all() | 224 | courses = self.request.user.courses_professors.all() |
225 | elif has_role(self.request.user, 'student'): | 225 | elif has_role(self.request.user, 'student'): |
226 | courses = self.request.user.courses_student.all() | 226 | courses = self.request.user.courses_student.all() |
227 | + else: | ||
228 | + courses = Course.objects.filter(public = True) | ||
227 | 229 | ||
228 | categorys_subjects = None | 230 | categorys_subjects = None |
229 | if has_role(self.request.user,'professor') or has_role(self.request.user,'system_admin'): | 231 | if has_role(self.request.user,'professor') or has_role(self.request.user,'system_admin'): |
230 | categorys_subjects = CategorySubject.objects.filter(subject_category__professors__name = self.request.user.name).distinct() | 232 | categorys_subjects = CategorySubject.objects.filter(subject_category__professors__name = self.request.user.name).distinct() |
231 | - else: | 233 | + elif has_role(self.request.user, 'student'): |
232 | categorys_subjects = CategorySubject.objects.filter(subject_category__students__name = self.request.user.name).distinct() | 234 | categorys_subjects = CategorySubject.objects.filter(subject_category__students__name = self.request.user.name).distinct() |
235 | + else: | ||
236 | + categorys_subjects = CategorySubject.objects.all().distinct() | ||
233 | 237 | ||
234 | subjects_category = Subject.objects.filter(category__name = self.request.GET.get('category')) | 238 | subjects_category = Subject.objects.filter(category__name = self.request.GET.get('category')) |
235 | 239 | ||
@@ -410,8 +414,7 @@ class TopicsView(LoginRequiredMixin, generic.ListView): | @@ -410,8 +414,7 @@ class TopicsView(LoginRequiredMixin, generic.ListView): | ||
410 | topic = get_object_or_404(Topic, slug = self.kwargs.get('slug')) | 414 | topic = get_object_or_404(Topic, slug = self.kwargs.get('slug')) |
411 | subject = topic.subject | 415 | subject = topic.subject |
412 | topics_q = Topic.objects.filter(subject = subject, visible=True) | 416 | topics_q = Topic.objects.filter(subject = subject, visible=True) |
413 | - #if (self.request.user in subject.professors.all() or has_role(self.request.user,'system_admin')): | ||
414 | - #context = subject.topics.all() <- Change it By Activities | 417 | + |
415 | return topics_q | 418 | return topics_q |
416 | 419 | ||
417 | def get_context_data(self, **kwargs): | 420 | def get_context_data(self, **kwargs): |
@@ -419,14 +422,13 @@ class TopicsView(LoginRequiredMixin, generic.ListView): | @@ -419,14 +422,13 @@ class TopicsView(LoginRequiredMixin, generic.ListView): | ||
419 | context = super(TopicsView, self).get_context_data(**kwargs) | 422 | context = super(TopicsView, self).get_context_data(**kwargs) |
420 | activitys = Activity.objects.filter(topic__name = topic.name) | 423 | activitys = Activity.objects.filter(topic__name = topic.name) |
421 | students_activit = User.objects.filter(activities__in = Activity.objects.all()) | 424 | students_activit = User.objects.filter(activities__in = Activity.objects.all()) |
422 | - # page_user = User.objects.get(id= self.kwargs['user_id']) | 425 | + |
423 | context['topic'] = topic | 426 | context['topic'] = topic |
424 | context['subject'] = topic.subject | 427 | context['subject'] = topic.subject |
425 | context['activitys'] = activitys | 428 | context['activitys'] = activitys |
426 | context['students_activit'] = students_activit | 429 | context['students_activit'] = students_activit |
427 | context['form'] = ActivityForm | 430 | context['form'] = ActivityForm |
428 | - # context['user_activity_id'] = Activity.objects.filter(students__id = self.kwargs['students_id']) | ||
429 | - # context['page_user'] = page_user | 431 | + |
430 | return context | 432 | return context |
431 | 433 | ||
432 | 434 | ||
@@ -493,7 +495,7 @@ class UpdateTopicView(LoginRequiredMixin, HasRoleMixin, generic.UpdateView): | @@ -493,7 +495,7 @@ class UpdateTopicView(LoginRequiredMixin, HasRoleMixin, generic.UpdateView): | ||
493 | context['subjects'] = topic.subject.course.subjects.all() | 495 | context['subjects'] = topic.subject.course.subjects.all() |
494 | return context | 496 | return context |
495 | 497 | ||
496 | -class CreateSubjectView(LoginRequiredMixin, HasRoleMixin, generic.edit.CreateView): | 498 | +class CreateSubjectView(LoginRequiredMixin, HasRoleMixin, NotificationMixin, generic.edit.CreateView): |
497 | 499 | ||
498 | allowed_roles = ['professor', 'system_admin'] | 500 | allowed_roles = ['professor', 'system_admin'] |
499 | login_url = reverse_lazy("core:home") | 501 | login_url = reverse_lazy("core:home") |
@@ -520,6 +522,10 @@ class CreateSubjectView(LoginRequiredMixin, HasRoleMixin, generic.edit.CreateVie | @@ -520,6 +522,10 @@ class CreateSubjectView(LoginRequiredMixin, HasRoleMixin, generic.edit.CreateVie | ||
520 | self.object.course = course | 522 | self.object.course = course |
521 | self.object.save() | 523 | self.object.save() |
522 | self.object.professors.add(self.request.user) | 524 | self.object.professors.add(self.request.user) |
525 | + if self.object.visible: | ||
526 | + super(CreateSubjectView, self).createNotification( " created subject " + self.object.name, resource_name=self.object.name, | ||
527 | + resource_slug = self.object.slug, actor=self.request.user, users= self.object.course.students.all(), | ||
528 | + resource_link = reverse('course:view_subject', args=[self.object.slug])) | ||
523 | 529 | ||
524 | return super(CreateSubjectView, self).form_valid(form) | 530 | return super(CreateSubjectView, self).form_valid(form) |
525 | 531 |
exam/models.py
@@ -7,6 +7,7 @@ from courses.models import Activity | @@ -7,6 +7,7 @@ from courses.models import Activity | ||
7 | 7 | ||
8 | class Exam(Activity): | 8 | class Exam(Activity): |
9 | begin_date = models.DateField(_('Begin of Course Date'), blank=True) | 9 | begin_date = models.DateField(_('Begin of Course Date'), blank=True) |
10 | + exibe = models.BooleanField(_('Exibe?'), default=False) | ||
10 | 11 | ||
11 | class Meta: | 12 | class Meta: |
12 | verbose_name = _('Exam') | 13 | verbose_name = _('Exam') |
exam/templates/exam/create.html
@@ -74,9 +74,7 @@ $("#add_question").click(function(){ | @@ -74,9 +74,7 @@ $("#add_question").click(function(){ | ||
74 | $("#0").attr("id","true_" + id++); | 74 | $("#0").attr("id","true_" + id++); |
75 | }); | 75 | }); |
76 | }); | 76 | }); |
77 | - | ||
78 | var alternativeValue = 3; | 77 | var alternativeValue = 3; |
79 | - | ||
80 | $('#newAlternative').click(function () { | 78 | $('#newAlternative').click(function () { |
81 | var element = '<div class="radio radio-primary">' + | 79 | var element = '<div class="radio radio-primary">' + |
82 | '<label>' + | 80 | '<label>' + |
@@ -85,12 +83,9 @@ $('#newAlternative').click(function () { | @@ -85,12 +83,9 @@ $('#newAlternative').click(function () { | ||
85 | '</label>' + | 83 | '</label>' + |
86 | '</div>'; | 84 | '</div>'; |
87 | $('#radios').append(element); | 85 | $('#radios').append(element); |
88 | - | ||
89 | alternativeValue++; | 86 | alternativeValue++; |
90 | }); | 87 | }); |
91 | - | ||
92 | var tfAlternativeValue = 3; | 88 | var tfAlternativeValue = 3; |
93 | - | ||
94 | $('#tfAlternative').click(function () { | 89 | $('#tfAlternative').click(function () { |
95 | var element = '<div class="radio radio-primary">' + | 90 | var element = '<div class="radio radio-primary">' + |
96 | '<label>' + | 91 | '<label>' + |
@@ -104,10 +99,8 @@ $('#tfAlternative').click(function () { | @@ -104,10 +99,8 @@ $('#tfAlternative').click(function () { | ||
104 | '</label>' + | 99 | '</label>' + |
105 | '</div>'; | 100 | '</div>'; |
106 | $('#radiosTF').append(element); | 101 | $('#radiosTF').append(element); |
107 | - | ||
108 | tfAlternativeValue++; | 102 | tfAlternativeValue++; |
109 | }); | 103 | }); |
110 | - | ||
111 | $(function() { | 104 | $(function() { |
112 | $( "#begin_date,#end_date" ).datepicker(); | 105 | $( "#begin_date,#end_date" ).datepicker(); |
113 | }); | 106 | }); |
exam/urls.py
@@ -9,8 +9,6 @@ urlpatterns = [ | @@ -9,8 +9,6 @@ urlpatterns = [ | ||
9 | url(r'^delete/(?P<slug>[\w\-_]+)/$', views.DeleteExam.as_view(), name='delete_exam'), # exam | 9 | url(r'^delete/(?P<slug>[\w\-_]+)/$', views.DeleteExam.as_view(), name='delete_exam'), # exam |
10 | url(r'^answer/$', views.AnswerExam.as_view(), name='answer_exam'), # exam | 10 | url(r'^answer/$', views.AnswerExam.as_view(), name='answer_exam'), # exam |
11 | url(r'^answer-exam/(?P<slug>[\w\-_]+)/$', views.AnswerStudentExam.as_view(), name='answer_student_exam'), # exam slug | 11 | url(r'^answer-exam/(?P<slug>[\w\-_]+)/$', views.AnswerStudentExam.as_view(), name='answer_student_exam'), # exam slug |
12 | - | ||
13 | - | ||
14 | url(r'^discursive-question/$',views.DiscursiveQuestion.as_view(), name="discursive_question"), | 12 | url(r'^discursive-question/$',views.DiscursiveQuestion.as_view(), name="discursive_question"), |
15 | url(r'^gap-filling-question/$',views.GapFillingQuestion.as_view(), name="gap_filling_question"), | 13 | url(r'^gap-filling-question/$',views.GapFillingQuestion.as_view(), name="gap_filling_question"), |
16 | url(r'^gap-filling-answer/$',views.GapFillingAnswer.as_view(), name="gap_filling_answer"), | 14 | url(r'^gap-filling-answer/$',views.GapFillingAnswer.as_view(), name="gap_filling_answer"), |
exam/views.py
@@ -117,7 +117,7 @@ class UpdateExam(LoginRequiredMixin,HasRoleMixin,generic.UpdateView): | @@ -117,7 +117,7 @@ class UpdateExam(LoginRequiredMixin,HasRoleMixin,generic.UpdateView): | ||
117 | context = super(UpdateExam, self).form_invalid(form) | 117 | context = super(UpdateExam, self).form_invalid(form) |
118 | answers = {} | 118 | answers = {} |
119 | for key in self.request.POST: | 119 | for key in self.request.POST: |
120 | - if(key != 'csrfmiddlewaretoken' and key != 'name' and key != 'begin_date' and key != 'limit_date' and key != 'all_students' and key != 'students'): | 120 | + if(key != 'csrfmiddlewaretoken' and key != 'name' and key != 'begin_date' and key != 'limit_date' and key!= 'exibe' and key != 'all_students' and key != 'students'): |
121 | answers[key] = self.request.POST[key] | 121 | answers[key] = self.request.POST[key] |
122 | 122 | ||
123 | keys = sorted(answers) | 123 | keys = sorted(answers) |
@@ -135,7 +135,7 @@ class UpdateExam(LoginRequiredMixin,HasRoleMixin,generic.UpdateView): | @@ -135,7 +135,7 @@ class UpdateExam(LoginRequiredMixin,HasRoleMixin,generic.UpdateView): | ||
135 | 135 | ||
136 | 136 | ||
137 | for key in self.request.POST: | 137 | for key in self.request.POST: |
138 | - if(key != 'csrfmiddlewaretoken' and key != 'name' and key != 'begin_date' and key != 'limit_date' and key != 'all_students' and key != 'students'): | 138 | + if(key != 'csrfmiddlewaretoken' and key != 'name' and key != 'begin_date' and key != 'limit_date' and key!= 'exibe' and key != 'all_students' and key != 'students'): |
139 | answer = Answer(answer=self.request.POST[key],order=key,exam=exam) | 139 | answer = Answer(answer=self.request.POST[key],order=key,exam=exam) |
140 | answer.save() | 140 | answer.save() |
141 | 141 |
forum/views.py
@@ -163,8 +163,10 @@ class CreatePostView(LoginRequiredMixin, generic.edit.CreateView, NotificationMi | @@ -163,8 +163,10 @@ class CreatePostView(LoginRequiredMixin, generic.edit.CreateView, NotificationMi | ||
163 | self.object.user = self.request.user | 163 | self.object.user = self.request.user |
164 | 164 | ||
165 | self.object.save() | 165 | self.object.save() |
166 | - super(CreatePostView, self).createNotification(self.object.user.username + " posted on " + self.object.forum,name, | ||
167 | - resource_slug = self.object.forum.slug, actor=self.request.user, users= self.object.forum.topic.subject.students.all()) | 166 | + |
167 | + super(CreatePostView, self).createNotification(" posted on " + self.object.forum.name, | ||
168 | + resource_slug = self.object.forum.slug, actor=self.request.user, users= self.object.forum.topic.subject.students.all(), | ||
169 | + resource_link = reverse('course:forum:view', args=[self.object.forum.slug])) | ||
168 | 170 | ||
169 | return super(CreatePostView, self).form_valid(form) | 171 | return super(CreatePostView, self).form_valid(form) |
170 | 172 | ||
@@ -266,6 +268,7 @@ class CreatePostAnswerView(LoginRequiredMixin, generic.edit.CreateView): | @@ -266,6 +268,7 @@ class CreatePostAnswerView(LoginRequiredMixin, generic.edit.CreateView): | ||
266 | 268 | ||
267 | self.object.save() | 269 | self.object.save() |
268 | 270 | ||
271 | + | ||
269 | return super(CreatePostAnswerView, self).form_valid(form) | 272 | return super(CreatePostAnswerView, self).form_valid(form) |
270 | 273 | ||
271 | def get_success_url(self): | 274 | def get_success_url(self): |
users/forms.py
@@ -45,7 +45,7 @@ class UpdateUserForm(forms.ModelForm): | @@ -45,7 +45,7 @@ class UpdateUserForm(forms.ModelForm): | ||
45 | 45 | ||
46 | def validate_cpf(self, cpf): | 46 | def validate_cpf(self, cpf): |
47 | cpf = ''.join(re.findall('\d', str(cpf))) | 47 | cpf = ''.join(re.findall('\d', str(cpf))) |
48 | - | 48 | + |
49 | if cpfcnpj.validate(cpf): | 49 | if cpfcnpj.validate(cpf): |
50 | return True | 50 | return True |
51 | return False | 51 | return False |
@@ -71,4 +71,4 @@ class UpdateProfileForm(UpdateUserForm): | @@ -71,4 +71,4 @@ class UpdateProfileForm(UpdateUserForm): | ||
71 | 71 | ||
72 | class Meta: | 72 | class Meta: |
73 | model = User | 73 | model = User |
74 | - fields = ['username', 'name', 'email', 'birth_date', 'city', 'state', 'gender', 'cpf', 'phone', 'image'] | 74 | + fields = ['username', 'name', 'email', 'birth_date', 'city', 'state', 'gender', 'cpf', 'phone', 'image', 'curriculum'] |
@@ -0,0 +1,57 @@ | @@ -0,0 +1,57 @@ | ||
1 | +{% extends 'users/profile.html' %} | ||
2 | + | ||
3 | +{% load static i18n %} | ||
4 | +{% load widget_tweaks %} | ||
5 | +{% load django_bootstrap_breadcrumbs %} | ||
6 | + | ||
7 | +{% block breadcrumbs %} | ||
8 | + | ||
9 | + {{ block.super }} | ||
10 | + {% breadcrumb 'Edit' 'users:update_profile' %} | ||
11 | + | ||
12 | +{% endblock %} | ||
13 | + | ||
14 | +{% block content %} | ||
15 | + {% if messages %} | ||
16 | + {% for message in messages %} | ||
17 | + <div class="alert alert-success alert-dismissible" role="alert"> | ||
18 | + <button type="button" class="close" data-dismiss="alert" aria-label="Close"> | ||
19 | + <span aria-hidden="true">×</span> | ||
20 | + </button> | ||
21 | + <p>{{ message }}</p> | ||
22 | + </div> | ||
23 | + {% endfor %} | ||
24 | + {% endif %} | ||
25 | + <div class="row"> | ||
26 | + <div class="col-md-12"> | ||
27 | + <div class="well well-lg"> | ||
28 | + <form method="post" action="" enctype="multipart/form-data"> | ||
29 | + {% csrf_token %} | ||
30 | + <div class="form-group"> | ||
31 | + <label class="control-label" for="focusedInput1">{% trans 'Current Password' %}</label> | ||
32 | + <input type="password" class="form-control" id="inputPassword" placeholder="Password"> | ||
33 | + </div> | ||
34 | + <div class="form-group"> | ||
35 | + <label class="control-label" for="focusedInput1">{% trans 'New Password' %}</label> | ||
36 | + <input type="password" class="form-control" id="inputPassword" placeholder="Password"> | ||
37 | + </div> | ||
38 | + <div class="form-group"> | ||
39 | + <label class="control-label" for="focusedInput1">{% trans 'Confirmation' %}</label> | ||
40 | + <input type="password" class="form-control" id="inputPassword" placeholder="Password"> | ||
41 | + </div> | ||
42 | + <div class="row"> | ||
43 | + <div class="col-md-3 col-sm-2 col-xs-2"> | ||
44 | + <input type="submit" value="{% trans 'Save' %}" class="btn btn-raised btn-block btn-success" /> | ||
45 | + </div> | ||
46 | + <div class="col-md-3 col-sm-2 col-xs-2"> | ||
47 | + <a href="{% url 'users:profile' %}" class="btn btn-raised btn-block btn-danger" >{% trans 'Cancel' %}</a> | ||
48 | + </div> | ||
49 | + </div> | ||
50 | + </form> | ||
51 | + </div> | ||
52 | + </div> | ||
53 | + </div> | ||
54 | + | ||
55 | + | ||
56 | + <br clear="all" /> | ||
57 | +{% endblock %} |
users/templates/users/edit_profile.html
@@ -46,7 +46,7 @@ | @@ -46,7 +46,7 @@ | ||
46 | {% elif field.auto_id == 'id_is_staff' or field.auto_id == 'id_is_active' %} | 46 | {% elif field.auto_id == 'id_is_staff' or field.auto_id == 'id_is_active' %} |
47 | <div class="checkbox"> | 47 | <div class="checkbox"> |
48 | <label> | 48 | <label> |
49 | - {% render_field field type='checkbox' %} | 49 | + {% render_field field type='checkbox' %} |
50 | </label> | 50 | </label> |
51 | </div> | 51 | </div> |
52 | {% elif field.auto_id == 'id_cpf' %} | 52 | {% elif field.auto_id == 'id_cpf' %} |
@@ -72,16 +72,16 @@ | @@ -72,16 +72,16 @@ | ||
72 | {% endif %} | 72 | {% endif %} |
73 | </div> | 73 | </div> |
74 | {% endfor %} | 74 | {% endfor %} |
75 | - <div class="col-md-offset-2 col-md-2 col-sm-2 col-xs-2"> | ||
76 | - <input type="submit" value="{% trans 'Save' %}" class="btn btn-sm btn-success" /> | 75 | + <div class="col-md-3 col-sm-2 col-xs-2"> |
76 | + <input type="submit" value="{% trans 'Save' %}" class="btn btn-raised btn-block btn-success" /> | ||
77 | </div> | 77 | </div> |
78 | - <div class="col-md-offset-3 col-md-2 col-sm-2 col-xs-2"> | ||
79 | - <a href="{% url 'users:manage' %}" class="btn btn-sm btn-success" >{% trans 'Cancel' %}</a> | 78 | + <div class="col-md-3 col-sm-2 col-xs-2"> |
79 | + <a href="{% url 'users:profile' %}" class="btn btn-raised btn-block btn-danger" >{% trans 'Cancel' %}</a> | ||
80 | </div> | 80 | </div> |
81 | </form> | 81 | </form> |
82 | </div> | 82 | </div> |
83 | </div> | 83 | </div> |
84 | </div> | 84 | </div> |
85 | - | 85 | + |
86 | <br clear="all" /> | 86 | <br clear="all" /> |
87 | {% endblock %} | 87 | {% endblock %} |
users/templates/users/profile.html
@@ -14,13 +14,15 @@ | @@ -14,13 +14,15 @@ | ||
14 | {% block sidebar %} | 14 | {% block sidebar %} |
15 | <div class="panel panel-primary navigation"> | 15 | <div class="panel panel-primary navigation"> |
16 | <div class="panel-heading"> | 16 | <div class="panel-heading"> |
17 | - <h5>Profile</h5> | 17 | + <h4>Menu</h4> |
18 | </div> | 18 | </div> |
19 | <div class="panel-body"> | 19 | <div class="panel-body"> |
20 | <ul class="nav nav-pills nav-stacked"> | 20 | <ul class="nav nav-pills nav-stacked"> |
21 | - <li><a href="{% url 'app:index' %}">{% trans 'Home' %}</a></li> | ||
22 | - <li><a href="{% url 'users:profile' %}">{% trans 'View Profile' %}</a></li> | ||
23 | - <li><a href="{% url 'users:update_profile' %}">{% trans 'Edit Profile' %}</a></li> | 21 | + <li><a href="{% url 'app:index' %}">{% trans 'Home page' %}</a></li> |
22 | + <li><a href="{% url 'users:profile' %}">{% trans 'View Profile' %}</a></li> | ||
23 | + <li><a href="{% url 'users:update_profile' %}">{% trans 'Edit Profile' %}</a></li> | ||
24 | + <li><a href="{% url 'users:change_password' %}">{% trans 'Change Password' %}</a></li> | ||
25 | + <li><a href="{% url 'users:remove_account' %}">{% trans 'Remove account' %}</a></li> | ||
24 | </ul> | 26 | </ul> |
25 | </div> | 27 | </div> |
26 | </div> | 28 | </div> |
@@ -37,106 +39,85 @@ | @@ -37,106 +39,85 @@ | ||
37 | </div> | 39 | </div> |
38 | {% endfor %} | 40 | {% endfor %} |
39 | {% endif %} | 41 | {% endif %} |
40 | - | ||
41 | - <div class="row"> | ||
42 | - <div class="col-lg-offset-4 col-lg-2"> | ||
43 | - <img src="" class="img-responsive center-block " alt="logo amadeus"> | ||
44 | - </div> | ||
45 | - </div> | ||
46 | <div class="row"> | 42 | <div class="row"> |
47 | <div class="col-lg-12"> | 43 | <div class="col-lg-12"> |
48 | - <div class="card"> | ||
49 | - <div class="card-content"> | ||
50 | - <div class="card-body"> | ||
51 | - <div class="row"> | ||
52 | - <div class="col-md-4"> | ||
53 | - <img src="{{ user.image_url }}" class="img-responsive center-block img-circle" alt="foto perfil" style="max-height:174px"> | ||
54 | - </div> | ||
55 | - <div class="col-md-8"> | ||
56 | - <table class="table table-hover table-edited"> | ||
57 | - <tbody> | ||
58 | - <tr> | ||
59 | - <td>Status:</td> | ||
60 | - <td>Offline</td> | ||
61 | - </tr> | ||
62 | - <tr> | ||
63 | - <td>Nome:</td> | ||
64 | - <td>{{user}}</td> | ||
65 | - </tr> | ||
66 | - <tr> | ||
67 | - <td>Login:</td> | ||
68 | - <td>{{user.username}}</td> | ||
69 | - </tr> | ||
70 | - <tr> | ||
71 | - <td>Email:</td> | ||
72 | - <td>{{user.email}}</td> | ||
73 | - </tr> | ||
74 | - </tbody> | ||
75 | - </table> | ||
76 | - </div> | ||
77 | - </div> | ||
78 | - <div class="row"> | ||
79 | - <div class="col-md-10 col-md-offset-1"> | ||
80 | - <table class="table table-hover table-edited"> | ||
81 | - <tbody> | ||
82 | - <tr> | ||
83 | - <td>Tipo de usuário:</td> | ||
84 | - <td>{{use.type_profile}}</td> | ||
85 | - </tr> | ||
86 | - <tr> | ||
87 | - <td>CPF:</td> | ||
88 | - <td>{{user.cpf}}</td> | ||
89 | - </tr> | ||
90 | - <tr> | ||
91 | - <td>Número de telefone:</td> | ||
92 | - <td>{{user.phone}}</td> | ||
93 | - </tr> | ||
94 | - <tr> | ||
95 | - <td>Sexo:</td> | ||
96 | - <td>{{user.gender}}</td> | ||
97 | - </tr> | ||
98 | - <tr> | ||
99 | - <td>Data de Nascimento:</td> | ||
100 | - <td>{{user.birth_date}}</td> | ||
101 | - </tr> | ||
102 | - <tr> | ||
103 | - <td>Estado e Cidade:</td> | ||
104 | - <td>{{user.state}} - {{user.city}}</td> | ||
105 | - </tr> | ||
106 | - <tr> | ||
107 | - <td>Titulação:</td> | ||
108 | - <td>Mestrado</td> | ||
109 | - </tr> | ||
110 | - <tr> | ||
111 | - <td>Ano:</td> | ||
112 | - <td>2012</td> | ||
113 | - </tr> | ||
114 | - <tr> | ||
115 | - <td>Instituição:</td> | ||
116 | - <td>UFPE</td> | ||
117 | - </tr> | ||
118 | - <tr> | ||
119 | - <td>Currículo:</td> | ||
120 | - <td>-</td> | ||
121 | - </tr> | ||
122 | - </tbody> | ||
123 | - </table> | ||
124 | - </div> | ||
125 | - </div> | 44 | + <div class="well well-lg"> |
45 | + <div class="row"> | ||
46 | + <div class="col-md-4"> | ||
47 | + <img src="{{ user.image_url }}" class="img-responsive center-block img-circle" alt="foto perfil" style="max-height:174px"> | ||
126 | </div> | 48 | </div> |
127 | - </div> | ||
128 | - <footer class="card-footer"> | ||
129 | - <div class="col-md-6"> | ||
130 | - <a href="{% url 'users:update_profile' %}" class="btn btn-flat">{% trans 'Edit Profile' %}</a> | 49 | + <div class="col-md-8"> |
50 | + <table class="table table-hover table-edited"> | ||
51 | + <tbody> | ||
52 | + <tr> | ||
53 | + <td>Status:</td> | ||
54 | + <td>Offline</td> | ||
55 | + </tr> | ||
56 | + <tr> | ||
57 | + <td>Nome:</td> | ||
58 | + <td>{{user}}</td> | ||
59 | + </tr> | ||
60 | + <tr> | ||
61 | + <td>Login:</td> | ||
62 | + <td>{{user.username}}</td> | ||
63 | + </tr> | ||
64 | + <tr> | ||
65 | + <td>Email:</td> | ||
66 | + <td>{{user.email}}</td> | ||
67 | + </tr> | ||
68 | + </tbody> | ||
69 | + </table> | ||
131 | </div> | 70 | </div> |
132 | - <div class="col-md-6"> | ||
133 | - <button class="btn btn-flat btn-danger pull-right">{% trans 'Delete Account' %}</button> | 71 | + </div> |
72 | + <div class="row"> | ||
73 | + <div class="col-md-10 col-md-offset-1"> | ||
74 | + <table class="table table-hover table-edited"> | ||
75 | + <tbody> | ||
76 | + <tr> | ||
77 | + <td>Tipo de usuário:</td> | ||
78 | + <td>{{use.type_profile}}</td> | ||
79 | + </tr> | ||
80 | + <tr> | ||
81 | + <td>CPF:</td> | ||
82 | + <td>{{user.cpf}}</td> | ||
83 | + </tr> | ||
84 | + <tr> | ||
85 | + <td>Número de telefone:</td> | ||
86 | + <td>{{user.phone}}</td> | ||
87 | + </tr> | ||
88 | + <tr> | ||
89 | + <td>Sexo:</td> | ||
90 | + <td>{{user.gender}}</td> | ||
91 | + </tr> | ||
92 | + <tr> | ||
93 | + <td>Data de Nascimento:</td> | ||
94 | + <td>{{user.birth_date}}</td> | ||
95 | + </tr> | ||
96 | + <tr> | ||
97 | + <td>Estado e Cidade:</td> | ||
98 | + <td>{{user.state}} - {{user.city}}</td> | ||
99 | + </tr> | ||
100 | + <tr> | ||
101 | + <td>Titulação:</td> | ||
102 | + <td>Mestrado</td> | ||
103 | + </tr> | ||
104 | + <tr> | ||
105 | + <td>Ano:</td> | ||
106 | + <td>2012</td> | ||
107 | + </tr> | ||
108 | + <tr> | ||
109 | + <td>Instituição:</td> | ||
110 | + <td>UFPE</td> | ||
111 | + </tr> | ||
112 | + <tr> | ||
113 | + <td>Currículo:</td> | ||
114 | + <td>-</td> | ||
115 | + </tr> | ||
116 | + </tbody> | ||
117 | + </table> | ||
134 | </div> | 118 | </div> |
135 | - </footer> | ||
136 | - | 119 | + </div> |
137 | </div> | 120 | </div> |
138 | - | ||
139 | - | ||
140 | </div> | 121 | </div> |
141 | </div> | 122 | </div> |
142 | {% endblock %} | 123 | {% endblock %} |
@@ -0,0 +1,44 @@ | @@ -0,0 +1,44 @@ | ||
1 | +{% extends 'users/profile.html' %} | ||
2 | + | ||
3 | +{% load static i18n %} | ||
4 | +{% load widget_tweaks %} | ||
5 | +{% load django_bootstrap_breadcrumbs %} | ||
6 | + | ||
7 | +{% block breadcrumbs %} | ||
8 | + | ||
9 | + {{ block.super }} | ||
10 | + {% breadcrumb 'Edit' 'users:update_profile' %} | ||
11 | + | ||
12 | +{% endblock %} | ||
13 | + | ||
14 | +{% block content %} | ||
15 | + {% if messages %} | ||
16 | + {% for message in messages %} | ||
17 | + <div class="alert alert-success alert-dismissible" role="alert"> | ||
18 | + <button type="button" class="close" data-dismiss="alert" aria-label="Close"> | ||
19 | + <span aria-hidden="true">×</span> | ||
20 | + </button> | ||
21 | + <p>{{ message }}</p> | ||
22 | + </div> | ||
23 | + {% endfor %} | ||
24 | + {% endif %} | ||
25 | + <div class="row"> | ||
26 | + <div class="col-md-12"> | ||
27 | + <div class="well well-lg"> | ||
28 | + <h2>Voce tem certeza que deseja remover esta conta?</h2> | ||
29 | + <p>Todos os seus dados serão removidos e não haverá como recupera-los posteriormente.</p> | ||
30 | + <div class="row"> | ||
31 | + <div class="col-md-3 col-sm-2 col-xs-2"> | ||
32 | + <a href="#" class="btn btn-raised btn-block btn-success" >{% trans 'Remove' %}</a> | ||
33 | + </div> | ||
34 | + <div class="col-md-3 col-sm-2 col-xs-2"> | ||
35 | + <a href="{% url 'users:profile' %}" class="btn btn-raised btn-block btn-danger" >{% trans 'Cancel' %}</a> | ||
36 | + </div> | ||
37 | + </div> | ||
38 | + </div> | ||
39 | + </div> | ||
40 | + </div> | ||
41 | + | ||
42 | + | ||
43 | + <br clear="all" /> | ||
44 | +{% endblock %} |
users/templates/users/update.html
@@ -24,7 +24,7 @@ | @@ -24,7 +24,7 @@ | ||
24 | </div> | 24 | </div> |
25 | {% endfor %} | 25 | {% endfor %} |
26 | {% endif %} | 26 | {% endif %} |
27 | - | 27 | + |
28 | <div class="card"> | 28 | <div class="card"> |
29 | <div class="card-content"> | 29 | <div class="card-content"> |
30 | <div class="card-body"> | 30 | <div class="card-body"> |
@@ -51,7 +51,7 @@ | @@ -51,7 +51,7 @@ | ||
51 | 51 | ||
52 | {% elif field.auto_id == 'id_phone' %} | 52 | {% elif field.auto_id == 'id_phone' %} |
53 | {% render_field field class='form-control' onkeypress='campoNumerico(this,event); formatarTelefone(this,event);' %} | 53 | {% render_field field class='form-control' onkeypress='campoNumerico(this,event); formatarTelefone(this,event);' %} |
54 | - | 54 | + |
55 | {% elif field.auto_id == 'id_is_staff' or field.auto_id == 'id_is_active' %} | 55 | {% elif field.auto_id == 'id_is_staff' or field.auto_id == 'id_is_active' %} |
56 | <div class="checkbox"> | 56 | <div class="checkbox"> |
57 | <label for="{{ field.auto_id }}"> | 57 | <label for="{{ field.auto_id }}"> |
@@ -77,10 +77,10 @@ | @@ -77,10 +77,10 @@ | ||
77 | </div> | 77 | </div> |
78 | {% endfor %} | 78 | {% endfor %} |
79 | <div class="col-md-offset-2 col-md-2 col-sm-2 col-xs-2"> | 79 | <div class="col-md-offset-2 col-md-2 col-sm-2 col-xs-2"> |
80 | - <input type="submit" value="{% trans 'Save' %}" class="btn btn-sm btn-success" /> | 80 | + <input type="submit" value="{% trans 'Save' %}" class="btn btn-raised btn-success" /> |
81 | </div> | 81 | </div> |
82 | <div class="col-md-offset-3 col-md-2 col-sm-2 col-xs-2"> | 82 | <div class="col-md-offset-3 col-md-2 col-sm-2 col-xs-2"> |
83 | - <a href="{% url 'users:manage' %}" class="btn btn-sm btn-success" >{% trans 'Cancel' %}</a> | 83 | + <a href="{% url 'users:manage' %}" class="btn btn-raised btn-danger" >{% trans 'Cancel' %}</a> |
84 | </div> | 84 | </div> |
85 | </form> | 85 | </form> |
86 | </div> | 86 | </div> |
users/urls.py
@@ -11,5 +11,7 @@ urlpatterns = [ | @@ -11,5 +11,7 @@ urlpatterns = [ | ||
11 | url(r'^profile/$', views.Profile.as_view(), name='profile'), | 11 | url(r'^profile/$', views.Profile.as_view(), name='profile'), |
12 | # | 12 | # |
13 | url(r'^profile/update/$', views.UpdateProfile.as_view(), name='update_profile'), | 13 | url(r'^profile/update/$', views.UpdateProfile.as_view(), name='update_profile'), |
14 | - url(r'^profile/delete/$', views.DeleteUser.as_view(), name='delete_profile'), | 14 | + url(r'^profile/change_password/$', views.Change_password.as_view(), name='change_password'), |
15 | + url(r'^profile/remove_account/$', views.Remove_account.as_view(), name='remove_account'), | ||
16 | + url(r'^profile/delete/$', views.DeleteUser.as_view(), name='delete_profile'), | ||
15 | ] | 17 | ] |
users/views.py
@@ -102,6 +102,12 @@ def delete(request,username): | @@ -102,6 +102,12 @@ def delete(request,username): | ||
102 | return redirect('users:manage') | 102 | return redirect('users:manage') |
103 | 103 | ||
104 | 104 | ||
105 | +class Change_password(generic.TemplateView): | ||
106 | + template_name = 'users/change_password.html' | ||
107 | + | ||
108 | +class Remove_account(generic.TemplateView): | ||
109 | + template_name = 'users/remove_account.html' | ||
110 | + | ||
105 | 111 | ||
106 | class UpdateProfile(LoginRequiredMixin, generic.edit.UpdateView): | 112 | class UpdateProfile(LoginRequiredMixin, generic.edit.UpdateView): |
107 | 113 |