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.initial 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.

