Hi Tom, thanks for the link, in case of 'datetime.date.today' the callable makes a lot of sense.
I changed my class field so that the value is not more a class definition, now it is wrapped by some kind of a proxy instance to avoid the callable effect. -- Best Regards Sven On Thursday 05 January 2012 10:20:37 Tom Evans wrote: > On Wed, Jan 4, 2012 at 5:25 PM, sassman <[email protected]> wrote: > > Hi, > > > > i'm using Django Version 1.3.1, can anyone say me why is the value > > function in BoundField (FormField) makes a check if the value is > > callable? > > > > def value(self): > > """ > > Returns the value for this BoundField, using the initial value > > if > > the form is not bound or the data otherwise. > > """ > > if not self.form.is_bound: > > data = self.form.initial.get(self.name, > > self.field.initial) > > if callable(data): > > data = data() > > > > > > I have a Field that encapsulates a Python Class, and this leads into a > > problem because the value (a class definition) will be instatiated at > > this time. But for a Dropdown field (wrapped by the TypedChoiceField > > Field) this is not a neccessary action. > > > > Can anyone say me what is the reason for having a datavalue callable > > and call it on a field? > > > > BR Sven > > It is documented here: > > https://docs.djangoproject.com/en/1.3/ref/forms/fields/#django.forms.Field.i > nitial > > Cheers > > Tom -- 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.

