Commit 49779ea006ed6036a081b66be4a25449e66d25b8
1 parent
574bd37c
Exists in
master
and in
3 other branches
removed date of notifications on link model
Showing
5 changed files
with
38 additions
and
26 deletions
Show diff stats
links/forms.py
... | ... | @@ -26,12 +26,10 @@ class LinkForm(forms.ModelForm): |
26 | 26 | |
27 | 27 | tags = forms.CharField(label = _('Tags'), required = False) |
28 | 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 | 30 | class Meta: |
33 | 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 | 33 | labels = { |
36 | 34 | 'name': _('Link name'), |
37 | 35 | 'end_view' : _('End View'), |
... | ... | @@ -47,21 +45,7 @@ class LinkForm(forms.ModelForm): |
47 | 45 | |
48 | 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 | 49 | return cleaned_data |
66 | 50 | |
67 | 51 | ... | ... |
... | ... | @@ -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 | 14 | |
15 | 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 | 18 | class Meta: |
22 | 19 | verbose_name = "Link" |
23 | 20 | verbose_name_plural = "Links" | ... | ... |
subjects/templates/subjects/list_search.html
... | ... | @@ -36,10 +36,10 @@ |
36 | 36 | <ul class="core-subjects-options"> |
37 | 37 | {% if all %} |
38 | 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 | 40 | {% else %} |
41 | 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 | 43 | {% endif %} |
44 | 44 | |
45 | 45 | </ul> | ... | ... |
subjects/views.py
... | ... | @@ -607,7 +607,7 @@ class SubjectSearchView(LoginRequiredMixin, LogMixin, ListView): |
607 | 607 | #pk = self.request.user.pk |
608 | 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 | 611 | #if self.kwargs.get('option'): |
612 | 612 | # subjects = my_subjects |
613 | 613 | return subjects | ... | ... |