fixed form broken by change to TZ aware times

pull/1/head
eric 2012-03-23 12:29:38 -04:00
parent 6237fcebfe
commit e4fc2621df
1 changed files with 3 additions and 3 deletions

View File

@ -14,7 +14,7 @@ from selectable.forms import AutoCompleteSelectWidget,AutoCompleteSelectField
from regluit.core.models import UserProfile, RightsHolder, Claim, Campaign, Premium, Ebook
from regluit.core.lookups import OwnerLookup
from regluit.utils.localdatetime import date_today
from regluit.utils.localdatetime import now
import logging
@ -160,9 +160,9 @@ class ManageCampaignForm(forms.ModelForm):
if self.instance:
if self.instance.status == 'ACTIVE' and self.instance.deadline != new_deadline:
raise forms.ValidationError(_('The closing date for an ACTIVE campaign cannot be changed.'))
if new_deadline-date_today() > timedelta(days=int(settings.UNGLUEIT_LONGEST_DEADLINE)):
if new_deadline - now() > timedelta(days=int(settings.UNGLUEIT_LONGEST_DEADLINE)):
raise forms.ValidationError(_('The chosen closing date is more than %s days from now' % settings.UNGLUEIT_LONGEST_DEADLINE))
elif new_deadline-date_today() < timedelta(days=int(settings.UNGLUEIT_SHORTEST_DEADLINE)):
elif new_deadline - now() < timedelta(days=int(settings.UNGLUEIT_SHORTEST_DEADLINE)):
raise forms.ValidationError(_('The chosen closing date is less than %s days from now' % settings.UNGLUEIT_SHORTEST_DEADLINE))
return new_deadline