Commit 0e8fc5748376c8f32f774ddfef94385b47f14562
Exists in
master
and in
3 other branches
Merge branch 'refactoring' of https://github.com/amadeusproject/amadeuslms into refactoring
Showing
20 changed files
with
310 additions
and
38 deletions
Show diff stats
amadeus/settings.py
... | ... | @@ -172,7 +172,7 @@ USE_L10N = True |
172 | 172 | |
173 | 173 | USE_TZ = True |
174 | 174 | |
175 | - | |
175 | +FORMAT_MODULE_PATH = 'amadeus.formats' | |
176 | 176 | # Static files (CSS, JavaScript, Images) |
177 | 177 | # https://docs.djangoproject.com/en/1.9/howto/static-files/ |
178 | 178 | |
... | ... | @@ -269,10 +269,6 @@ OAUTH2_PROVIDER = { |
269 | 269 | |
270 | 270 | |
271 | 271 | #For date purposes |
272 | -DATETIME_INPUT_FORMATS.append('%d/%m/%y') | |
273 | -DATETIME_INPUT_FORMATS.append('%m/%d/%y') | |
274 | -DATETIME_INPUT_FORMATS.append('%m/%d/%Y %I:%M %p') | |
275 | -DATETIME_INPUT_FORMATS.append('%d/%m/%Y %H:%M') | |
276 | 272 | DATE_INPUT_FORMATS.append('%d/%m/%y') |
277 | 273 | DATE_INPUT_FORMATS.append('%m/%d/%y') |
278 | 274 | ... | ... |
amadeus/static/css/.sass-cache/a7f87b90919294b62ab4f8079e31dcda8f485534/green.sassc
No preview for this file type
amadeus/static/css/base/amadeus.css
amadeus/static/css/themes/green.css
... | ... | @@ -465,6 +465,9 @@ a.add-row { |
465 | 465 | .btn:not(.btn-raised):not(.btn-link):focus, .btn:not(.btn-raised):not(.btn-link):hover, .input-group-btn .btn:not(.btn-raised):not(.btn-link):focus, .input-group-btn .btn:not(.btn-raised):not(.btn-link):hover { |
466 | 466 | background-color: initial; } |
467 | 467 | |
468 | +.goalitems .slider { | |
469 | + background-color: initial; } | |
470 | + | |
468 | 471 | @media(max-width: 768px) { |
469 | 472 | .navbar .navbar-nav .dropdown .dropdown-menu li > a { |
470 | 473 | color: #333333 !important; } | ... | ... |
amadeus/static/css/themes/green.css.map
1 | 1 | {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BvB,eAAe;EACX,KAAK,EAAE,OAAO;;AAId,kBAAK;EACD,KAAK,EAAE,OAAO;;AAIlB,cAAC;EACG,KAAK,EAAE,OAAO;;AAGtB,YAAY;EACR,UAAU,EAhnBN,OAAO;;AAmnBf,gBAAgB;EACZ,UAAU,EAAE,IAAI;;AAGpB,gNAAgN;EAC5M,gBAAgB,EAAE,OAAO;;AAE7B,kBAAkB;EACd,gBAAgB,EAAE,OAAO;;;EAIzB,mDAAmD;IAC/C,KAAK,EAAE,kBAAkB;;EAE7B,yDAAyD;IACrD,KAAK,EAAE,kBAAyB", | |
4 | 4 | "sources": ["green.sass"], |
5 | 5 | "names": [], |
6 | 6 | "file": "green.css" | ... | ... |
amadeus/static/css/themes/green.sass
... | ... | @@ -636,6 +636,8 @@ a.add-row |
636 | 636 | .btn:not(.btn-raised):not(.btn-link):focus, .btn:not(.btn-raised):not(.btn-link):hover, .input-group-btn .btn:not(.btn-raised):not(.btn-link):focus, .input-group-btn .btn:not(.btn-raised):not(.btn-link):hover |
637 | 637 | background-color: initial |
638 | 638 | |
639 | +.goalitems .slider | |
640 | + background-color: initial | |
639 | 641 | |
640 | 642 | |
641 | 643 | @media(max-width: 768px) | ... | ... |
goals/forms.py
1 | 1 | # coding=utf-8 |
2 | 2 | from django import forms |
3 | +from datetime import datetime | |
3 | 4 | from django.conf import settings |
4 | 5 | from django.utils.translation import ugettext_lazy as _ |
5 | 6 | from django.forms.models import inlineformset_factory |
... | ... | @@ -13,25 +14,27 @@ from .models import Goals, GoalItem |
13 | 14 | |
14 | 15 | class GoalsForm(forms.ModelForm): |
15 | 16 | subject = None |
17 | + topic = None | |
16 | 18 | control_subject = forms.CharField(widget = forms.HiddenInput()) |
17 | 19 | |
18 | 20 | def __init__(self, *args, **kwargs): |
19 | 21 | super(GoalsForm, self).__init__(*args, **kwargs) |
20 | 22 | |
21 | 23 | self.subject = kwargs['initial'].get('subject', None) |
24 | + self.topic = kwargs['initial'].get('topic', None) | |
22 | 25 | |
23 | 26 | if self.instance.id: |
24 | 27 | self.subject = self.instance.topic.subject |
28 | + self.topic = self.instance.topic | |
25 | 29 | self.initial['tags'] = ", ".join(self.instance.tags.all().values_list("name", flat = True)) |
26 | 30 | |
27 | 31 | self.initial['control_subject'] = self.subject.id |
28 | 32 | |
29 | 33 | tags = forms.CharField(label = _('Tags'), required = False) |
30 | - limit_submission_date = forms.DateTimeField(input_formats = settings.DATETIME_INPUT_FORMATS) | |
31 | 34 | |
32 | 35 | class Meta: |
33 | 36 | model = Goals |
34 | - fields = ['name', 'presentation', 'brief_description', 'show_window', 'visible'] | |
37 | + fields = ['name', 'presentation', 'limit_submission_date', 'brief_description', 'show_window', 'visible'] | |
35 | 38 | labels = { |
36 | 39 | 'name': _('Name'), |
37 | 40 | } |
... | ... | @@ -43,16 +46,27 @@ class GoalsForm(forms.ModelForm): |
43 | 46 | def clean(self): |
44 | 47 | cleaned_data = super(GoalsForm, self).clean() |
45 | 48 | |
46 | - topic = cleaned_data.get('topic', None) | |
49 | + limit_submission_date = cleaned_data.get('limit_submission_date', None) | |
47 | 50 | |
48 | - if topic: | |
51 | + if self.topic: | |
49 | 52 | if self.instance.id: |
50 | - exist = topic.resource_topic.filter(goals__isnull = False).exclude(id = self.instance.id).exists() | |
53 | + exist = self.topic.resource_topic.filter(goals__isnull = False).exclude(id = self.instance.id).exists() | |
51 | 54 | else: |
52 | - exist = topic.resource_topic.filter(goals__isnull = False).exists() | |
55 | + exist = self.topic.resource_topic.filter(goals__isnull = False).exists() | |
53 | 56 | |
54 | 57 | if exist: |
55 | - self.add_error('name', _('There already is another resource with the goals specification for the Topic %s')%(str(topic))) | |
58 | + self.add_error('name', _('There already is another resource with the goals specification for the Topic %s')%(str(self.topic))) | |
59 | + | |
60 | + if limit_submission_date: | |
61 | + if not limit_submission_date == ValueError: | |
62 | + if not self.instance.id and limit_submission_date.date() < datetime.today().date(): | |
63 | + self.add_error('limit_submission_date', _("This input should be filled with a date equal or after today's date.")) | |
64 | + | |
65 | + if limit_submission_date.date() < self.subject.init_date: | |
66 | + self.add_error('limit_submission_date', _('This input should be filled with a date equal or after the subject begin date.')) | |
67 | + | |
68 | + if limit_submission_date.date() > self.subject.end_date: | |
69 | + self.add_error('limit_submission_date', _('This input should be filled with a date equal or after the subject end date.')) | |
56 | 70 | |
57 | 71 | return cleaned_data |
58 | 72 | |
... | ... | @@ -90,5 +104,18 @@ class GoalItemForm(forms.ModelForm): |
90 | 104 | model = GoalItem |
91 | 105 | fields = ['description', 'ref_value'] |
92 | 106 | |
107 | + def clean(self): | |
108 | + cleaned_data = super(GoalItemForm, self).clean() | |
109 | + | |
110 | + description = cleaned_data.get('description', None) | |
111 | + ref_value = cleaned_data.get('ref_value', None) | |
112 | + | |
113 | + if ref_value and ref_value != "0": | |
114 | + if not description: | |
115 | + self.add_error('description', _('This field is required.')) | |
116 | + | |
117 | + return cleaned_data | |
118 | + | |
119 | + | |
93 | 120 | InlinePendenciesFormset = inlineformset_factory(Goals, Pendencies, form = PendenciesLimitedForm, extra = 1, max_num = 3, validate_max = True, can_delete = True) |
94 | 121 | InlineGoalItemFormset = inlineformset_factory(Goals, GoalItem, form = GoalItemForm, extra = 1, can_delete = True) |
95 | 122 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,20 @@ |
1 | +# -*- coding: utf-8 -*- | |
2 | +# Generated by Django 1.10 on 2017-02-24 20:21 | |
3 | +from __future__ import unicode_literals | |
4 | + | |
5 | +from django.db import migrations, models | |
6 | + | |
7 | + | |
8 | +class Migration(migrations.Migration): | |
9 | + | |
10 | + dependencies = [ | |
11 | + ('goals', '0001_initial'), | |
12 | + ] | |
13 | + | |
14 | + operations = [ | |
15 | + migrations.AlterField( | |
16 | + model_name='goals', | |
17 | + name='limit_submission_date', | |
18 | + field=models.DateTimeField(blank=True, null=True, verbose_name='Submission Limit Date'), | |
19 | + ), | |
20 | + ] | ... | ... |
goals/models.py
... | ... | @@ -7,7 +7,7 @@ from topics.models import Resource |
7 | 7 | |
8 | 8 | class Goals(Resource): |
9 | 9 | presentation = models.TextField(_('Presentation'), blank = True) |
10 | - limit_submission_date = models.DateTimeField(_('Submission Limit Date')) | |
10 | + limit_submission_date = models.DateTimeField(_('Submission Limit Date'), null = True, blank = True) | |
11 | 11 | |
12 | 12 | class Meta: |
13 | 13 | verbose_name = _('Goal') |
... | ... | @@ -20,7 +20,7 @@ class Goals(Resource): |
20 | 20 | return reverse_lazy('file_links:download', args = (), kwargs = {'slug': self.slug}) |
21 | 21 | |
22 | 22 | def update_link(self): |
23 | - return 'file_links:update' | |
23 | + return 'goals:update' | |
24 | 24 | |
25 | 25 | def delete_link(self): |
26 | 26 | return 'file_links:delete' |
... | ... | @@ -29,7 +29,7 @@ class Goals(Resource): |
29 | 29 | return _('Are you sure you want delete the goals') |
30 | 30 | |
31 | 31 | class GoalItem(models.Model): |
32 | - description = models.CharField(_('Description'), max_length = 255) | |
32 | + description = models.CharField(_('Description'), max_length = 255, blank = True) | |
33 | 33 | ref_value = models.IntegerField(_('Referential Value')) |
34 | 34 | order = models.PositiveSmallIntegerField(_('Order'), null = True) |
35 | 35 | goal = models.ForeignKey(Goals, verbose_name = _('Goal'), related_name = 'item_goal') |
36 | 36 | \ No newline at end of file | ... | ... |
goals/templates/goals/_form.html
... | ... | @@ -71,10 +71,10 @@ |
71 | 71 | {% if item.instance.pk %}{{ item.DELETE }}{% endif %} |
72 | 72 | |
73 | 73 | <div class="form-group{% if item.has_error %} has-error {% endif %} row"> |
74 | - <label for="{{ item.description.auto_id }}" class="pull-left action_label contol-label"> | |
74 | + <label for="{{ item.description.auto_id }}" class="pull-left desc_label contol-label"> | |
75 | 75 | {{ item.description.label }}<span>*</span>: |
76 | 76 | </label> |
77 | - <div class="col-md-3"> | |
77 | + <div class="col-md-11"> | |
78 | 78 | {% render_field item.description class='form-control' %} |
79 | 79 | </div> |
80 | 80 | |
... | ... | @@ -98,12 +98,14 @@ |
98 | 98 | <br clear="all" /> |
99 | 99 | <div class="form-group{% if item.has_error %} has-error {% endif %} row"> |
100 | 100 | <label for="{{ item.ref_value.auto_id }}" class="pull-left action_label contol-label"> |
101 | - {{ item.ref_value.label }}<span>*</span>: | |
101 | + {% trans 'Minimum percentage desired' %}<span>*</span>: | |
102 | 102 | </label> |
103 | 103 | <div class="col-md-9"> |
104 | - <span>0%</span> | |
105 | - {% render_field item.ref_value class='slider_value' data-slider-min="0" data-slider-max="100" %} | |
106 | - <span>100%</span> | |
104 | + <span class="label">0%</span> | |
105 | + {% with item.ref_value.value|default:"0" as item_value %} | |
106 | + {% render_field item.ref_value class='slider_value' data-slider-value=item_value data-slider-min="0" data-slider-max="100" %} | |
107 | + {% endwith %} | |
108 | + <span class="label">100%</span> | |
107 | 109 | </div> |
108 | 110 | |
109 | 111 | <br clear="all" /> |
... | ... | @@ -192,7 +194,7 @@ |
192 | 194 | </div> |
193 | 195 | {% endif %} |
194 | 196 | </div> |
195 | - | |
197 | + | |
196 | 198 | <div class="panel panel-info"> |
197 | 199 | <div class="panel-heading"> |
198 | 200 | <div class="row"> |
... | ... | @@ -212,6 +214,7 @@ |
212 | 214 | {% for notify in pendencies_form %} |
213 | 215 | <div class="notifies"> |
214 | 216 | <div style="text-align:left"> |
217 | + {{ notify.errors }} | |
215 | 218 | {% render_field notify.id %} |
216 | 219 | {% render_field notify.resource %} |
217 | 220 | {% render_field notify.subject class='pend_subj' %} |
... | ... | @@ -389,7 +392,7 @@ |
389 | 392 | <script type="text/javascript"> |
390 | 393 | $(function() { |
391 | 394 | $(".slider_value").bootstrapSlider({ |
392 | - tooltip: 'always' | |
395 | + tooltip: 'always', | |
393 | 396 | }); |
394 | 397 | |
395 | 398 | $('.goalitems').formset({ |
... | ... | @@ -407,7 +410,8 @@ |
407 | 410 | new_input.bootstrapSlider({ |
408 | 411 | tooltip: 'always', |
409 | 412 | min: '0', |
410 | - max: '100' | |
413 | + max: '100', | |
414 | + value: '0' | |
411 | 415 | }); |
412 | 416 | } |
413 | 417 | }); |
... | ... | @@ -475,6 +479,10 @@ |
475 | 479 | {% if not pendencies_form.is_valid and pendencies_form.is_bound %} |
476 | 480 | $("#notifications").collapse('toggle'); |
477 | 481 | {% endif %} |
482 | + | |
483 | + {% if not goalitems_form.is_valid and goalitems_form.is_bound %} | |
484 | + $("#goal_items").collapse('toggle'); | |
485 | + {% endif %} | |
478 | 486 | }); |
479 | 487 | </script> |
480 | 488 | <script type="text/javascript" src="{% static 'js/resources.js' %}"></script> |
481 | 489 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,37 @@ |
1 | +{% extends 'subjects/view.html' %} | |
2 | + | |
3 | +{% load static i18n django_bootstrap_breadcrumbs %} | |
4 | + | |
5 | +{% block style %} | |
6 | + {{block.super}} | |
7 | + <link rel="stylesheet" type="text/css" href="{% static "css/bootstrap-tagsinput.css" %}"> | |
8 | + <link rel="stylesheet" type="text/css" href="{% static "css/bootstrap-slider.css" %}"> | |
9 | +{% endblock %} | |
10 | + | |
11 | +{% block javascript %} | |
12 | + {{block.super}} | |
13 | + <script type="text/javascript" src="{% static "js/bootstrap-tagsinput.js" %} "></script> | |
14 | + <script type="text/javascript" src="{% static "js/bootstrap-slider.js" %} "></script> | |
15 | + <script type="text/javascript" src="{% static "js/jquery.formset.js" %} "></script> | |
16 | +{% endblock %} | |
17 | + | |
18 | +{% block breadcrumbs %} | |
19 | + {{ block.super }} | |
20 | + | |
21 | + {% breadcrumb topic 'subjects:topic_view' topic.subject.slug topic.slug %} | |
22 | + | |
23 | + {% trans 'Edit: Topic Goals ' as bread %} | |
24 | + {% breadcrumb bread 'goals:update' topic.slug goal.slug %} | |
25 | +{% endblock %} | |
26 | + | |
27 | +{% block content %} | |
28 | + <div class="card"> | |
29 | + <div class="card-content"> | |
30 | + <div class="card-body"> | |
31 | + {% include 'goals/_form.html' %} | |
32 | + </div> | |
33 | + </div> | |
34 | + </div> | |
35 | + <br clear="all" /> | |
36 | + <br clear="all" /> | |
37 | +{% endblock %} | ... | ... |
goals/urls.py
goals/views.py
... | ... | @@ -103,6 +103,17 @@ class CreateView(LoginRequiredMixin, generic.edit.CreateView): |
103 | 103 | |
104 | 104 | goalitems_form.instance = self.object |
105 | 105 | goalitems_form.save(commit = False) |
106 | + | |
107 | + g_order = 1 | |
108 | + | |
109 | + for gform in goalitems_form.forms: | |
110 | + goal_form = gform.save(commit = False) | |
111 | + | |
112 | + if not goal_form.description == "": | |
113 | + goal_form.order = g_order | |
114 | + goal_form.save() | |
115 | + | |
116 | + g_order += 1 | |
106 | 117 | |
107 | 118 | return redirect(self.get_success_url()) |
108 | 119 | |
... | ... | @@ -131,4 +142,119 @@ class CreateView(LoginRequiredMixin, generic.edit.CreateView): |
131 | 142 | |
132 | 143 | success_url = reverse_lazy('subjects:view', kwargs = {'slug': self.object.topic.subject.slug}) |
133 | 144 | |
145 | + return success_url | |
146 | + | |
147 | +class UpdateView(LoginRequiredMixin, generic.UpdateView): | |
148 | + login_url = reverse_lazy("users:login") | |
149 | + redirect_field_name = 'next' | |
150 | + | |
151 | + template_name = 'goals/update.html' | |
152 | + model = Goals | |
153 | + form_class = GoalsForm | |
154 | + context_object_name = 'goal' | |
155 | + | |
156 | + def dispatch(self, request, *args, **kwargs): | |
157 | + slug = self.kwargs.get('topic_slug', '') | |
158 | + topic = get_object_or_404(Topic, slug = slug) | |
159 | + | |
160 | + if not has_subject_permissions(request.user, topic.subject): | |
161 | + return redirect(reverse_lazy('subjects:home')) | |
162 | + | |
163 | + return super(UpdateView, self).dispatch(request, *args, **kwargs) | |
164 | + | |
165 | + def get(self, request, *args, **kwargs): | |
166 | + self.object = self.get_object() | |
167 | + | |
168 | + form_class = self.get_form_class() | |
169 | + form = self.get_form(form_class) | |
170 | + | |
171 | + slug = self.kwargs.get('topic_slug', '') | |
172 | + topic = get_object_or_404(Topic, slug = slug) | |
173 | + | |
174 | + pendencies_form = InlinePendenciesFormset(instance = self.object, initial = [{'subject': topic.subject.id, 'actions': [("", "-------"),("view", _("Visualize")), ("submit", _("Submit"))]}]) | |
175 | + goalitems_form = InlineGoalItemFormset(instance = self.object) | |
176 | + | |
177 | + return self.render_to_response(self.get_context_data(form = form, pendencies_form = pendencies_form, goalitems_form = goalitems_form)) | |
178 | + | |
179 | + def post(self, request, *args, **kwargs): | |
180 | + self.object = self.get_object() | |
181 | + | |
182 | + form_class = self.get_form_class() | |
183 | + form = self.get_form(form_class) | |
184 | + | |
185 | + slug = self.kwargs.get('topic_slug', '') | |
186 | + topic = get_object_or_404(Topic, slug = slug) | |
187 | + | |
188 | + pendencies_form = InlinePendenciesFormset(self.request.POST, instance = self.object, initial = [{'subject': topic.subject.id, 'actions': [("", "-------"),("view", _("Visualize")), ("submit", _("Submit"))]}]) | |
189 | + goalitems_form = InlineGoalItemFormset(self.request.POST, instance = self.object) | |
190 | + | |
191 | + if (form.is_valid() and pendencies_form.is_valid() and goalitems_form.is_valid()): | |
192 | + return self.form_valid(form, pendencies_form, goalitems_form) | |
193 | + else: | |
194 | + return self.form_invalid(form, pendencies_form, goalitems_form) | |
195 | + | |
196 | + def form_invalid(self, form, pendencies_form, goalitems_form): | |
197 | + for p_form in pendencies_form.forms: | |
198 | + p_form.fields['action'].choices = [("", "-------"),("view", _("Visualize")), ("submit", _("Submit"))] | |
199 | + | |
200 | + return self.render_to_response(self.get_context_data(form = form, pendencies_form = pendencies_form, goalitems_form = goalitems_form)) | |
201 | + | |
202 | + def form_valid(self, form, pendencies_form, goalitems_form): | |
203 | + self.object = form.save(commit = False) | |
204 | + | |
205 | + if not self.object.topic.visible and not self.object.topic.repository: | |
206 | + self.object.visible = False | |
207 | + | |
208 | + self.object.save() | |
209 | + | |
210 | + pendencies_form.instance = self.object | |
211 | + pendencies_form.save(commit = False) | |
212 | + | |
213 | + for form in pendencies_form.forms: | |
214 | + pend_form = form.save(commit = False) | |
215 | + | |
216 | + if not pend_form.action == "": | |
217 | + pend_form.save() | |
218 | + | |
219 | + goalitems_form.instance = self.object | |
220 | + goalitems_form.save(commit = False) | |
221 | + | |
222 | + g_order = self.object.item_goal.count() + 1 | |
223 | + | |
224 | + for gform in goalitems_form.forms: | |
225 | + goal_form = gform.save(commit = False) | |
226 | + | |
227 | + if not goal_form.description == "": | |
228 | + goal_form.order = g_order | |
229 | + goal_form.save() | |
230 | + | |
231 | + g_order += 1 | |
232 | + | |
233 | + return redirect(self.get_success_url()) | |
234 | + | |
235 | + def get_context_data(self, **kwargs): | |
236 | + context = super(UpdateView, self).get_context_data(**kwargs) | |
237 | + | |
238 | + context['title'] = _('Update Topic Goals') | |
239 | + | |
240 | + slug = self.kwargs.get('topic_slug', '') | |
241 | + topic = get_object_or_404(Topic, slug = slug) | |
242 | + | |
243 | + context['topic'] = topic | |
244 | + context['subject'] = topic.subject | |
245 | + | |
246 | + return context | |
247 | + | |
248 | + def get_success_url(self): | |
249 | + messages.success(self.request, _('The YouTube Video "%s" was updated successfully!')%(self.object.name)) | |
250 | + | |
251 | + #success_url = reverse_lazy('youtube:view', kwargs = {'slug': self.object.slug}) | |
252 | + | |
253 | + #if self.object.show_window: | |
254 | + # self.request.session['resources'] = {} | |
255 | + # self.request.session['resources']['new_page'] = True | |
256 | + # self.request.session['resources']['new_page_url'] = reverse('youtube:window_view', kwargs = {'slug': self.object.slug}) | |
257 | + | |
258 | + success_url = reverse_lazy('subjects:view', kwargs = {'slug': self.object.topic.subject.slug}) | |
259 | + | |
134 | 260 | return success_url |
135 | 261 | \ No newline at end of file | ... | ... |
pendencies/forms.py
... | ... | @@ -4,6 +4,8 @@ import datetime |
4 | 4 | from django import forms |
5 | 5 | from django.conf import settings |
6 | 6 | from django.utils.translation import ugettext_lazy as _ |
7 | +from django.utils.formats import get_format | |
8 | +from django.utils import timezone | |
7 | 9 | |
8 | 10 | from subjects.models import Subject |
9 | 11 | |
... | ... | @@ -17,15 +19,18 @@ class PendenciesForm(forms.ModelForm): |
17 | 19 | |
18 | 20 | if kwargs.get('initial', None): |
19 | 21 | self.fields['action'].choices = kwargs['initial'].get('actions', []) |
22 | + | |
23 | + datetime_formats = get_format('DATETIME_INPUT_FORMATS') | |
24 | + | |
25 | + self.fields['begin_date'].input_formats = datetime_formats | |
26 | + self.fields['end_date'].input_formats = datetime_formats | |
20 | 27 | |
21 | 28 | begin_date_check = forms.BooleanField(required = False) |
22 | 29 | end_date_check = forms.BooleanField(required = False) |
23 | - begin_date = forms.DateTimeField(input_formats = settings.DATETIME_INPUT_FORMATS) | |
24 | - end_date = forms.DateTimeField(input_formats = settings.DATETIME_INPUT_FORMATS) | |
25 | - | |
30 | + | |
26 | 31 | class Meta: |
27 | 32 | model = Pendencies |
28 | - fields = ['action'] | |
33 | + fields = ['action', 'begin_date', 'end_date'] | |
29 | 34 | |
30 | 35 | def clean(self): |
31 | 36 | cleaned_data = super(PendenciesForm, self).clean() |
... | ... | @@ -88,23 +93,27 @@ class PendenciesLimitedForm(forms.ModelForm): |
88 | 93 | |
89 | 94 | if kwargs.get('initial', None): |
90 | 95 | self.fields['action'].choices = kwargs['initial'].get('actions', []) |
96 | + | |
97 | + datetime_formats = get_format('DATETIME_INPUT_FORMATS') | |
98 | + | |
99 | + self.fields['begin_date'].input_formats = datetime_formats | |
100 | + self.fields['end_date'].input_formats = datetime_formats | |
101 | + self.fields['limit_date'].input_formats = datetime_formats | |
91 | 102 | |
92 | 103 | begin_date_check = forms.BooleanField(required = False) |
93 | 104 | end_date_check = forms.BooleanField(required = False) |
94 | 105 | limit_date_check = forms.BooleanField(required = False) |
95 | - begin_date = forms.DateTimeField(input_formats = settings.DATETIME_INPUT_FORMATS) | |
96 | - end_date = forms.DateTimeField(input_formats = settings.DATETIME_INPUT_FORMATS) | |
97 | - limit_date = forms.DateTimeField(input_formats = settings.DATETIME_INPUT_FORMATS) | |
98 | - | |
106 | + | |
99 | 107 | class Meta: |
100 | 108 | model = Pendencies |
101 | - fields = ['action'] | |
109 | + fields = ['action', 'begin_date', 'end_date', 'limit_date'] | |
102 | 110 | |
103 | 111 | def clean(self): |
104 | 112 | cleaned_data = super(PendenciesLimitedForm, self).clean() |
105 | 113 | |
106 | 114 | pend_id = cleaned_data.get('id', None) |
107 | 115 | |
116 | + limit_submission_date = self.data.get('limit_submission_date', None) | |
108 | 117 | action = cleaned_data.get('action', None) |
109 | 118 | begin_date = cleaned_data.get('begin_date', None) |
110 | 119 | end_date = cleaned_data.get('end_date', None) |
... | ... | @@ -114,7 +123,7 @@ class PendenciesLimitedForm(forms.ModelForm): |
114 | 123 | limit_check = cleaned_data.get('limit_date_check', False) |
115 | 124 | subject_id = cleaned_data.get('subject', None) |
116 | 125 | |
117 | - if begin_check or end_check: | |
126 | + if begin_check or end_check or limit_date: | |
118 | 127 | if not action: |
119 | 128 | self.add_error('action', _('This field is required.')) |
120 | 129 | |
... | ... | @@ -124,12 +133,27 @@ class PendenciesLimitedForm(forms.ModelForm): |
124 | 133 | if not end_date and end_check: |
125 | 134 | self.add_error('end_date', _('This field is required.')) |
126 | 135 | |
136 | + if not limit_date and limit_check: | |
137 | + self.add_error('limit_date', _('This field is required.')) | |
138 | + | |
127 | 139 | if begin_date and end_date: |
128 | 140 | if not begin_date == ValueError and not end_date == ValueError: |
129 | 141 | if begin_date > end_date: |
130 | 142 | self.add_error('begin_date', _('This input should be filled with a date equal or before the End Date.')) |
131 | 143 | self.add_error('end_date', _('This input should be filled with a date equal or after the Begin Date.')) |
132 | 144 | |
145 | + if begin_date and limit_date: | |
146 | + if not begin_date == ValueError and not limit_date == ValueError: | |
147 | + if begin_date > limit_date: | |
148 | + self.add_error('begin_date', _('This input should be filled with a date equal or before the Limit Date.')) | |
149 | + self.add_error('limit_date', _('This input should be filled with a date equal or after the Begin Date.')) | |
150 | + | |
151 | + if end_date and limit_date: | |
152 | + if not end_date == ValueError and not limit_date == ValueError: | |
153 | + if end_date > limit_date: | |
154 | + self.add_error('end_date', _('This input should be filled with a date equal or before the Limit Date.')) | |
155 | + self.add_error('limit_date', _('This input should be filled with a date equal or after the End Date.')) | |
156 | + | |
133 | 157 | if subject_id: |
134 | 158 | subject = Subject.objects.get(id = subject_id) |
135 | 159 | |
... | ... | @@ -153,4 +177,30 @@ class PendenciesLimitedForm(forms.ModelForm): |
153 | 177 | if end_date.date() > subject.end_date: |
154 | 178 | self.add_error('end_date', _('This input should be filled with a date equal or before the subject end date.')) |
155 | 179 | |
180 | + if not limit_date == ValueError and limit_date: | |
181 | + if not self.instance.id and limit_date.date() < datetime.datetime.today().date(): | |
182 | + self.add_error('limit_date', _("This input should be filled with a date equal or after today's date.")) | |
183 | + | |
184 | + if limit_date.date() < subject.init_date: | |
185 | + self.add_error('limit_date', _('This input should be filled with a date equal or after the subject begin date.')) | |
186 | + | |
187 | + if limit_date.date() > subject.end_date: | |
188 | + self.add_error('limit_date', _('This input should be filled with a date equal or before the subject end date.')) | |
189 | + | |
190 | + if limit_submission_date: | |
191 | + limit_submission_date = datetime.datetime.strptime(limit_submission_date, get_format('DATETIME_FORMAT')) | |
192 | + limit_submission_date = timezone.make_aware(limit_submission_date, timezone.get_current_timezone()) | |
193 | + | |
194 | + if not begin_date == ValueError and begin_date: | |
195 | + if begin_date > limit_submission_date: | |
196 | + self.add_error('begin_date', _('This input should be filled with a date equal or before the goals submission limit date.')) | |
197 | + | |
198 | + if not end_date == ValueError and end_date: | |
199 | + if end_date > limit_submission_date: | |
200 | + self.add_error('end_date', _('This input should be filled with a date equal or before the goals submission limit date.')) | |
201 | + | |
202 | + if not limit_date == ValueError and limit_date: | |
203 | + if limit_date > limit_submission_date: | |
204 | + self.add_error('limit_date', _('This input should be filled with a date equal or before the goals submission limit date.')) | |
205 | + | |
156 | 206 | return cleaned_data | ... | ... |
users/templates/users/login.html