On Wed, 2008-08-27 at 01:42 -0700, patrickk wrote:
> I´m just trying to write a custom field for the django filebrowser (a
> filebrowsefield). the __init__ method of the form-field is called, but
> the clean method is not ... instead the clean method of
> forms.CharField is called, which is strange, because a) I´ve made a
> model field (FileBrowseField) with defaults = {'form_class':
> FileBrowseFormField(attrs=attrs)} and b) the FileBrowseFormFields
> __init__ method is called.

[..]
> THE FILEBROWSEFIELD:
> class FileBrowseField(Field):
[...]
>     def formfield(self, **kwargs):
>         attrs = {}
>         attrs["initial_directory"] = self.initial_directory
>         attrs["extensions_allowed"] = self.extensions_allowed
>         defaults = {'max_length': self.max_length}
>         defaults = {'form_class': FileBrowseFormField(attrs=attrs)}
>         defaults = {'widget': FileBrowseWidget(attrs=attrs)}

These lines keep declaring a new dictionary every time. So the final
"defaults" variable won't contain "form_class".

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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