Hi Jeremy

This is the definition

Thanks

Cat

class SurveyForm(forms.Form):

        survey_name = forms.CharField(required = True)
        associated_company = forms.ModelChoiceField(queryset =
Company.objects.all(), required = True)
        operator = forms.ModelChoiceField(queryset = Operator.objects.all(),
required = False)
        contractor = forms.ModelChoiceField(queryset =
Contractor.objects.all(), required = False)
        vessel = forms.ModelChoiceField(queryset = Vessel.objects.all(),
required = False)
        survey_type = forms.ModelChoiceField(queryset =
SurveyType.objects.all(), required = True)
        location = forms.CharField(required = True)
        start_date = forms.DateField(required = True)
        end_date = forms.DateField(required = False)
        notes = forms.CharField(widget = forms.Textarea(), required = False)

        def __init__(self, data = None, auto_id = 'id_%s', prefix = None,
initial = None, instance = None):

                if instance is not None:
                        self.instance = instance
                        data = instance_dict(instance)
                else:
                        self.instance = None
                super(SurveyForm, self).__init__(data = data, auto_id = auto_id,
prefix = prefix, initial = initial)

        def save(self, commit = True):
                if self.instance is not None:
                        instance = self.instance
                else:
                        instance = Survey()

                instance.survey_type = self.cleaned_data['survey_type']
                instance.associated_company =
self.cleaned_data['associated_company']
                instance.operator = self.cleaned_data['operator']
                instance.contractor = self.cleaned_data['contractor']
                instance.vessel = self.cleaned_data['vessel']
                instance.survey_name = self.cleaned_data['survey_name']
                instance.location = self.cleaned_data['location']
                instance.start_date = self.cleaned_data['start_date']
                instance.end_date = self.cleaned_data['end_date']

                if commit:
                        instance.save()
                return instance


On Oct 12, 11:48 am, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote:
> On 10/11/07, Cat <[EMAIL PROTECTED]> wrote:
>
> > Can anyone tell me why when I get to the line - form =
> > InstanceForm(request.POST) in the following view (stepping through the
> > code), I get a Type Error SurveyForm object is not callable. My
> > understanding is that it should be as it subclasses Form
>
> What is the definition of SurveyForm?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to