Commit eb7ac9eb7b60fd1b9ec3fd8cbdb41820e6673cd9

Authored by Jailson Dias
2 parents 7db0fa5b 8d39cac8

resolve conflit

@@ -16,7 +16,7 @@ class RegisterUserForm(forms.ModelForm): @@ -16,7 +16,7 @@ class RegisterUserForm(forms.ModelForm):
16 16
17 def validate_cpf(self, cpf): 17 def validate_cpf(self, cpf):
18 cpf = ''.join(re.findall('\d', str(cpf))) 18 cpf = ''.join(re.findall('\d', str(cpf)))
19 - 19 +
20 if cpfcnpj.validate(cpf): 20 if cpfcnpj.validate(cpf):
21 return True 21 return True
22 return False 22 return False
@@ -38,8 +38,8 @@ class RegisterUserForm(forms.ModelForm): @@ -38,8 +38,8 @@ class RegisterUserForm(forms.ModelForm):
38 cpf = self.cleaned_data['cpf'] 38 cpf = self.cleaned_data['cpf']
39 if User.objects.filter(cpf = cpf).exists(): 39 if User.objects.filter(cpf = cpf).exists():
40 raise forms.ValidationError(_('There is already a registeres User with this CPF')) 40 raise forms.ValidationError(_('There is already a registeres User with this CPF'))
41 - if not self.validate_cpf(cpf):  
42 - raise forms.ValidationError(_('Please enter a valid CPF')) 41 + # if not self.validate_cpf(cpf):
  42 + # raise forms.ValidationError(_('Please enter a valid CPF'))
43 return cpf 43 return cpf
44 44
45 def clean_password(self): 45 def clean_password(self):
@@ -68,12 +68,12 @@ class RegisterUserForm(forms.ModelForm): @@ -68,12 +68,12 @@ class RegisterUserForm(forms.ModelForm):
68 def save(self, commit=True): 68 def save(self, commit=True):
69 super(RegisterUserForm, self).save(commit=False) 69 super(RegisterUserForm, self).save(commit=False)
70 self.instance.set_password(self.cleaned_data['password']) 70 self.instance.set_password(self.cleaned_data['password'])
71 - 71 +
72 self.instance.save() 72 self.instance.save()
73 return self.instance 73 return self.instance
74 74
75 class Meta: 75 class Meta:
76 model = User 76 model = User
77 # exclude = ['is_staff', 'is_active'] 77 # exclude = ['is_staff', 'is_active']
78 - fields = ['username', 'name', 'email', 'city', 'state', 'gender', 'cpf', 'birth_date', 'phone', 'image', 'titration', 78 + fields = ['username', 'name', 'email', 'city', 'state', 'gender', 'cpf', 'birth_date', 'phone', 'image', 'titration',
79 'year_titration', 'institution', 'curriculum',] 79 'year_titration', 'institution', 'curriculum',]
80 \ No newline at end of file 80 \ No newline at end of file
core/static/css/base/amadeus.css
@@ -427,7 +427,7 @@ ul, li { @@ -427,7 +427,7 @@ ul, li {
427 .course-card-group{ 427 .course-card-group{
428 margin-bottom: 1%; 428 margin-bottom: 1%;
429 } 429 }
430 - 430 +.data_register_course p{ color: grey; }
431 .category-course-link{ 431 .category-course-link{
432 font-size: 24px; 432 font-size: 24px;
433 color: black !important; 433 color: black !important;
core/static/js/topic_editation_presentation.js 0 → 100644
@@ -0,0 +1,79 @@ @@ -0,0 +1,79 @@
  1 +
  2 +var x = 0;
  3 +$(".edit_card").on('click', function() {
  4 + $(".presentation").css('display','none');
  5 + $(".editation").css('display','block');
  6 +})
  7 +$(".edit_card_end").on('click', function() {
  8 + $(".editation").css('display','none');
  9 + $(".presentation").css('display','block');
  10 +})
  11 +
  12 +$("#bot").on('click', function(){
  13 + x = x+1;
  14 + console.log(2)
  15 + if(x%2 == 0){
  16 + console.log(0)
  17 + $("#down").attr('class', 'fa fa-caret-square-o-down');
  18 +}
  19 +else{
  20 + console.log(1)
  21 + $("#down").attr('class', 'fa fa-caret-square-o-up');
  22 +}
  23 +
  24 +})
  25 +$("#bot1").on('click', function(){
  26 + x = x+1;
  27 + console.log(2)
  28 + if(x%2 == 0){
  29 + console.log(0)
  30 + $("#down1").attr('class', 'fa fa-caret-square-o-down');
  31 +}
  32 +else{
  33 + console.log(1)
  34 + $("#down1").attr('class', 'fa fa-caret-square-o-up');
  35 +}
  36 +
  37 +})
  38 +
  39 +$("#bot2").on('click', function(){
  40 + x = x+1;
  41 + console.log(2)
  42 + if(x%2 == 0){
  43 + console.log(0)
  44 + $("#down2").attr('class', 'fa fa-caret-square-o-down');
  45 +}
  46 +else{
  47 + console.log(1)
  48 + $("#down2").attr('class', 'fa fa-caret-square-o-up');
  49 +}
  50 +
  51 +})
  52 +
  53 +$("#bot3").on('click', function(){
  54 + x = x+1;
  55 + console.log(2)
  56 + if(x%2 == 0){
  57 + console.log(0)
  58 + $("#down3").attr('class', 'fa fa-caret-square-o-down');
  59 +}
  60 +else{
  61 + console.log(1)
  62 + $("#down3").attr('class', 'fa fa-caret-square-o-up');
  63 +}
  64 +
  65 +})
  66 +$("#bot4").on('click', function(){
  67 + x = x+1;
  68 + console.log(2)
  69 + if(x%2 == 0){
  70 + console.log(0)
  71 + $("#down4").attr('class', 'fa fa-caret-square-o-down');
  72 +}
  73 +else{
  74 + console.log(1)
  75 + $("#down4").attr('class', 'fa fa-caret-square-o-up');
  76 +}
  77 +
  78 +})
  79 +
core/templates/base.html
@@ -74,7 +74,7 @@ @@ -74,7 +74,7 @@
74 <input type="text" class="form-control" placeholder="{% trans 'Search Files (.pdf, others) and/or activities' %}" name="search"></div> 74 <input type="text" class="form-control" placeholder="{% trans 'Search Files (.pdf, others) and/or activities' %}" name="search"></div>
75 <span class="input-group-btn input-group-sm"> 75 <span class="input-group-btn input-group-sm">
76 <button type="submit" class="btn btn-fab btn-fab-mini"> 76 <button type="submit" class="btn btn-fab btn-fab-mini">
77 - <i class="glyphicon glyphicon-search" aria-hidden="true" style="color:#93C741"></i> 77 + <i class="fa fa-search" aria-hidden="true" style="color:#93C741"></i>
78 </button> 78 </button>
79 </span> 79 </span>
80 </div> 80 </div>
courses/forms.py
@@ -51,34 +51,37 @@ class CourseForm(forms.ModelForm): @@ -51,34 +51,37 @@ class CourseForm(forms.ModelForm):
51 class Meta: 51 class Meta:
52 model = Course 52 model = Course
53 fields = ('name', 'objectivies', 'content', 'max_students', 'init_register_date', 'end_register_date', 53 fields = ('name', 'objectivies', 'content', 'max_students', 'init_register_date', 'end_register_date',
54 - 'init_date', 'end_date', 'category',) 54 + 'init_date', 'end_date', 'category', 'coordenator')
55 labels = { 55 labels = {
56 - 'name': _('Name'),  
57 - 'objectivies': _('Objectives'),  
58 - 'content': _('Content'),  
59 - 'max_students': _('Number of studets maximum'),  
60 - 'init_register_date': _('Course registration start date'),  
61 - 'end_register_date': _('Course registration end date'),  
62 - 'init_date': _('Course start date'),  
63 - 'end_date': _('Course end date'),  
64 - 'category': _('CourseCategory'), 56 + 'name': _('Name'),
  57 + 'objectivies': _('Objectives'),
  58 + 'content': _('Content'),
  59 + 'max_students': _('Number of studets maximum'),
  60 + 'init_register_date': _('Course registration start date'),
  61 + 'end_register_date': _('Course registration end date'),
  62 + 'init_date': _('Course start date'),
  63 + 'end_date': _('Course end date'),
  64 + 'category': _('CourseCategory'),
  65 + 'coordenator': _('Coordenator'),
65 } 66 }
66 help_texts = { 67 help_texts = {
67 - 'name': _('Course name'),  
68 - 'objectivies': _('Course objective'),  
69 - 'content': _('Course modules'),  
70 - 'max_students': _('Max number of students that a class can have'),  
71 - 'init_register_date': _('Date that starts the registration period of the course (dd/mm/yyyy)'),  
72 - 'end_register_date': _('Date that ends the registration period of the course (dd/mm/yyyy)'),  
73 - 'init_date': _('Date that the course starts (dd/mm/yyyy)'),  
74 - 'end_date': _('Date that the course ends (dd/mm/yyyy)'),  
75 - 'category': _('CourseCategory which the course belongs'), 68 + 'name': _('Course name'),
  69 + 'objectivies': _('Course objective'),
  70 + 'content': _('Course modules'),
  71 + 'max_students': _('Max number of students that a class can have'),
  72 + 'init_register_date': _('Date that starts the registration period of the course (dd/mm/yyyy)'),
  73 + 'end_register_date': _('Date that ends the registration period of the course (dd/mm/yyyy)'),
  74 + 'init_date': _('Date that the course starts (dd/mm/yyyy)'),
  75 + 'end_date': _('Date that the course ends (dd/mm/yyyy)'),
  76 + 'category': _('CourseCategory which the course belongs'),
  77 + 'coordenator': _('Course Coordenator'),
76 } 78 }
77 79
78 widgets = { 80 widgets = {
79 - 'categoy': forms.Select(),  
80 - 'objectivies': SummernoteWidget(attrs={'cols': 80, 'rows': 5}),  
81 - 'content': SummernoteWidget(attrs={'cols': 80, 'rows': 5}), 81 + 'categoy': forms.Select(),
  82 + 'coordenator': forms.Select(),
  83 + 'objectivies': SummernoteWidget(attrs={'cols': 80, 'rows': 5}),
  84 + 'content': SummernoteWidget(attrs={'cols': 80, 'rows': 5}),
82 } 85 }
83 86
84 class UpdateCourseForm(CourseForm): 87 class UpdateCourseForm(CourseForm):
@@ -89,35 +92,38 @@ class UpdateCourseForm(CourseForm): @@ -89,35 +92,38 @@ class UpdateCourseForm(CourseForm):
89 class Meta: 92 class Meta:
90 model = Course 93 model = Course
91 fields = ('name', 'objectivies', 'content', 'max_students', 'init_register_date', 'end_register_date', 94 fields = ('name', 'objectivies', 'content', 'max_students', 'init_register_date', 'end_register_date',
92 - 'init_date', 'end_date', 'category','students',) 95 + 'init_date', 'end_date', 'category','students', 'coordenator')
93 labels = { 96 labels = {
94 - 'name': _('Name'),  
95 - 'objectivies': _('Objectives'),  
96 - 'content': _('Content'),  
97 - 'max_students': _('Number of studets maximum'),  
98 - 'init_register_date': _('Course registration start date'),  
99 - 'end_register_date': _('Course registration end date'),  
100 - 'init_date': _('Course start date'),  
101 - 'end_date': _('Course end date'),  
102 - 'category': _('CourseCategory'),  
103 - 'students': _('Student'), 97 + 'name': _('Name'),
  98 + 'objectivies': _('Objectives'),
  99 + 'content': _('Content'),
  100 + 'max_students': _('Number of studets maximum'),
  101 + 'init_register_date': _('Course registration start date'),
  102 + 'end_register_date': _('Course registration end date'),
  103 + 'init_date': _('Course start date'),
  104 + 'end_date': _('Course end date'),
  105 + 'category': _('CourseCategory'),
  106 + 'coordenator': _('Coordenator'),
  107 + 'students': _('Student'),
104 } 108 }
105 help_texts = { 109 help_texts = {
106 - 'name': _('Course name'),  
107 - 'objectivies': _('Course objective'),  
108 - 'content': _('Course modules'),  
109 - 'max_students': _('Max number of students that a class can have'),  
110 - 'init_register_date': _('Date that starts the registration period of the course (dd/mm/yyyy)'),  
111 - 'end_register_date': _('Date that ends the registration period of the course (dd/mm/yyyy)'),  
112 - 'init_date': _('Date that the course starts (dd/mm/yyyy)'),  
113 - 'end_date': _('Date that the course ends (dd/mm/yyyy)'),  
114 - 'category': _('CourseCategory which the course belongs'),  
115 - 'students': _("Course's Students"), 110 + 'name': _('Course name'),
  111 + 'objectivies': _('Course objective'),
  112 + 'content': _('Course modules'),
  113 + 'max_students': _('Max number of students that a class can have'),
  114 + 'init_register_date': _('Date that starts the registration period of the course (dd/mm/yyyy)'),
  115 + 'end_register_date': _('Date that ends the registration period of the course (dd/mm/yyyy)'),
  116 + 'init_date': _('Date that the course starts (dd/mm/yyyy)'),
  117 + 'end_date': _('Date that the course ends (dd/mm/yyyy)'),
  118 + 'category': _('CourseCategory which the course belongs'),
  119 + 'coordenator': _('Course Coordenator'),
  120 + 'students': _("Course's Students"),
116 } 121 }
117 widgets = { 122 widgets = {
118 - 'categoy': forms.Select(),  
119 - 'objectivies': SummernoteWidget(attrs={'cols': 80, 'rows': 5}),  
120 - 'content': SummernoteWidget(attrs={'cols': 80, 'rows': 5}), 123 + 'categoy': forms.Select(),
  124 + 'coordenator': forms.Select(),
  125 + 'objectivies': SummernoteWidget(attrs={'cols': 80, 'rows': 5}),
  126 + 'content': SummernoteWidget(attrs={'cols': 80, 'rows': 5}),
121 } 127 }
122 128
123 class SubjectForm(forms.ModelForm): 129 class SubjectForm(forms.ModelForm):
courses/migrations/0004_course_coordenator.py 0 → 100644
@@ -0,0 +1,23 @@ @@ -0,0 +1,23 @@
  1 +# -*- coding: utf-8 -*-
  2 +# Generated by Django 1.10 on 2016-11-08 15:00
  3 +from __future__ import unicode_literals
  4 +
  5 +from django.conf import settings
  6 +from django.db import migrations, models
  7 +import django.db.models.deletion
  8 +
  9 +
  10 +class Migration(migrations.Migration):
  11 +
  12 + dependencies = [
  13 + migrations.swappable_dependency(settings.AUTH_USER_MODEL),
  14 + ('courses', '0003_remove_course_image'),
  15 + ]
  16 +
  17 + operations = [
  18 + migrations.AddField(
  19 + model_name='course',
  20 + name='coordenator',
  21 + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='course_coordenator', to=settings.AUTH_USER_MODEL, verbose_name='Coordenator'),
  22 + ),
  23 + ]
courses/models.py
@@ -47,6 +47,7 @@ class Course(models.Model): @@ -47,6 +47,7 @@ class Course(models.Model):
47 init_date = models.DateField(_('Begin of Course Date')) 47 init_date = models.DateField(_('Begin of Course Date'))
48 end_date = models.DateField(_('End of Course Date')) 48 end_date = models.DateField(_('End of Course Date'))
49 category = models.ForeignKey(CourseCategory, verbose_name = _('Category'), related_name='course_category') 49 category = models.ForeignKey(CourseCategory, verbose_name = _('Category'), related_name='course_category')
  50 + coordenator = models.ForeignKey(User, verbose_name = _('Coordenator'), related_name ='course_coordenator', null = True)
50 professors = models.ManyToManyField(User,verbose_name=_('Professors'), related_name='courses_professors') 51 professors = models.ManyToManyField(User,verbose_name=_('Professors'), related_name='courses_professors')
51 students = models.ManyToManyField(User,verbose_name=_('Students'), related_name='courses_student', blank = True) 52 students = models.ManyToManyField(User,verbose_name=_('Students'), related_name='courses_student', blank = True)
52 public = models.BooleanField(_('Public'), default=False) 53 public = models.BooleanField(_('Public'), default=False)
courses/templates/course/course_card.html
@@ -34,6 +34,7 @@ @@ -34,6 +34,7 @@
34 <div class="panel-collapse collapseOne-{{course.slug}} collapse in" role="tabpanel" aria-labelledby="headingOne" aria-expanded="true" aria-hidden="false" tabindex="0"> 34 <div class="panel-collapse collapseOne-{{course.slug}} collapse in" role="tabpanel" aria-labelledby="headingOne" aria-expanded="true" aria-hidden="false" tabindex="0">
35 <div class="panel-body"> 35 <div class="panel-body">
36 <p><b>{% trans 'Course Name' %}: </b>{{course.name}}</p> 36 <p><b>{% trans 'Course Name' %}: </b>{{course.name}}</p>
  37 + <p><b>{% trans 'Coordenator' %}: </b>{{course.coordenator}}</p>
37 <p><b>{% trans 'Professor' %}: </b>{{course.professors.all.0}}</p> 38 <p><b>{% trans 'Professor' %}: </b>{{course.professors.all.0}}</p>
38 <p> 39 <p>
39 <b>{% trans 'Description' %}:</b> 40 <b>{% trans 'Description' %}:</b>
@@ -41,6 +42,14 @@ @@ -41,6 +42,14 @@
41 {{course.content | safe }} 42 {{course.content | safe }}
42 </i> 43 </i>
43 </p> 44 </p>
  45 + <div class="row">
  46 + <div class="col-xs-6 col-md-6 data_register_course">
  47 + <p><b>{% trans 'Init register' %}: </b>{{course.init_register_date}}</p>
  48 + </div>
  49 + <div class="col-xs-6 col-md-6 data_register_course">
  50 + <p><b>{% trans 'End register' %}: </b>{{course.end_register_date}}</p>
  51 + </div>
  52 + </div>
44 </div> 53 </div>
45 </div> 54 </div>
46 </div> 55 </div>
courses/templates/course/view.html
@@ -94,15 +94,22 @@ @@ -94,15 +94,22 @@
94 </div> 94 </div>
95 </div> 95 </div>
96 <div class="panel-body"> 96 <div class="panel-body">
97 - <p><b>{% trans 'Coordinator' %}: </b>{% for professor in course.professors.all %}{% if not forloop.first %},{% endif %}  
98 - {{professor}}{% if forloop.last %}.{% endif %}{% endfor %}</p> 97 + <p><b>{% trans 'Coordinator' %}: </b>{{course.coordenator}}</p>
  98 + <p><b>{% trans 'Teacher' %}: </b>{{course.professors.all.0}}</p>
99 <p> 99 <p>
100 <b>{% trans 'Description' %}:</b> 100 <b>{% trans 'Description' %}:</b>
101 <i> 101 <i>
102 {{ course.objectivies |safe }} 102 {{ course.objectivies |safe }}
103 </i> 103 </i>
104 </p> 104 </p>
105 - 105 + <div class="row">
  106 + <div class="col-xs-6 col-md-6 data_register_course">
  107 + <p><b>{% trans 'Begin of Course Date' %}: </b>{{course.init_date}}</p>
  108 + </div>
  109 + <div class="col-xs-6 col-md-6 data_register_course">
  110 + <p><b>{% trans 'End of Course Date' %}: </b>{{course.end_date}}</p>
  111 + </div>
  112 + </div>
106 </div> 113 </div>
107 </div> 114 </div>
108 115
courses/templates/topic/link_topic_list_edit.html
1 {% load static i18n list_topic_foruns permission_tags %} 1 {% load static i18n list_topic_foruns permission_tags %}
2 <div id="list-topic{{ topic.id }}-links-edit"> 2 <div id="list-topic{{ topic.id }}-links-edit">
3 -{% for link in links%}  
4 -  
5 - <li class="icon_edit_remove" id = "link_edit_icon_{{ link.slug }}"> <a href="javascript:modal.get('{% url 'course:links:update_link' link.slug %}', '#linksModalEdit', '#requisicoes_ajax')"><i class="fa fa-pencil fa-lg" aria-hidden="true"></i></a> <a href="javascript:modal.get('{% url 'course:links:delete_link' link.slug %}', '#linkDeleteModal', '#requisicoes_ajax')"><i class="fa fa-trash fa-lg" aria-hidden="true"></i></a></li>  
6 - <li id = "link_{{ link.slug }}"><i class="fa fa-link" aria-hidden="true"></i> <a href="javascript:modal.get('{% url 'course:links:view_link' link.slug %}', '#viewLinkModal','#requisicoes_ajax')">{{link.name}}</a></li>  
7 -  
8 -{% endfor %} 3 + {% for link in links%}
  4 + <li class="icon_edit_remove" id = "link_edit_icon_{{ link.slug }}"> <a href="javascript:modal.get('{% url 'course:links:update_link' link.slug %}', '#linksModalEdit', '#requisicoes_ajax')"><i class="fa fa-pencil fa-lg" aria-hidden="true"></i></a> <a href="javascript:modal.get('{% url 'course:links:delete_link' link.slug %}', '#linkDeleteModal', '#requisicoes_ajax')"><i class="fa fa-trash fa-lg" aria-hidden="true"></i></a></li>
  5 + <li id = "link_{{ link.slug }}"><i class="fa fa-link" aria-hidden="true"></i> <a href="javascript:modal.get('{% url 'course:links:view_link' link.slug %}', '#viewLinkModal','#requisicoes_ajax')">{{link.name}}</a></li>
  6 + {% endfor %}
9 </div> 7 </div>
10 -  
11 -{# <div class="row" id="divModalLinkUpdate">#}  
12 -  
13 -{# </div>#}  
users/templates/list_users.html
@@ -62,7 +62,7 @@ @@ -62,7 +62,7 @@
62 {% if acc.gender == 'M' %} 62 {% if acc.gender == 'M' %}
63 <img src="{% static 'img/male_avatar.png' %}" alt="Avatar" class="img-circle img-responsive img-list-user"> 63 <img src="{% static 'img/male_avatar.png' %}" alt="Avatar" class="img-circle img-responsive img-list-user">
64 {% else %} 64 {% else %}
65 - <img src="{% static 'img/female_avatar.png' %}" alt="Avatar" class="img-circle img-responsive img-list-user"> 65 + <img src="{% static 'img/female_avatar.png' %}" alt="Avatar" class="img-circle img-responsive img-list-user">
66 {% endif %} 66 {% endif %}
67 {% endif %} 67 {% endif %}
68 </div> 68 </div>
@@ -76,7 +76,7 @@ @@ -76,7 +76,7 @@
76 <a href="javascript:void(0)" class="btn btn-danger btn-raised btn-lg" data-toggle="modal" data-target="#DeleteModal{{ forloop.counter }}">{% trans 'Delete' %}</a> 76 <a href="javascript:void(0)" class="btn btn-danger btn-raised btn-lg" data-toggle="modal" data-target="#DeleteModal{{ forloop.counter }}">{% trans 'Delete' %}</a>
77 </div> 77 </div>
78 </div> 78 </div>
79 - 79 +
80 80
81 <!-- Modal --> 81 <!-- Modal -->
82 <div class="modal fade" id="DeleteModal{{ forloop.counter }}" tabindex="-1" role="dialog" aria-labelledby="DeleteModalLabel"> 82 <div class="modal fade" id="DeleteModal{{ forloop.counter }}" tabindex="-1" role="dialog" aria-labelledby="DeleteModalLabel">
@@ -87,10 +87,10 @@ @@ -87,10 +87,10 @@
87 <h4 class="modal-title" id="DeleteModalLabel">{% trans 'Confirm delete' %}</h4> 87 <h4 class="modal-title" id="DeleteModalLabel">{% trans 'Confirm delete' %}</h4>
88 </div> 88 </div>
89 <div class="modal-body"> 89 <div class="modal-body">
90 - {% trans 'Are you sure you want to delete the user' %} <b>{{acc.name}}</b>? 90 + {% trans 'Are you sure you want to delete the user' %} <b>{{acc.name}}</b>?
91 </div> 91 </div>
92 <div class="modal-footer"> 92 <div class="modal-footer">
93 - <a href="#" class="btn btn-raised btn-danger" data-dismiss="modal">{% trans 'Cancel' %}</a> 93 + <a href="#" class="btn btn-raised btn-danger" data-dismiss="modal">{% trans 'Cancel' %}</a>
94 <a href="{% url 'users:delete' acc.username %}" class="btn btn-raised btn-success" style="margin-top: 0">{% trans 'Delete' %}</a> 94 <a href="{% url 'users:delete' acc.username %}" class="btn btn-raised btn-success" style="margin-top: 0">{% trans 'Delete' %}</a>
95 </div> 95 </div>
96 </div> 96 </div>
users/templates/users/profile.html
@@ -43,7 +43,7 @@ @@ -43,7 +43,7 @@
43 <div class="col-lg-12"> 43 <div class="col-lg-12">
44 <div class="well well-lg"> 44 <div class="well well-lg">
45 <div class="row"> 45 <div class="row">
46 - 46 +
47 {% if user.image %} 47 {% if user.image %}
48 <div class="col-md-4" style="width: 200px;overflow:hidden;margin-left: 8em;height: 150px;background-image: url('{{user.image.url}}');background-position: center;background-size: cover;"> 48 <div class="col-md-4" style="width: 200px;overflow:hidden;margin-left: 8em;height: 150px;background-image: url('{{user.image.url}}');background-position: center;background-size: cover;">
49 {% else %} 49 {% else %}
@@ -51,7 +51,7 @@ @@ -51,7 +51,7 @@
51 {% if user.gender == 'M' %} 51 {% if user.gender == 'M' %}
52 <img src="{% static 'img/male_avatar.png' %}" alt="Avatar" class="img-circle img-responsive img-list-user" style="margin-left: 8em;"> 52 <img src="{% static 'img/male_avatar.png' %}" alt="Avatar" class="img-circle img-responsive img-list-user" style="margin-left: 8em;">
53 {% else %} 53 {% else %}
54 - <img src="{% static 'img/female_avatar.png' %}" alt="Avatar" class="img-circle img-responsive img-list-user" style="margin-left: 8em;"> 54 + <img src="{% static 'img/female_avatar.png' %}" alt="Avatar" class="img-circle img-responsive img-list-user" style="margin-left: 8em;">
55 {% endif %} 55 {% endif %}
56 {% endif %} 56 {% endif %}
57 </div> 57 </div>
@@ -65,7 +65,7 @@ @@ -65,7 +65,7 @@
65 {% else %} 65 {% else %}
66 <td> {% trans "OffLine" %}</td> 66 <td> {% trans "OffLine" %}</td>
67 {% endif %} 67 {% endif %}
68 - 68 +
69 </tr> 69 </tr>
70 <tr> 70 <tr>
71 <td>{% trans "Name" %}:</td> 71 <td>{% trans "Name" %}:</td>
@@ -94,7 +94,7 @@ @@ -94,7 +94,7 @@
94 {% else %} 94 {% else %}
95 <td>{% trans "Student" %}</td> 95 <td>{% trans "Student" %}</td>
96 {% endif %} 96 {% endif %}
97 - 97 +
98 </tr> 98 </tr>
99 <tr> 99 <tr>
100 <td>{% trans "CPF" %}:</td> 100 <td>{% trans "CPF" %}:</td>
@@ -104,7 +104,7 @@ @@ -104,7 +104,7 @@
104 {% else %} 104 {% else %}
105 <td>{% trans "doesn't possess CPF" %}</td> 105 <td>{% trans "doesn't possess CPF" %}</td>
106 {% endif %} 106 {% endif %}
107 - 107 +
108 </tr> 108 </tr>
109 <tr> 109 <tr>
110 <td>{% trans "Phone Number" %}:</td> 110 <td>{% trans "Phone Number" %}:</td>
@@ -113,7 +113,7 @@ @@ -113,7 +113,7 @@
113 {% else %} 113 {% else %}
114 <td>{% trans "doesn't possess Phone" %}</td> 114 <td>{% trans "doesn't possess Phone" %}</td>
115 {% endif %} 115 {% endif %}
116 - 116 +
117 </tr> 117 </tr>
118 <tr> 118 <tr>
119 <td>{% trans "Gender" %}:</td> 119 <td>{% trans "Gender" %}:</td>
users/templates/users/remove_account.html
@@ -29,7 +29,7 @@ @@ -29,7 +29,7 @@
29 <p>{% trans 'All data will be lost and havent how recover it.' %}</p> 29 <p>{% trans 'All data will be lost and havent how recover it.' %}</p>
30 <div class="row"> 30 <div class="row">
31 <div class="col-md-3 col-sm-2 col-xs-2"> 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> 32 + <a href="{% url 'users:remove' user.username %}" class="btn btn-raised btn-block btn-success" >{% trans 'Remove' %}</a>
33 </div> 33 </div>
34 <div class="col-md-3 col-sm-2 col-xs-2"> 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> 35 <a href="{% url 'users:profile' %}" class="btn btn-raised btn-block btn-danger" >{% trans 'Cancel' %}</a>
users/templates/users/search.html
1 -<html>  
2 -<h1> Links </h1>  
3 -{% for link in link_list %}  
4 - {{link.name}} </br>  
5 -{% endfor %}  
6 -  
7 -<h1> Polls </h1>  
8 -{% for poll in poll_list %}  
9 - {{poll.name}} </br>  
10 -{% endfor %}  
11 -  
12 -<h1> Exams </h1>  
13 -{% for exam in exam_list %}  
14 - {{exam.name}} </br>  
15 -{% endfor %}  
16 -  
17 -<h1> Forums </h1>  
18 -{% for forum in forum_list %}  
19 - {{forum.name}} </br>  
20 -{% endfor %}  
21 -  
22 -<h1> Files </h1>  
23 -{% for file in file_list %}  
24 - {{file.name}} </br>  
25 -{% endfor %}  
26 -</html> 1 +{% extends 'home.html' %}
  2 +
  3 +{% load i18n pagination django_bootstrap_breadcrumbs permission_tags static %}
  4 +{% block javascript %}
  5 + <script type="text/javascript" src="{% static 'js/forum.js' %}"></script>
  6 + <script src="{% static 'js/file.js' %}"></script>
  7 + <script type="text/javascript" src="{% static 'js/material.js' %}"></script>
  8 + <script type = "text/javascript" src="{% static 'js/topic_editation_presentation.js' %}"></script>
  9 + <script type = "text/javascript" src="{% static 'js/links.js' %}"></script>
  10 + <script src="{% static 'js/modals_requisitions.js'%}"></script>
  11 + <script src="{% static 'js/modal_poll.js'%}"></script>
  12 +{% endblock %}
  13 +
  14 +{% block breadcrumbs %}
  15 + {{ block.super }}
  16 + {% breadcrumb 'Search' 'users:search' %}
  17 +
  18 +{% endblock %}
  19 +
  20 +
  21 +{% block content %}
  22 +<div class="jumbotron">
  23 +<h3>Search Result:</h3> {{qtd}} items found
  24 +<div class="panel-group">
  25 + <div class="panel panel-default">
  26 + <div class="panel-heading">
  27 + <h4 class="panel-title">
  28 + <a data-toggle="collapse" href="#Link" id="bot"> <i class="fa fa-caret-square-o-down" aria-hidden="true" id="down"></i>Links</a>
  29 + </h4>
  30 + </div>
  31 + <div id="Link" class="panel-collapse collapse">
  32 + <div class="panel-body">
  33 +
  34 + {% if link_list %}
  35 + {% for link in link_list %}
  36 + <li id = "link_{{ link.slug }}"><i class="fa fa-link" aria-hidden="true"></i> <a href="javascript:modal.get('{% url 'course:links:view_link' link.slug %}', '#viewLinkModal','#divModalLink')">{{link.name}}</a></li>
  37 + {% endfor %}
  38 + <div class = 'row' id ="divModalLink">
  39 +
  40 + </div>
  41 + {% else %}
  42 + {% trans 'No results found'%}
  43 + {% endif%}
  44 + </div>
  45 +
  46 + </div>
  47 + </div>
  48 +</div>
  49 +<div class="panel-group">
  50 + <div class="panel panel-default">
  51 + <div class="panel-heading">
  52 + <h4 class="panel-title">
  53 + <a data-toggle="collapse" href="#File" id="bot1"> <i class="fa fa-caret-square-o-down" aria-hidden="true" id="down1"></i>File</a>
  54 + </h4>
  55 + </div>
  56 + <div id="File" class="panel-collapse collapse">
  57 + <div class="panel-body">
  58 + {% if file_list %}
  59 + {% for file in file_list %}
  60 + <li id="file_{{ file.slug }}"><i class="material-icons">{{ file.file_type.icon }}</i> <a href="{% url 'course:file_material_view' file.slug %}" target="_blank">{{ file.name }}</a></li>
  61 + {% endfor%}
  62 + {% else %}
  63 + {% trans 'No results found' %}
  64 + {% endif %}
  65 +
  66 + <div class="row" id="divModalFile">
  67 +
  68 + </div>
  69 + </div>
  70 +
  71 +
  72 + </div>
  73 + </div>
  74 +</div>
  75 +
  76 +<div class="panel-group">
  77 + <div class="panel panel-default">
  78 + <div class="panel-heading">
  79 + <h4 class="panel-title">
  80 + <a data-toggle="collapse" href="#Forum" id="bot2"> <i class="fa fa-caret-square-o-down" aria-hidden="true" id="down2"></i>Forum</a>
  81 + </h4>
  82 + </div>
  83 + <div id="Forum" class="panel-collapse collapse">
  84 + <div class="panel-body">
  85 + {% if forum_list %}
  86 + {% for forum in forum_list %}
  87 + <li><i class="fa fa-commenting" aria-hidden="true"></i> <a id="forum_{{ forum.id }}" href="{% url 'course:forum:view' forum.slug %}"> {{ forum }}</a></li>
  88 + {% endfor %}
  89 + {% else %}
  90 +
  91 + {% trans 'No results found' %}
  92 +
  93 + {% endif %}
  94 + </div>
  95 +
  96 + </div>
  97 + </div>
  98 +</div>
  99 +<div class="panel-group">
  100 + <div class="panel panel-default">
  101 + <div class="panel-heading">
  102 + <h4 class="panel-title">
  103 + <a data-toggle="collapse" href="#Exam" id="bot3"> <i class="fa fa-caret-square-o-down" aria-hidden="true" id="down3"></i>Exam</a>
  104 + </h4>
  105 + </div>
  106 + <div id="Exam" class="panel-collapse collapse">
  107 + <div class="panel-body">
  108 + {% if exam_list %}
  109 +
  110 + {% else %}
  111 + {% trans 'No results found' %}
  112 + {% endif %}
  113 + </div>
  114 +
  115 + </div>
  116 + </div>
  117 +</div>
  118 +<div class="panel-group">
  119 + <div class="panel panel-default">
  120 + <div class="panel-heading">
  121 + <h4 class="panel-title">
  122 + <a data-toggle="collapse" href="#Poll" id="bot4"> <i class="fa fa-caret-square-o-down" aria-hidden="true" id="down4"></i>Poll</a>
  123 + </h4>
  124 + </div>
  125 + <div id="Poll" class="panel-collapse collapse">
  126 + <div class="panel-body">
  127 + {% if poll_list %}
  128 + {% for poll in poll_list %}
  129 + <li id="poll_{{poll.slug}}"><i class="material-icons">{% trans 'poll' %}</i> <a href="javascript:modal.get('{% url 'course:poll:view_poll' poll.slug %}','#poll','#modal_poll');">{{ poll.name }}</a></li>
  130 + {% endfor %}
  131 + {% else %}
  132 + {% trans 'No results found' %}
  133 + {% endif %}
  134 + <div class="row" id="modal_poll">
  135 +
  136 + </div>
  137 + </div>
  138 + </div>
  139 + </div>
  140 +</div>
  141 +</div>
  142 +
  143 +<script type="text/javascript" src="{% static 'js/topic_editation_presentation.js' %}"></script>
  144 +<script type="text/javascript" src="{% static 'js/amadeus.js' %}"> </script>
  145 +<script>
  146 + // set up all (import templates, set up navbar and set environment variables)
  147 + Amadeus.load(function() {
  148 + // set data to breadcrumb
  149 + Amadeus.setBreadcrumb(null,'Home');
  150 + });
  151 +</script>
  152 +
  153 +{% endblock %}
@@ -7,7 +7,8 @@ urlpatterns = [ @@ -7,7 +7,8 @@ urlpatterns = [
7 url(r'^create/$', views.Create.as_view(), name='create'), 7 url(r'^create/$', views.Create.as_view(), name='create'),
8 url(r'^edit/(?P<username>[\w_-]+)/$', views.Update.as_view(), name='update'), 8 url(r'^edit/(?P<username>[\w_-]+)/$', views.Update.as_view(), name='update'),
9 url(r'^view/(?P<username>[\w_-]+)/$', views.View.as_view(), name='view'), 9 url(r'^view/(?P<username>[\w_-]+)/$', views.View.as_view(), name='view'),
10 - url(r'^delete/(?P<username>[\w_-]+)/$', views.delete, name='delete'), 10 + url(r'^delete/(?P<username>[\w_-]+)/$', views.delete_user, name='delete'),
  11 + url(r'^remove/(?P<username>[\w_-]+)/$', views.remove_account, name='remove'),
11 url(r'^profile/$', views.Profile.as_view(), name='profile'), 12 url(r'^profile/$', views.Profile.as_view(), name='profile'),
12 url(r'^search/$', views.SearchView.as_view(), name='search'), 13 url(r'^search/$', views.SearchView.as_view(), name='search'),
13 # 14 #
@@ -15,5 +16,5 @@ urlpatterns = [ @@ -15,5 +16,5 @@ urlpatterns = [
15 url(r'^profile/change_password/$', views.Change_password.as_view(), name='change_password'), 16 url(r'^profile/change_password/$', views.Change_password.as_view(), name='change_password'),
16 url(r'^profile/remove_account/$', views.Remove_account.as_view(), name='remove_account'), 17 url(r'^profile/remove_account/$', views.Remove_account.as_view(), name='remove_account'),
17 url(r'^profile/delete/$', views.DeleteUser.as_view(), name='delete_profile'), 18 url(r'^profile/delete/$', views.DeleteUser.as_view(), name='delete_profile'),
18 - 19 +
19 ] 20 ]
users/views.py
@@ -106,12 +106,17 @@ class View(LoginRequiredMixin, generic.DetailView): @@ -106,12 +106,17 @@ class View(LoginRequiredMixin, generic.DetailView):
106 slug_field = 'username' 106 slug_field = 'username'
107 slug_url_kwarg = 'username' 107 slug_url_kwarg = 'username'
108 108
109 -def delete(request,username): 109 +def delete_user(request,username):
110 user = get_object_or_404(User,username = username) 110 user = get_object_or_404(User,username = username)
111 user.delete() 111 user.delete()
112 messages.success(request,_("User deleted Successfully!")) 112 messages.success(request,_("User deleted Successfully!"))
113 return redirect('users:manage') 113 return redirect('users:manage')
114 114
  115 +def remove_account(request,username):
  116 + user = get_object_or_404(User,username = username)
  117 + user.delete()
  118 + messages.success(request,_("User deleted Successfully!"))
  119 + return redirect('core:logout')
115 120
116 class Change_password(generic.TemplateView): 121 class Change_password(generic.TemplateView):
117 template_name = 'users/change_password.html' 122 template_name = 'users/change_password.html'