On Wed, Apr 20, 2011 at 11:48 AM, Daniel Gagnon <redalas...@gmail.com> wrote:
> So far, I have the following code:
> from django.forms.widgets import TextInput
> from django.forms.fields import Field
> class AutoCompleteWidget(TextInput):
>     def render(self, name, value, attrs=None):
>         if hasattr(value, 'name'):
>             v = value.name
>         else:
>             v = None
>         super(AutoCompleteWidget, self).render(self, name, v, attrs)
> class AutoCompleteField(Field):
>     widget = AutoCompleteWidget
>     def clean(self):
>         pass    # Not implemented yet
> class TicketForm(ModelForm):
>     target = AutoCompleteField()
>     class Meta:
>         model = Ticket
>         exclude = ('slug')
>
> When I use this code the whole form stops rendering! What's wrong with my
> widget?

Take out the self in the super call
(ie) Change this:

super(AutoCompleteWidget, self).render(self, name, v, attrs)

to this:

super(AutoCompleteWidget, self).render(name, v, attrs)

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to