Mercurial > public > sg101
diff gpp/gcalendar/forms.py @ 198:7e3ed3eb9b99
Fix #71: problems with editing existing gcalendar dates; the date format wasn't what the datepicker expected.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sun, 11 Apr 2010 17:58:09 +0000 |
parents | 5b69d6e01fd4 |
children | d77e0dc772ad |
line wrap: on
line diff
--- a/gpp/gcalendar/forms.py Sat Apr 10 04:32:24 2010 +0000 +++ b/gpp/gcalendar/forms.py Sun Apr 11 17:58:09 2010 +0000 @@ -72,6 +72,7 @@ description = forms.CharField(required=False, widget=forms.Textarea(attrs={'class': 'markItUp smileyTarget'})) + DATE_FORMAT = '%m/%d/%Y' # must match the jQuery UI datepicker config TIME_FORMAT = '%H:%M' DEFAULT_START_TIME = '19:00' DEFAULT_END_TIME = '20:00' @@ -97,7 +98,7 @@ if len(args) == 0: # no POST arguments if instance is None: - init_day = datetime.date.today().strftime('%m/%d/%Y') + init_day = datetime.date.today().strftime(self.DATE_FORMAT) if 'start_date' not in initial: initial['start_date'] = init_day if 'end_date' not in initial: @@ -107,6 +108,8 @@ if 'end_time' not in initial: initial['end_time'] = self.DEFAULT_END_TIME else: + initial['start_date'] = instance.start_date.strftime(self.DATE_FORMAT) + initial['end_date'] = instance.end_date.strftime(self.DATE_FORMAT) if instance.all_day: initial['start_time'] = self.DEFAULT_START_TIME initial['end_time'] = self.DEFAULT_END_TIME