Commit 49779ea006ed6036a081b66be4a25449e66d25b8

Authored by Felipe Henrique de Almeida Bormann
1 parent 574bd37c

removed date of notifications on link model

links/forms.py
@@ -26,12 +26,10 @@ class LinkForm(forms.ModelForm): @@ -26,12 +26,10 @@ class LinkForm(forms.ModelForm):
26 26
27 tags = forms.CharField(label = _('Tags'), required = False) 27 tags = forms.CharField(label = _('Tags'), required = False)
28 link_url = forms.URLField(label = _('Website URL'),required=True) 28 link_url = forms.URLField(label = _('Website URL'),required=True)
29 - initial_view_date = forms.DateTimeField(input_formats=['%Y/%m/%d %I:%M %p', '%d/%m/%Y %I:%M %p', '%m/%d/%Y %I:%M %p'], required=False)  
30 - end_view_date = forms.DateTimeField(input_formats=['%Y/%m/%d %I:%M %p', '%d/%m/%Y %I:%M %p', '%m/%d/%Y %I:%M %p'], required=False ,help_text=[_('It sets a limit date to finish viewing the website link ')])  
31 - 29 +
32 class Meta: 30 class Meta:
33 model = Link 31 model = Link
34 - fields = ['name','link_url', 'initial_view','initial_view_date', 'end_view','end_view_date', 'brief_description', 'all_students', 'students', 'groups', 'visible'] 32 + fields = ['name','link_url', 'brief_description', 'all_students', 'students', 'groups', 'visible']
35 labels = { 33 labels = {
36 'name': _('Link name'), 34 'name': _('Link name'),
37 'end_view' : _('End View'), 35 'end_view' : _('End View'),
@@ -47,21 +45,7 @@ class LinkForm(forms.ModelForm): @@ -47,21 +45,7 @@ class LinkForm(forms.ModelForm):
47 45
48 cleaned_data = self.cleaned_data 46 cleaned_data = self.cleaned_data
49 47
50 - if cleaned_data.get('end_view'):  
51 - end_view = cleaned_data.get('end_view')  
52 - if end_view and not cleaned_data.get('end_view_date'):  
53 - raise ValidationError(_('End View Date is not set'), code='invalid' )  
54 -  
55 - if cleaned_data.get('initial_view'):  
56 - initial_view = cleaned_data.get('initial_view')  
57 - if initial_view and not cleaned_data.get('initial_view_date'):  
58 - raise ValidationError(_('Initial View Date is not set'), code='invalid' )  
59 - if cleaned_data.get('initial_view_date') and cleaned_data.get('end_view_date'):  
60 - end_view_date = cleaned_data.get('end_view_date')  
61 - initial_view_date = cleaned_data.get('initial_view_date')  
62 - if end_view_date < initial_view_date:  
63 - raise ValidationError(_('End View Date before Initial View Date'), code='invalid' )  
64 - 48 +
65 return cleaned_data 49 return cleaned_data
66 50
67 51
links/migrations/0006_auto_20170201_1756.py 0 → 100644
@@ -0,0 +1,31 @@ @@ -0,0 +1,31 @@
  1 +# -*- coding: utf-8 -*-
  2 +# Generated by Django 1.10.4 on 2017-02-01 20:56
  3 +from __future__ import unicode_literals
  4 +
  5 +from django.db import migrations
  6 +
  7 +
  8 +class Migration(migrations.Migration):
  9 +
  10 + dependencies = [
  11 + ('links', '0005_auto_20170201_0101'),
  12 + ]
  13 +
  14 + operations = [
  15 + migrations.RemoveField(
  16 + model_name='link',
  17 + name='end_view',
  18 + ),
  19 + migrations.RemoveField(
  20 + model_name='link',
  21 + name='end_view_date',
  22 + ),
  23 + migrations.RemoveField(
  24 + model_name='link',
  25 + name='initial_view',
  26 + ),
  27 + migrations.RemoveField(
  28 + model_name='link',
  29 + name='initial_view_date',
  30 + ),
  31 + ]
links/models.py
@@ -14,10 +14,7 @@ class Link(Resource): @@ -14,10 +14,7 @@ class Link(Resource):
14 14
15 link_url = models.URLField(verbose_name = _("Link_URL")) 15 link_url = models.URLField(verbose_name = _("Link_URL"))
16 16
17 - initial_view = models.BooleanField(_('Initial View'), default = False)  
18 - initial_view_date = models.DateTimeField(_('Initial View Date'), default= timezone.now, null=True)  
19 - end_view = models.BooleanField(_('Initial View'), default = False)  
20 - end_view_date = models.DateTimeField(_('Initial View Date'), default=timezone.now, null=True) 17 +
21 class Meta: 18 class Meta:
22 verbose_name = "Link" 19 verbose_name = "Link"
23 verbose_name_plural = "Links" 20 verbose_name_plural = "Links"
subjects/templates/subjects/list_search.html
@@ -36,10 +36,10 @@ @@ -36,10 +36,10 @@
36 <ul class="core-subjects-options"> 36 <ul class="core-subjects-options">
37 {% if all %} 37 {% if all %}
38 <a href="{% url 'subjects:search' %}?search= {{tags}} "><li >{% trans "Subjects" %} ({{ totals.my_subjects }})</li></a> 38 <a href="{% url 'subjects:search' %}?search= {{tags}} "><li >{% trans "Subjects" %} ({{ totals.my_subjects }})</li></a>
39 - <a href="" ><li class="active">{% trans "Resources" %} ({{ totals.all_subjects }})</li></a> 39 + <a href="" ><li class="active">{% trans "Resources" %} ({{ totals.resources }})</li></a>
40 {% else %} 40 {% else %}
41 <a href="{% url 'subjects:search' %}?search={{tags}}"><li class="active">{% trans "Subjects" %} ({{ totals.my_subjects }})</li></a> 41 <a href="{% url 'subjects:search' %}?search={{tags}}"><li class="active">{% trans "Subjects" %} ({{ totals.my_subjects }})</li></a>
42 - <a href="" ><li>{% trans "Resources" %} ({{ totals.all_subjects }})</li></a> 42 + <a href="" ><li>{% trans "Resources" %} ({{ totals.resources }})</li></a>
43 {% endif %} 43 {% endif %}
44 44
45 </ul> 45 </ul>
subjects/views.py
@@ -607,7 +607,7 @@ class SubjectSearchView(LoginRequiredMixin, LogMixin, ListView): @@ -607,7 +607,7 @@ class SubjectSearchView(LoginRequiredMixin, LogMixin, ListView):
607 #pk = self.request.user.pk 607 #pk = self.request.user.pk
608 #my_subjects = Subject.objects.filter(Q(students__pk=pk) | Q(professor__pk=pk) | Q(category__coordinators__pk=pk) & Q(tags__name__in=tags) ).distinct() 608 #my_subjects = Subject.objects.filter(Q(students__pk=pk) | Q(professor__pk=pk) | Q(category__coordinators__pk=pk) & Q(tags__name__in=tags) ).distinct()
609 609
610 - self.totals = {'all_subjects': subjects.count(), 'my_subjects': subjects.count()} 610 + self.totals = {'resources': subjects.count(), 'my_subjects': subjects.count()}
611 #if self.kwargs.get('option'): 611 #if self.kwargs.get('option'):
612 # subjects = my_subjects 612 # subjects = my_subjects
613 return subjects 613 return subjects