Commit c7805dda46016f4ab07f7742b9e10d72ee57232c
1 parent
12df15dd
Exists in
master
and in
2 other branches
resolvendo problema com minutos na data de inicio de resourses e update subject
Showing
2 changed files
with
17 additions
and
17 deletions
Show diff stats
pendencies/forms.py
| @@ -24,10 +24,10 @@ class PendenciesForm(forms.ModelForm): | @@ -24,10 +24,10 @@ class PendenciesForm(forms.ModelForm): | ||
| 24 | 24 | ||
| 25 | self.fields['begin_date'].input_formats = datetime_formats | 25 | self.fields['begin_date'].input_formats = datetime_formats |
| 26 | self.fields['end_date'].input_formats = datetime_formats | 26 | self.fields['end_date'].input_formats = datetime_formats |
| 27 | - | 27 | + |
| 28 | begin_date_check = forms.BooleanField(required = False) | 28 | begin_date_check = forms.BooleanField(required = False) |
| 29 | end_date_check = forms.BooleanField(required = False) | 29 | end_date_check = forms.BooleanField(required = False) |
| 30 | - | 30 | + |
| 31 | class Meta: | 31 | class Meta: |
| 32 | model = Pendencies | 32 | model = Pendencies |
| 33 | fields = ['action', 'begin_date', 'end_date'] | 33 | fields = ['action', 'begin_date', 'end_date'] |
| @@ -99,11 +99,11 @@ class PendenciesLimitedForm(forms.ModelForm): | @@ -99,11 +99,11 @@ class PendenciesLimitedForm(forms.ModelForm): | ||
| 99 | self.fields['begin_date'].input_formats = datetime_formats | 99 | self.fields['begin_date'].input_formats = datetime_formats |
| 100 | self.fields['end_date'].input_formats = datetime_formats | 100 | self.fields['end_date'].input_formats = datetime_formats |
| 101 | self.fields['limit_date'].input_formats = datetime_formats | 101 | self.fields['limit_date'].input_formats = datetime_formats |
| 102 | - | 102 | + |
| 103 | begin_date_check = forms.BooleanField(required = False) | 103 | begin_date_check = forms.BooleanField(required = False) |
| 104 | end_date_check = forms.BooleanField(required = False) | 104 | end_date_check = forms.BooleanField(required = False) |
| 105 | limit_date_check = forms.BooleanField(required = False) | 105 | limit_date_check = forms.BooleanField(required = False) |
| 106 | - | 106 | + |
| 107 | class Meta: | 107 | class Meta: |
| 108 | model = Pendencies | 108 | model = Pendencies |
| 109 | fields = ['action', 'begin_date', 'end_date', 'limit_date'] | 109 | fields = ['action', 'begin_date', 'end_date', 'limit_date'] |
| @@ -144,13 +144,13 @@ class PendenciesLimitedForm(forms.ModelForm): | @@ -144,13 +144,13 @@ class PendenciesLimitedForm(forms.ModelForm): | ||
| 144 | 144 | ||
| 145 | if begin_date and limit_date: | 145 | if begin_date and limit_date: |
| 146 | if not begin_date == ValueError and not limit_date == ValueError: | 146 | if not begin_date == ValueError and not limit_date == ValueError: |
| 147 | - if begin_date > limit_date: | 147 | + if begin_date.date() > limit_date.date(): |
| 148 | self.add_error('begin_date', _('This input should be filled with a date equal or before the 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.')) | 149 | self.add_error('limit_date', _('This input should be filled with a date equal or after the Begin Date.')) |
| 150 | 150 | ||
| 151 | if end_date and limit_date: | 151 | if end_date and limit_date: |
| 152 | if not end_date == ValueError and not limit_date == ValueError: | 152 | if not end_date == ValueError and not limit_date == ValueError: |
| 153 | - if end_date > limit_date: | 153 | + if end_date.date() > limit_date.date(): |
| 154 | self.add_error('end_date', _('This input should be filled with a date equal or before the 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.')) | 155 | self.add_error('limit_date', _('This input should be filled with a date equal or after the End Date.')) |
| 156 | 156 | ||
| @@ -192,15 +192,15 @@ class PendenciesLimitedForm(forms.ModelForm): | @@ -192,15 +192,15 @@ class PendenciesLimitedForm(forms.ModelForm): | ||
| 192 | limit_submission_date = timezone.make_aware(limit_submission_date, timezone.get_current_timezone()) | 192 | limit_submission_date = timezone.make_aware(limit_submission_date, timezone.get_current_timezone()) |
| 193 | 193 | ||
| 194 | if not begin_date == ValueError and begin_date: | 194 | if not begin_date == ValueError and begin_date: |
| 195 | - if begin_date > limit_submission_date: | 195 | + if begin_date.date() > limit_submission_date.date(): |
| 196 | self.add_error('begin_date', _('This input should be filled with a date equal or before the goals submission limit date.')) | 196 | self.add_error('begin_date', _('This input should be filled with a date equal or before the goals submission limit date.')) |
| 197 | 197 | ||
| 198 | if not end_date == ValueError and end_date: | 198 | if not end_date == ValueError and end_date: |
| 199 | - if end_date > limit_submission_date: | 199 | + if end_date.date() > limit_submission_date.date(): |
| 200 | self.add_error('end_date', _('This input should be filled with a date equal or before the goals submission limit date.')) | 200 | self.add_error('end_date', _('This input should be filled with a date equal or before the goals submission limit date.')) |
| 201 | 201 | ||
| 202 | if not limit_date == ValueError and limit_date: | 202 | if not limit_date == ValueError and limit_date: |
| 203 | - if limit_date > limit_submission_date: | 203 | + if limit_date.date() > limit_submission_date.date(): |
| 204 | self.add_error('limit_date', _('This input should be filled with a date equal or before the goals submission limit date.')) | 204 | self.add_error('limit_date', _('This input should be filled with a date equal or before the goals submission limit date.')) |
| 205 | 205 | ||
| 206 | return cleaned_data | 206 | return cleaned_data |
subjects/forms.py
| @@ -172,14 +172,14 @@ class UpdateSubjectForm(forms.ModelForm): | @@ -172,14 +172,14 @@ class UpdateSubjectForm(forms.ModelForm): | ||
| 172 | 172 | ||
| 173 | return name | 173 | return name |
| 174 | 174 | ||
| 175 | - def clean_subscribe_begin(self): | ||
| 176 | - subscribe_begin = self.cleaned_data['subscribe_begin'] | ||
| 177 | - | ||
| 178 | - if subscribe_begin < datetime.datetime.today().date() and subscribe_begin < self.instance.subscribe_begin: | ||
| 179 | - self._errors['subscribe_begin'] = [_('This date must be today or after')] | ||
| 180 | - return ValueError | ||
| 181 | - | ||
| 182 | - return subscribe_begin | 175 | + # def clean_subscribe_begin(self): |
| 176 | + # subscribe_begin = self.cleaned_data['subscribe_begin'] | ||
| 177 | + # | ||
| 178 | + # if subscribe_begin < datetime.datetime.today().date() and subscribe_begin < self.instance.subscribe_begin: | ||
| 179 | + # self._errors['subscribe_begin'] = [_('This date must be today or after')] | ||
| 180 | + # return ValueError | ||
| 181 | + # | ||
| 182 | + # return subscribe_begin | ||
| 183 | 183 | ||
| 184 | def clean_subscribe_end(self): | 184 | def clean_subscribe_end(self): |
| 185 | subscribe_end = self.cleaned_data['subscribe_end'] | 185 | subscribe_end = self.cleaned_data['subscribe_end'] |