Examples:
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
What specific problems/errors are you experiencing?
http://docs.djangoproject.com/en/1.3/howto/custom-model-fields/
What specific problems/errors are you experiencing?
--
I'm trying to create a Form Field, not a Model Field.The doc about creating a custom one is a tiny paragraph at the end of this page: http://docs.djangoproject.com/en/1.3/ref/forms/fields/I read the source code of django but I'm having trouble even finding where exactly is the value stored in the field.
- The field is going to receive an object and should render the name property of that object in html (so far, I can only render the id).
- The page is going to POST a string containing the name of the object (unique), it should be converted back to an object.
--
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)
Could you also include the model?
It probably is related to the this being a foreign key field and in
order for it to produce a valid object instance from the Target model,
it needs a queryset. Try to subclass from ModelChoiceField[1] and see
if that works.
[1] http://code.djangoproject.com/browser/django/trunk/django/forms/models.py#L891
It probably is related to the this being a foreign key field and in
order for it to produce a valid object instance from the Target model,
it needs a queryset. Try to subclass from ModelChoiceField[1] and see
if that works.
[1] http://code.djangoproject.com/browser/django/trunk/django/forms/models.py#L891
The first one uses a jquery plugin that's discontinued and the second one works only in the admin.