Commit a58f106aef9f2727351a1f6f50055ba7abf33c57
Exists in
master
and in
5 other branches
Merge branch 'master' of https://github.com/amadeusproject/amadeuslms
Showing
15 changed files
with
204 additions
and
200 deletions
Show diff stats
app/templates/home.html
@@ -5,23 +5,23 @@ | @@ -5,23 +5,23 @@ | ||
5 | {% block javascript %} | 5 | {% block javascript %} |
6 | <script type="text/javascript"> | 6 | <script type="text/javascript"> |
7 | var pageNum = {{ page_obj.number }}; // The latest page loaded | 7 | var pageNum = {{ page_obj.number }}; // The latest page loaded |
8 | - var hasNextPage = {{ paginator.num_pages }}; // Indicates whether to expect another page after this one | 8 | + var numberPages = {{ paginator.num_pages }}; // Indicates the number of pages |
9 | var baseUrl = '{% url "app:index" %}'; | 9 | var baseUrl = '{% url "app:index" %}'; |
10 | 10 | ||
11 | // loadOnScroll handler | 11 | // loadOnScroll handler |
12 | var loadOnScroll = function() { | 12 | var loadOnScroll = function() { |
13 | // If the current scroll position is past out cutoff point... | 13 | // If the current scroll position is past out cutoff point... |
14 | - if ($(window).scrollTop() > $(document).height() - ($(window).height()*3)) { | 14 | + if ($(window).scrollTop() >= $(document).height() - $(window).height() - 10) { |
15 | // temporarily unhook the scroll event watcher so we don't call a bunch of times in a row | 15 | // temporarily unhook the scroll event watcher so we don't call a bunch of times in a row |
16 | $(window).unbind(); | 16 | $(window).unbind(); |
17 | - // execute the load function below that will visit the JSON feed and stuff data into the HTML | 17 | + // execute the load function below that will visit the view and return the content |
18 | loadItems(); | 18 | loadItems(); |
19 | } | 19 | } |
20 | }; | 20 | }; |
21 | 21 | ||
22 | var loadItems = function() { | 22 | var loadItems = function() { |
23 | - // If the next page doesn't exist, just quit now | ||
24 | - if (pageNum == hasNextPage) { | 23 | + // Check if page is equal to the number of pages |
24 | + if (pageNum == numberPages) { | ||
25 | return false | 25 | return false |
26 | } | 26 | } |
27 | // Update the page number | 27 | // Update the page number |
@@ -103,12 +103,19 @@ | @@ -103,12 +103,19 @@ | ||
103 | {% block content %} | 103 | {% block content %} |
104 | {% if user|has_role:'system_admin' %} | 104 | {% if user|has_role:'system_admin' %} |
105 | <h3>{% trans 'Courses' %}</h3> | 105 | <h3>{% trans 'Courses' %}</h3> |
106 | - {% endif %} | ||
107 | 106 | ||
108 | - <div id="timeline"> | ||
109 | - {% include page_template %} | ||
110 | - </div> | ||
111 | - <div id="loading" class="alert alert-primary" role="alert"> | 107 | + <div id="timeline"> |
108 | + {% include page_template %} | ||
109 | + </div> | ||
110 | + {% else %} | ||
111 | + <ul class="timeline" style="-webkit-padding-start: 0px"> | ||
112 | + <div id="timeline"> | ||
113 | + {% include page_template %} | ||
114 | + </div> | ||
115 | + </ul> | ||
116 | + {% endif %} | ||
117 | + | ||
118 | + <div id="loading" class="alert alert-primary" role="alert" style="display: none"> | ||
112 | <center> | 119 | <center> |
113 | <span class="fa fa-spin fa-circle-o-notch"></span> | 120 | <span class="fa fa-spin fa-circle-o-notch"></span> |
114 | </center> | 121 | </center> |
app/templates/home_admin_content.html
@@ -0,0 +1,19 @@ | @@ -0,0 +1,19 @@ | ||
1 | +{% load i18n %} | ||
2 | + | ||
3 | +{% for notification in objects %} | ||
4 | + <li {% if not notification.read %}class="not_read"{% endif %}> | ||
5 | + <div class="avatar"> | ||
6 | + <img src="{{ notification.user.image.url }}"> | ||
7 | + </div> | ||
8 | + <div class="bubble-container"> | ||
9 | + <div class="bubble"> | ||
10 | + <div class="retweet" style="color: white"> | ||
11 | + {{ notification.datetime }} | ||
12 | + </div> | ||
13 | + <h3>{{ notification.user }}</h3> - <h3>{{ notification.action_resource }}</h3><br/> | ||
14 | + <a href="{% url 'core:notification_read' notification.id %}">{{ notification }}</a> | ||
15 | + </div> | ||
16 | + <div class="arrow"></div> | ||
17 | + </div> | ||
18 | + </li> | ||
19 | +{% endfor %} | ||
0 | \ No newline at end of file | 20 | \ No newline at end of file |
app/views.py
@@ -15,8 +15,8 @@ class AppIndex(LoginRequiredMixin, LogMixin, ListView, NotificationMixin): | @@ -15,8 +15,8 @@ class AppIndex(LoginRequiredMixin, LogMixin, ListView, NotificationMixin): | ||
15 | redirect_field_name = 'next' | 15 | redirect_field_name = 'next' |
16 | 16 | ||
17 | template_name = "home.html" | 17 | template_name = "home.html" |
18 | - context_object_name = 'courses' | ||
19 | - paginate_by = 3 | 18 | + context_object_name = 'objects' |
19 | + paginate_by = 10 | ||
20 | 20 | ||
21 | not_action = "Acessar" | 21 | not_action = "Acessar" |
22 | not_resource = "home" | 22 | not_resource = "home" |
@@ -25,18 +25,24 @@ class AppIndex(LoginRequiredMixin, LogMixin, ListView, NotificationMixin): | @@ -25,18 +25,24 @@ class AppIndex(LoginRequiredMixin, LogMixin, ListView, NotificationMixin): | ||
25 | if self.request.user.is_staff: | 25 | if self.request.user.is_staff: |
26 | objects = Course.objects.all() | 26 | objects = Course.objects.all() |
27 | else: | 27 | else: |
28 | - objects = Notification.objects.filter(user = self.request.user) | 28 | + objects = Notification.objects.filter(user = self.request.user).order_by('-datetime') |
29 | 29 | ||
30 | return objects | 30 | return objects |
31 | 31 | ||
32 | def render_to_response(self, context, **response_kwargs): | 32 | def render_to_response(self, context, **response_kwargs): |
33 | if self.request.user.is_staff: | 33 | if self.request.user.is_staff: |
34 | context['page_template'] = "home_admin_content.html" | 34 | context['page_template'] = "home_admin_content.html" |
35 | + else: | ||
36 | + context['page_template'] = "home_teacher_student_content.html" | ||
35 | 37 | ||
36 | context['title'] = 'Amadeus' | 38 | context['title'] = 'Amadeus' |
37 | 39 | ||
38 | if self.request.is_ajax(): | 40 | if self.request.is_ajax(): |
39 | - self.template_name = "home_admin_content.html" | 41 | + if self.request.user.is_staff: |
42 | + self.template_name = "home_admin_content.html" | ||
43 | + else: | ||
44 | + self.template_name = "home_teacher_student_content.html" | ||
45 | + | ||
40 | 46 | ||
41 | super(AppIndex, self).createNotification("teste", not_resource="home", resource_link="/register") | 47 | super(AppIndex, self).createNotification("teste", not_resource="home", resource_link="/register") |
42 | return self.response_class(request = self.request, template = self.template_name, context = context, using = self.template_engine, **response_kwargs) | 48 | return self.response_class(request = self.request, template = self.template_name, context = context, using = self.template_engine, **response_kwargs) |
core/static/css/base/amadeus.css
@@ -115,7 +115,7 @@ ul { | @@ -115,7 +115,7 @@ ul { | ||
115 | margin-bottom: 2em; } | 115 | margin-bottom: 2em; } |
116 | .timeline li { | 116 | .timeline li { |
117 | padding: 1em 0; } | 117 | padding: 1em 0; } |
118 | - .timeline li:nth-child(even) { | 118 | + .timeline li.not_read { |
119 | background-color: #d3d7d8; } | 119 | background-color: #d3d7d8; } |
120 | 120 | ||
121 | .avatar { | 121 | .avatar { |
@@ -0,0 +1,42 @@ | @@ -0,0 +1,42 @@ | ||
1 | +# -*- coding: utf-8 -*- | ||
2 | +# Generated by Django 1.10 on 2016-09-15 00:19 | ||
3 | +from __future__ import unicode_literals | ||
4 | + | ||
5 | +import autoslug.fields | ||
6 | +from django.conf import settings | ||
7 | +from django.db import migrations, models | ||
8 | + | ||
9 | + | ||
10 | +class Migration(migrations.Migration): | ||
11 | + | ||
12 | + dependencies = [ | ||
13 | + migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
14 | + ('courses', '0009_auto_20160908_1625'), | ||
15 | + ] | ||
16 | + | ||
17 | + operations = [ | ||
18 | + migrations.RemoveField( | ||
19 | + model_name='course', | ||
20 | + name='user', | ||
21 | + ), | ||
22 | + migrations.AddField( | ||
23 | + model_name='course', | ||
24 | + name='professors', | ||
25 | + field=models.ManyToManyField(related_name='courses', to=settings.AUTH_USER_MODEL, verbose_name='Professors'), | ||
26 | + ), | ||
27 | + migrations.AlterField( | ||
28 | + model_name='category', | ||
29 | + name='slug', | ||
30 | + field=autoslug.fields.AutoSlugField(editable=False, populate_from='name', unique=True, verbose_name='Slug'), | ||
31 | + ), | ||
32 | + migrations.AlterField( | ||
33 | + model_name='course', | ||
34 | + name='name', | ||
35 | + field=models.CharField(max_length=100, verbose_name='Name'), | ||
36 | + ), | ||
37 | + migrations.AlterField( | ||
38 | + model_name='course', | ||
39 | + name='slug', | ||
40 | + field=autoslug.fields.AutoSlugField(editable=False, populate_from='name', unique=True, verbose_name='Slug'), | ||
41 | + ), | ||
42 | + ] |
@@ -0,0 +1,49 @@ | @@ -0,0 +1,49 @@ | ||
1 | +# -*- coding: utf-8 -*- | ||
2 | +# Generated by Django 1.10 on 2016-09-15 00:26 | ||
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 | + ('courses', '0010_auto_20160914_2119'), | ||
14 | + ] | ||
15 | + | ||
16 | + operations = [ | ||
17 | + migrations.AlterModelOptions( | ||
18 | + name='course', | ||
19 | + options={'ordering': ('create_date', 'name'), 'verbose_name': 'Course', 'verbose_name_plural': 'Courses'}, | ||
20 | + ), | ||
21 | + migrations.AlterModelOptions( | ||
22 | + name='subject', | ||
23 | + options={'ordering': ('create_date', 'name'), 'verbose_name': 'Subject', 'verbose_name_plural': 'Subjects'}, | ||
24 | + ), | ||
25 | + migrations.AlterModelOptions( | ||
26 | + name='topic', | ||
27 | + options={'ordering': ('create_date', 'name'), 'verbose_name': 'Topic', 'verbose_name_plural': 'Topics'}, | ||
28 | + ), | ||
29 | + migrations.AlterField( | ||
30 | + model_name='course', | ||
31 | + name='category', | ||
32 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='courses.Category', verbose_name='Category'), | ||
33 | + ), | ||
34 | + migrations.AlterField( | ||
35 | + model_name='course', | ||
36 | + name='image', | ||
37 | + field=models.ImageField(blank=True, upload_to='courses/', verbose_name='Image'), | ||
38 | + ), | ||
39 | + migrations.AlterField( | ||
40 | + model_name='subject', | ||
41 | + name='visible', | ||
42 | + field=models.BooleanField(default=False, verbose_name='Visible'), | ||
43 | + ), | ||
44 | + migrations.AlterField( | ||
45 | + model_name='topic', | ||
46 | + name='owner', | ||
47 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='topics', to=settings.AUTH_USER_MODEL, verbose_name='Owner'), | ||
48 | + ), | ||
49 | + ] |
courses/models.py
@@ -6,7 +6,7 @@ from users.models import User | @@ -6,7 +6,7 @@ from users.models import User | ||
6 | class Category(models.Model): | 6 | class Category(models.Model): |
7 | 7 | ||
8 | name = models.CharField(_('Name'), max_length = 100, unique = True) | 8 | name = models.CharField(_('Name'), max_length = 100, unique = True) |
9 | - slug = models.SlugField(_('Slug'), max_length = 100) | 9 | + slug = AutoSlugField(_("Slug"),populate_from='name',unique=True) |
10 | create_date = models.DateField(_('Creation Date'), auto_now_add = True) | 10 | create_date = models.DateField(_('Creation Date'), auto_now_add = True) |
11 | 11 | ||
12 | class Meta: | 12 | class Meta: |
@@ -18,8 +18,8 @@ class Category(models.Model): | @@ -18,8 +18,8 @@ class Category(models.Model): | ||
18 | 18 | ||
19 | class Course(models.Model): | 19 | class Course(models.Model): |
20 | 20 | ||
21 | - name = models.CharField(_('Name'), max_length = 100, unique = True) | ||
22 | - slug = models.SlugField(_('Slug'), max_length = 100) | 21 | + name = models.CharField(_('Name'), max_length = 100) |
22 | + slug = AutoSlugField(_("Slug"),populate_from='name',unique=True) | ||
23 | objectivies = models.TextField(_('Objectivies'), blank = True) | 23 | objectivies = models.TextField(_('Objectivies'), blank = True) |
24 | content = models.TextField(_('Content'), blank = True) | 24 | content = models.TextField(_('Content'), blank = True) |
25 | max_students = models.PositiveIntegerField(_('Maximum Students'), blank = True) | 25 | max_students = models.PositiveIntegerField(_('Maximum Students'), blank = True) |
@@ -28,12 +28,12 @@ class Course(models.Model): | @@ -28,12 +28,12 @@ class Course(models.Model): | ||
28 | end_register_date = models.DateField(_('Register Date (End)')) | 28 | end_register_date = models.DateField(_('Register Date (End)')) |
29 | init_date = models.DateField(_('Begin of Course Date')) | 29 | init_date = models.DateField(_('Begin of Course Date')) |
30 | end_date = models.DateField(_('End of Course Date')) | 30 | end_date = models.DateField(_('End of Course Date')) |
31 | - image = models.ImageField(verbose_name = _('Image'), blank = True, upload_to = 'courses/', default = 'no_image.jpg') | ||
32 | - category = models.ForeignKey(Category, verbose_name = _('Category'), default = 1) | ||
33 | - user = models.ForeignKey(User, verbose_name = _('User'), null = True) | 31 | + image = models.ImageField(verbose_name = _('Image'), blank = True, upload_to = 'courses/') |
32 | + category = models.ForeignKey(Category, verbose_name = _('Category')) | ||
33 | + professors = models.ManyToManyField(User,verbose_name=_('Professors'), related_name='courses') | ||
34 | 34 | ||
35 | class Meta: | 35 | class Meta: |
36 | - | 36 | + ordering = ('create_date','name') |
37 | verbose_name = _('Course') | 37 | verbose_name = _('Course') |
38 | verbose_name_plural = _('Courses') | 38 | verbose_name_plural = _('Courses') |
39 | 39 | ||
@@ -45,7 +45,7 @@ class Subject(models.Model): | @@ -45,7 +45,7 @@ class Subject(models.Model): | ||
45 | name = models.CharField(_('Name'), max_length = 100) | 45 | name = models.CharField(_('Name'), max_length = 100) |
46 | slug = AutoSlugField(_("Slug"),populate_from='name',unique=True) | 46 | slug = AutoSlugField(_("Slug"),populate_from='name',unique=True) |
47 | description = models.TextField(_('Description'), blank = True) | 47 | description = models.TextField(_('Description'), blank = True) |
48 | - visible = models.BooleanField(_('Visible'), default = True, blank = True) | 48 | + visible = models.BooleanField(_('Visible'), default = False) |
49 | create_date = models.DateTimeField(_('Creation Date'), auto_now_add = True) | 49 | create_date = models.DateTimeField(_('Creation Date'), auto_now_add = True) |
50 | update_date = models.DateTimeField(_('Date of last update'), auto_now=True) | 50 | update_date = models.DateTimeField(_('Date of last update'), auto_now=True) |
51 | course = models.ForeignKey(Course, verbose_name = _('Course'), related_name="subjects") | 51 | course = models.ForeignKey(Course, verbose_name = _('Course'), related_name="subjects") |
@@ -53,7 +53,7 @@ class Subject(models.Model): | @@ -53,7 +53,7 @@ class Subject(models.Model): | ||
53 | 53 | ||
54 | 54 | ||
55 | class Meta: | 55 | class Meta: |
56 | - ordering = ('create_date',) | 56 | + ordering = ('create_date','name') |
57 | verbose_name = _('Subject') | 57 | verbose_name = _('Subject') |
58 | verbose_name_plural = _('Subjects') | 58 | verbose_name_plural = _('Subjects') |
59 | 59 | ||
@@ -68,10 +68,10 @@ class Topic(models.Model): | @@ -68,10 +68,10 @@ class Topic(models.Model): | ||
68 | create_date = models.DateTimeField(_('Creation Date'), auto_now_add = True) | 68 | create_date = models.DateTimeField(_('Creation Date'), auto_now_add = True) |
69 | update_date = models.DateTimeField(_('Date of last update'), auto_now=True) | 69 | update_date = models.DateTimeField(_('Date of last update'), auto_now=True) |
70 | subject = models.ForeignKey(Subject, verbose_name = _('Subject'), related_name="topics") | 70 | subject = models.ForeignKey(Subject, verbose_name = _('Subject'), related_name="topics") |
71 | - owner = models.ForeignKey(User, verbose_name = _('Owner'), related_name="topics",default=1) | 71 | + owner = models.ForeignKey(User, verbose_name = _('Owner'), related_name="topics") |
72 | 72 | ||
73 | class Meta: | 73 | class Meta: |
74 | - ordering = ('create_date',) | 74 | + ordering = ('create_date','name') |
75 | verbose_name = _('Topic') | 75 | verbose_name = _('Topic') |
76 | verbose_name_plural = _('Topics') | 76 | verbose_name_plural = _('Topics') |
77 | 77 |
@@ -0,0 +1,32 @@ | @@ -0,0 +1,32 @@ | ||
1 | +from rolepermissions.permissions import register_object_checker | ||
2 | +from amadeus.roles import SystemAdmin | ||
3 | + | ||
4 | +@register_object_checker() | ||
5 | +def edit_topic(role, user, topic): | ||
6 | + if (role == SystemAdmin): | ||
7 | + return True | ||
8 | + | ||
9 | + if (user == topic.owner): | ||
10 | + return True | ||
11 | + | ||
12 | + return False | ||
13 | + | ||
14 | +@register_object_checker() | ||
15 | +def edit_subject(role, user, subject): | ||
16 | + if (role == SystemAdmin): | ||
17 | + return True | ||
18 | + | ||
19 | + if (user in subject.professors.all()): | ||
20 | + return True | ||
21 | + | ||
22 | + return False | ||
23 | + | ||
24 | +@register_object_checker() | ||
25 | +def delete_subject(role, user, subject): | ||
26 | + if (role == SystemAdmin): | ||
27 | + return True | ||
28 | + | ||
29 | + if (user in subject.professors.all()): | ||
30 | + return True | ||
31 | + | ||
32 | + return False |
courses/views.py
@@ -10,6 +10,7 @@ from django.utils.translation import ugettext_lazy as _ | @@ -10,6 +10,7 @@ from django.utils.translation import ugettext_lazy as _ | ||
10 | from slugify import slugify | 10 | from slugify import slugify |
11 | from rolepermissions.verifications import has_role | 11 | from rolepermissions.verifications import has_role |
12 | from django.db.models import Q | 12 | from django.db.models import Q |
13 | +from rolepermissions.verifications import has_object_permission | ||
13 | 14 | ||
14 | from .forms import CourseForm, CategoryForm, SubjectForm,TopicForm | 15 | from .forms import CourseForm, CategoryForm, SubjectForm,TopicForm |
15 | from .models import Course, Subject, Category,Topic | 16 | from .models import Course, Subject, Category,Topic |
@@ -223,7 +224,7 @@ class SubjectsView(LoginRequiredMixin, generic.ListView): | @@ -223,7 +224,7 @@ class SubjectsView(LoginRequiredMixin, generic.ListView): | ||
223 | 224 | ||
224 | class CreateTopicView(LoginRequiredMixin, HasRoleMixin, NotificationMixin, generic.edit.CreateView): | 225 | class CreateTopicView(LoginRequiredMixin, HasRoleMixin, NotificationMixin, generic.edit.CreateView): |
225 | 226 | ||
226 | - allowed_roles = ['professor', 'system_admin','student'] | 227 | + allowed_roles = ['professor', 'system_admin'] |
227 | login_url = reverse_lazy("core:home") | 228 | login_url = reverse_lazy("core:home") |
228 | redirect_field_name = 'next' | 229 | redirect_field_name = 'next' |
229 | template_name = 'topic/create.html' | 230 | template_name = 'topic/create.html' |
@@ -254,12 +255,18 @@ class CreateTopicView(LoginRequiredMixin, HasRoleMixin, NotificationMixin, gener | @@ -254,12 +255,18 @@ class CreateTopicView(LoginRequiredMixin, HasRoleMixin, NotificationMixin, gener | ||
254 | 255 | ||
255 | class UpdateTopicView(LoginRequiredMixin, HasRoleMixin, generic.UpdateView): | 256 | class UpdateTopicView(LoginRequiredMixin, HasRoleMixin, generic.UpdateView): |
256 | 257 | ||
257 | - allowed_roles = ['professor', 'system_admin','student'] | 258 | + allowed_roles = ['professor','system_admin'] |
258 | login_url = reverse_lazy("core:home") | 259 | login_url = reverse_lazy("core:home") |
259 | redirect_field_name = 'next' | 260 | redirect_field_name = 'next' |
260 | template_name = 'topic/update.html' | 261 | template_name = 'topic/update.html' |
261 | form_class = TopicForm | 262 | form_class = TopicForm |
262 | 263 | ||
264 | + def dispatch(self, *args, **kwargs): | ||
265 | + topic = get_object_or_404(Topic, slug = self.kwargs.get('slug')) | ||
266 | + if(not has_object_permission('edit_topic', self.request.user, topic)): | ||
267 | + return self.handle_no_permission() | ||
268 | + return super(UpdateTopicView, self).dispatch(*args, **kwargs) | ||
269 | + | ||
263 | def get_object(self, queryset=None): | 270 | def get_object(self, queryset=None): |
264 | return get_object_or_404(Topic, slug = self.kwargs.get('slug')) | 271 | return get_object_or_404(Topic, slug = self.kwargs.get('slug')) |
265 | 272 | ||
@@ -315,6 +322,12 @@ class UpdateSubjectView(LoginRequiredMixin, HasRoleMixin, generic.UpdateView): | @@ -315,6 +322,12 @@ class UpdateSubjectView(LoginRequiredMixin, HasRoleMixin, generic.UpdateView): | ||
315 | template_name = 'subject/update.html' | 322 | template_name = 'subject/update.html' |
316 | form_class = SubjectForm | 323 | form_class = SubjectForm |
317 | 324 | ||
325 | + def dispatch(self, *args, **kwargs): | ||
326 | + subject = get_object_or_404(Subject, slug = self.kwargs.get('slug')) | ||
327 | + if(not has_object_permission('edit_subject', self.request.user, subject)): | ||
328 | + return self.handle_no_permission() | ||
329 | + return super(UpdateSubjectView, self).dispatch(*args, **kwargs) | ||
330 | + | ||
318 | def get_object(self, queryset=None): | 331 | def get_object(self, queryset=None): |
319 | context = get_object_or_404(Subject, slug = self.kwargs.get('slug')) | 332 | context = get_object_or_404(Subject, slug = self.kwargs.get('slug')) |
320 | return context | 333 | return context |
@@ -339,6 +352,13 @@ class DeleteSubjectView(LoginRequiredMixin, HasRoleMixin, generic.DeleteView): | @@ -339,6 +352,13 @@ class DeleteSubjectView(LoginRequiredMixin, HasRoleMixin, generic.DeleteView): | ||
339 | model = Subject | 352 | model = Subject |
340 | template_name = 'subject/delete.html' | 353 | template_name = 'subject/delete.html' |
341 | 354 | ||
355 | + def dispatch(self, *args, **kwargs): | ||
356 | + subject = get_object_or_404(Subject, slug = self.kwargs.get('slug')) | ||
357 | + if(not has_object_permission('delete_subject', self.request.user, subject)): | ||
358 | + return self.handle_no_permission() | ||
359 | + return super(DeleteSubjectView, self).dispatch(*args, **kwargs) | ||
360 | + | ||
361 | + | ||
342 | def get_context_data(self, **kwargs): | 362 | def get_context_data(self, **kwargs): |
343 | context = super(DeleteSubjectView, self).get_context_data(**kwargs) | 363 | context = super(DeleteSubjectView, self).get_context_data(**kwargs) |
344 | context['course'] = self.object.course | 364 | context['course'] = self.object.course |
logs/log_file_02-09-2016.txt
@@ -1,6 +0,0 @@ | @@ -1,6 +0,0 @@ | ||
1 | -02/09/2016 23:34:45 - zambom - Entrou no sistema | ||
2 | -02/09/2016 23:34:45 - zambom - Acessou home | ||
3 | -02/09/2016 23:55:55 - jailson - Entrou no sistema | ||
4 | -02/09/2016 23:55:55 - jailson - Acessou home | ||
5 | -02/09/2016 23:56:05 - jailson - Acessou home | ||
6 | -02/09/2016 23:56:25 - jailson - Acessou home |
logs/log_file_03-09-2016.txt
logs/log_file_05-09-2016.txt
@@ -1,52 +0,0 @@ | @@ -1,52 +0,0 @@ | ||
1 | -05/09/2016 02:41:58 - matheuslins - Entrou no sistema | ||
2 | -05/09/2016 02:41:58 - matheuslins - Acessou home | ||
3 | -05/09/2016 02:43:00 - matheuslins - Acessou home | ||
4 | -05/09/2016 02:43:14 - matheuslins - Entrou no sistema | ||
5 | -05/09/2016 02:43:14 - matheuslins - Acessou home | ||
6 | -05/09/2016 02:43:18 - matheuslins - Acessou home | ||
7 | -05/09/2016 02:44:46 - matheuslins - Acessou home | ||
8 | -05/09/2016 02:45:32 - matheuslins - Entrou no sistema | ||
9 | -05/09/2016 02:45:32 - matheuslins - Acessou home | ||
10 | -05/09/2016 03:09:26 - matheuslins - Acessou home | ||
11 | -05/09/2016 03:09:29 - matheuslins - Acessou home | ||
12 | -05/09/2016 03:11:13 - matheuslins - Acessou home | ||
13 | -05/09/2016 04:07:13 - test - Entrou no sistema | ||
14 | -05/09/2016 04:07:13 - test - Acessou home | ||
15 | -05/09/2016 04:08:48 - test - Entrou no sistema | ||
16 | -05/09/2016 04:08:48 - test - Acessou home | ||
17 | -05/09/2016 04:09:55 - test - Entrou no sistema | ||
18 | -05/09/2016 04:09:55 - test - Acessou home | ||
19 | -05/09/2016 04:12:37 - test - Entrou no sistema | ||
20 | -05/09/2016 04:12:37 - test - Acessou home | ||
21 | -05/09/2016 04:13:00 - test - Entrou no sistema | ||
22 | -05/09/2016 04:13:00 - test - Acessou home | ||
23 | -05/09/2016 04:13:23 - test - Entrou no sistema | ||
24 | -05/09/2016 04:13:23 - test - Acessou home | ||
25 | -05/09/2016 04:15:02 - test - Entrou no sistema | ||
26 | -05/09/2016 04:15:02 - test - Acessou home | ||
27 | -05/09/2016 04:20:19 - matheuslins - Entrou no sistema | ||
28 | -05/09/2016 04:20:19 - matheuslins - Acessou home | ||
29 | -05/09/2016 04:21:11 - matheuslins - Acessou home | ||
30 | -05/09/2016 04:36:46 - test - Entrou no sistema | ||
31 | -05/09/2016 04:36:46 - test - Acessou home | ||
32 | -05/09/2016 04:37:23 - test - Entrou no sistema | ||
33 | -05/09/2016 04:37:23 - test - Acessou home | ||
34 | -05/09/2016 04:37:41 - test - Entrou no sistema | ||
35 | -05/09/2016 04:37:41 - test - Acessou home | ||
36 | -05/09/2016 04:38:01 - test - Entrou no sistema | ||
37 | -05/09/2016 04:38:01 - test - Acessou home | ||
38 | -05/09/2016 04:38:23 - test - Entrou no sistema | ||
39 | -05/09/2016 04:38:23 - test - Acessou home | ||
40 | -05/09/2016 04:38:39 - test - Entrou no sistema | ||
41 | -05/09/2016 04:38:39 - test - Acessou home | ||
42 | -05/09/2016 04:39:39 - test - Entrou no sistema | ||
43 | -05/09/2016 04:39:39 - test - Acessou home | ||
44 | -05/09/2016 04:40:28 - matheuslins - Acessou home | ||
45 | -05/09/2016 15:14:48 - matheuslins - Acessou home | ||
46 | -05/09/2016 15:28:49 - zambom - Acessou home | ||
47 | -05/09/2016 15:29:02 - zambom - Entrou no sistema | ||
48 | -05/09/2016 15:29:02 - zambom - Acessou home | ||
49 | -05/09/2016 15:31:13 - zambom - Entrou no sistema | ||
50 | -05/09/2016 15:31:13 - zambom - Acessou home | ||
51 | -05/09/2016 20:20:12 - admin - Entrou no sistema | ||
52 | -05/09/2016 20:20:13 - admin - Acessou home | ||
53 | \ No newline at end of file | 0 | \ No newline at end of file |
logs/log_file_06-09-2016.txt
@@ -1,100 +0,0 @@ | @@ -1,100 +0,0 @@ | ||
1 | -06/09/2016 00:07:02 - teste - Entrou no sistema | ||
2 | -06/09/2016 00:07:02 - teste - Acessou home | ||
3 | -06/09/2016 00:08:58 - teste - Acessou home | ||
4 | -06/09/2016 01:01:27 - test - Entrou no sistema | ||
5 | -06/09/2016 01:01:27 - test - Acessou home | ||
6 | -06/09/2016 01:05:49 - test - Entrou no sistema | ||
7 | -06/09/2016 01:05:49 - test - Acessou home | ||
8 | -06/09/2016 01:07:43 - test - Entrou no sistema | ||
9 | -06/09/2016 01:07:43 - test - Acessou home | ||
10 | -06/09/2016 01:08:45 - test - Entrou no sistema | ||
11 | -06/09/2016 01:08:45 - test - Acessou home | ||
12 | -06/09/2016 01:11:30 - test - Entrou no sistema | ||
13 | -06/09/2016 01:11:30 - test - Acessou home | ||
14 | -06/09/2016 01:12:02 - test - Entrou no sistema | ||
15 | -06/09/2016 01:12:02 - test - Acessou home | ||
16 | -06/09/2016 01:13:00 - test - Entrou no sistema | ||
17 | -06/09/2016 01:13:00 - test - Acessou home | ||
18 | -06/09/2016 01:16:27 - test - Entrou no sistema | ||
19 | -06/09/2016 01:16:27 - test - Acessou home | ||
20 | -06/09/2016 01:17:35 - test - Entrou no sistema | ||
21 | -06/09/2016 01:17:35 - test - Acessou home | ||
22 | -06/09/2016 01:18:15 - test - Entrou no sistema | ||
23 | -06/09/2016 01:18:15 - test - Acessou home | ||
24 | -06/09/2016 01:22:19 - test - Entrou no sistema | ||
25 | -06/09/2016 01:22:19 - test - Acessou home | ||
26 | -06/09/2016 01:25:09 - test - Entrou no sistema | ||
27 | -06/09/2016 01:25:09 - test - Acessou home | ||
28 | -06/09/2016 01:25:35 - test - Entrou no sistema | ||
29 | -06/09/2016 01:25:35 - test - Acessou home | ||
30 | -06/09/2016 01:26:40 - test - Entrou no sistema | ||
31 | -06/09/2016 01:26:40 - test - Acessou home | ||
32 | -06/09/2016 01:27:40 - test - Entrou no sistema | ||
33 | -06/09/2016 01:27:40 - test - Acessou home | ||
34 | -06/09/2016 01:28:50 - test - Entrou no sistema | ||
35 | -06/09/2016 01:28:50 - test - Acessou home | ||
36 | -06/09/2016 01:30:51 - test - Entrou no sistema | ||
37 | -06/09/2016 01:30:51 - test - Acessou home | ||
38 | -06/09/2016 01:41:51 - test - Entrou no sistema | ||
39 | -06/09/2016 01:41:51 - test - Acessou home | ||
40 | -06/09/2016 01:43:59 - test - Entrou no sistema | ||
41 | -06/09/2016 01:43:59 - test - Acessou home | ||
42 | -06/09/2016 01:45:22 - test - Entrou no sistema | ||
43 | -06/09/2016 01:45:22 - test - Acessou home | ||
44 | -06/09/2016 01:45:51 - test - Entrou no sistema | ||
45 | -06/09/2016 01:45:51 - test - Acessou home | ||
46 | -06/09/2016 01:46:02 - test - Entrou no sistema | ||
47 | -06/09/2016 01:46:02 - test - Acessou home | ||
48 | -06/09/2016 01:46:18 - test - Entrou no sistema | ||
49 | -06/09/2016 01:46:18 - test - Acessou home | ||
50 | -06/09/2016 01:46:28 - test - Entrou no sistema | ||
51 | -06/09/2016 01:46:28 - test - Acessou home | ||
52 | -06/09/2016 02:39:03 - test - Entrou no sistema | ||
53 | -06/09/2016 02:39:03 - test - Acessou home | ||
54 | -06/09/2016 02:39:41 - test - Entrou no sistema | ||
55 | -06/09/2016 02:39:41 - test - Acessou home | ||
56 | -06/09/2016 02:40:57 - test - Entrou no sistema | ||
57 | -06/09/2016 02:40:57 - test - Acessou home | ||
58 | -06/09/2016 02:41:50 - test - Entrou no sistema | ||
59 | -06/09/2016 02:41:50 - test - Acessou home | ||
60 | -06/09/2016 02:46:53 - test - Entrou no sistema | ||
61 | -06/09/2016 02:46:53 - test - Acessou home | ||
62 | -06/09/2016 02:47:14 - test - Entrou no sistema | ||
63 | -06/09/2016 02:47:14 - test - Acessou home | ||
64 | -06/09/2016 02:50:33 - test - Entrou no sistema | ||
65 | -06/09/2016 02:50:33 - test - Acessou home | ||
66 | -06/09/2016 02:52:54 - test - Entrou no sistema | ||
67 | -06/09/2016 02:52:54 - test - Acessou home | ||
68 | -06/09/2016 02:57:03 - test - Entrou no sistema | ||
69 | -06/09/2016 02:57:03 - test - Acessou home | ||
70 | -06/09/2016 03:02:15 - test - Entrou no sistema | ||
71 | -06/09/2016 03:02:15 - test - Acessou home | ||
72 | -06/09/2016 16:20:42 - test - Entrou no sistema | ||
73 | -06/09/2016 16:20:42 - test - Acessou home | ||
74 | -06/09/2016 16:29:26 - test - Entrou no sistema | ||
75 | -06/09/2016 16:29:26 - test - Acessou home | ||
76 | -06/09/2016 16:31:14 - test - Entrou no sistema | ||
77 | -06/09/2016 16:31:14 - test - Acessou home | ||
78 | -06/09/2016 16:33:06 - test - Entrou no sistema | ||
79 | -06/09/2016 16:33:06 - test - Acessou home | ||
80 | -06/09/2016 16:33:26 - test - Entrou no sistema | ||
81 | -06/09/2016 16:33:26 - test - Acessou home | ||
82 | -06/09/2016 16:33:36 - test - Entrou no sistema | ||
83 | -06/09/2016 16:33:36 - test - Acessou home | ||
84 | -06/09/2016 16:34:10 - test - Entrou no sistema | ||
85 | -06/09/2016 16:34:10 - test - Acessou home | ||
86 | -06/09/2016 16:34:29 - test - Entrou no sistema | ||
87 | -06/09/2016 16:34:29 - test - Acessou home | ||
88 | -06/09/2016 21:30:40 - test - Entrou no sistema | ||
89 | -06/09/2016 21:30:40 - test - Acessou home | ||
90 | -06/09/2016 21:32:32 - test - Entrou no sistema | ||
91 | -06/09/2016 21:32:32 - test - Acessou home | ||
92 | -06/09/2016 21:34:11 - test - Entrou no sistema | ||
93 | -06/09/2016 21:34:11 - test - Acessou home | ||
94 | -06/09/2016 21:38:44 - test - Entrou no sistema | ||
95 | -06/09/2016 21:38:44 - test - Acessou home | ||
96 | -06/09/2016 21:58:49 - jailson - Entrou no sistema | ||
97 | -06/09/2016 21:58:49 - jailson - Acessou home | ||
98 | -06/09/2016 21:59:05 - jailson - Acessou home | ||
99 | -06/09/2016 21:59:35 - jailson - Acessou home | ||
100 | -06/09/2016 21:59:42 - jailson - Acessou home |
logs/log_file_07-09-2016.txt
@@ -1,10 +0,0 @@ | @@ -1,10 +0,0 @@ | ||
1 | -07/09/2016 17:10:46 - matheuslins - Entrou no sistema | ||
2 | -07/09/2016 17:10:46 - matheuslins - Acessou home | ||
3 | -07/09/2016 17:10:58 - matheuslins - Acessou home | ||
4 | -07/09/2016 17:12:12 - matheuslins - Acessou home | ||
5 | -07/09/2016 17:12:15 - matheuslins - Acessou home | ||
6 | -07/09/2016 17:12:24 - matheuslins - Acessou home | ||
7 | -07/09/2016 17:17:16 - matheuslins - Entrou no sistema | ||
8 | -07/09/2016 17:17:16 - matheuslins - Acessou home | ||
9 | -07/09/2016 17:24:09 - test - Entrou no sistema | ||
10 | -07/09/2016 17:24:09 - test - Acessou home |