comparison gpp/gcalendar/forms.py @ 228:d77e0dc772ad

Implement #88; add option to create a new forum thread from a new calendar entry.
author Brian Neal <bgneal@gmail.com>
date Sun, 11 Jul 2010 21:03:41 +0000
parents 7e3ed3eb9b99
children 88b2b9cb8c1f
comparison
equal deleted inserted replaced
227:423c39ee44e0 228:d77e0dc772ad
78 DEFAULT_END_TIME = '20:00' 78 DEFAULT_END_TIME = '20:00'
79 79
80 class Meta: 80 class Meta:
81 model = Event 81 model = Event
82 fields = ('what', 'start_date', 'start_time', 'end_date', 'end_time', 82 fields = ('what', 'start_date', 'start_time', 'end_date', 'end_time',
83 'all_day', 'time_zone', 'where', 'description') 83 'all_day', 'time_zone', 'where', 'description', 'create_forum_thread')
84 84
85 class Media: 85 class Media:
86 css = { 86 css = {
87 'all': (settings.GPP_THIRD_PARTY_CSS['markitup'] + 87 'all': (settings.GPP_THIRD_PARTY_CSS['markitup'] +
88 settings.GPP_THIRD_PARTY_CSS['jquery-ui'] + 88 settings.GPP_THIRD_PARTY_CSS['jquery-ui'] +
121 121
122 kwargs['initial'] = initial 122 kwargs['initial'] = initial
123 123
124 super(EventEntryForm, self).__init__(*args, **kwargs) 124 super(EventEntryForm, self).__init__(*args, **kwargs)
125 125
126 # We don't want the user to create a forum thread on an existing event
127 if instance is not None:
128 del self.fields['create_forum_thread']
129
126 def clean(self): 130 def clean(self):
127 start_date = self.cleaned_data.get('start_date') 131 start_date = self.cleaned_data.get('start_date')
128 start_time = self.cleaned_data.get('start_time') 132 start_time = self.cleaned_data.get('start_time')
129 all_day = self.cleaned_data.get('all_day') 133 all_day = self.cleaned_data.get('all_day')
130 end_date = self.cleaned_data.get('end_date') 134 end_date = self.cleaned_data.get('end_date')