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 | 24 | |
| 25 | 25 | self.fields['begin_date'].input_formats = datetime_formats |
| 26 | 26 | self.fields['end_date'].input_formats = datetime_formats |
| 27 | - | |
| 27 | + | |
| 28 | 28 | begin_date_check = forms.BooleanField(required = False) |
| 29 | 29 | end_date_check = forms.BooleanField(required = False) |
| 30 | - | |
| 30 | + | |
| 31 | 31 | class Meta: |
| 32 | 32 | model = Pendencies |
| 33 | 33 | fields = ['action', 'begin_date', 'end_date'] |
| ... | ... | @@ -99,11 +99,11 @@ class PendenciesLimitedForm(forms.ModelForm): |
| 99 | 99 | self.fields['begin_date'].input_formats = datetime_formats |
| 100 | 100 | self.fields['end_date'].input_formats = datetime_formats |
| 101 | 101 | self.fields['limit_date'].input_formats = datetime_formats |
| 102 | - | |
| 102 | + | |
| 103 | 103 | begin_date_check = forms.BooleanField(required = False) |
| 104 | 104 | end_date_check = forms.BooleanField(required = False) |
| 105 | 105 | limit_date_check = forms.BooleanField(required = False) |
| 106 | - | |
| 106 | + | |
| 107 | 107 | class Meta: |
| 108 | 108 | model = Pendencies |
| 109 | 109 | fields = ['action', 'begin_date', 'end_date', 'limit_date'] |
| ... | ... | @@ -144,13 +144,13 @@ class PendenciesLimitedForm(forms.ModelForm): |
| 144 | 144 | |
| 145 | 145 | if begin_date and limit_date: |
| 146 | 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 | 148 | self.add_error('begin_date', _('This input should be filled with a date equal or before the Limit Date.')) |
| 149 | 149 | self.add_error('limit_date', _('This input should be filled with a date equal or after the Begin Date.')) |
| 150 | 150 | |
| 151 | 151 | if end_date and limit_date: |
| 152 | 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 | 154 | self.add_error('end_date', _('This input should be filled with a date equal or before the Limit Date.')) |
| 155 | 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 | 192 | limit_submission_date = timezone.make_aware(limit_submission_date, timezone.get_current_timezone()) |
| 193 | 193 | |
| 194 | 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 | 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 | 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 | 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 | 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 | 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 | 206 | return cleaned_data | ... | ... |
subjects/forms.py
| ... | ... | @@ -172,14 +172,14 @@ class UpdateSubjectForm(forms.ModelForm): |
| 172 | 172 | |
| 173 | 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 | 184 | def clean_subscribe_end(self): |
| 185 | 185 | subscribe_end = self.cleaned_data['subscribe_end'] | ... | ... |