Project

General

Profile

« Previous | Next » 

Revision 8da5a7b6

Added by Serghei Mihai over 10 years ago

prototype of editing group absences

View differences:

calebasse/personnes/forms.py
232 232
    def __init__(self, *args, **kwargs):
233 233
        self.service = kwargs.pop('service', None)
234 234
        super(GroupHolidayForm, self).__init__(*args, **kwargs)
235
        self.fields['service'].choices = ((service.id, service.name) for service in Service.objects.all())
235 236
        if self.instance and self.instance.id:
236 237
            self.initial['for_all_services'] = self.instance.service is None
237 238
        self.fields['holiday_type'].queryset = \
......
249 250
        return instance
250 251

  
251 252
    class Meta:
252
        form = Holiday
253
        model = Holiday
253 254
        widgets = {
254
                'comment': forms.Textarea(attrs={'rows': 3}),
255
            'comment': forms.Textarea(attrs = {'rows': 3, 'cols': 18}),
256
            'service': forms.CheckboxSelectMultiple(attrs = {'class': ''})
255 257
        }
256 258

  
257 259
GroupHolidayFormSet = modelformset_factory(Holiday,

Also available in: Unified diff