I'm trying to use django-tagging in my application but when
I generate
a form with "form_for_model" from a model which
contains a TagField I
get this error message:
TypeError at /bookmarks/add/
__init__() got an unexpected keyword argument 'form_class'
Request Method: GET
Request URL: http://localhost
:8080/bookmarks/add/
Exception Type: TypeError
Exception Value: __init__() got an unexpected keyword
argument
'form_class'
Exception Location:
/usr/lib/python2.5/site-packages/django/newforms/
fields.py in __init__, line 92
Traceback:
/usr/lib/python2.5/site-packages/django/core/handlers/base.p
y in
get_response
77. response = callback(request, *callback_args,
**callback_kwargs)
/usr/lib/python2.5/site-packages/django/newforms/models.py
in
form_for_model
73. formfield = formfield_callback(f)
/usr/lib/python2.5/site-packages/django/newforms/models.py
in
58. def form_for_model(model, form=BaseForm,
formfield_callback=lambda
f: f.formfield()):
/usr/lib/python2.5/site-packages/django/db/models/fields/__i
nit__.py
in formfield
429. return forms.CharField(**defaults)
/usr/lib/python2.5/site-packages/django/newforms/fields.py
in __init__
92. super(CharField, self).__init__(*args, **kwargs)
models.py:
class Bookmark(models.Model):
title = models.CharField(maxlength=255)
url = models.URLField(verify_exists=True)
description = models.TextField(blank=True)
owner = models.ForeignKey(User)
tags = TagField()
urls.py:
bookmark_list = {
'queryset' : Bookmark.objects.all(),
'allow_empty': True,
}
urlpatterns = patterns('',
(r'^$', list_detail.object_list, bookmark_list),
(r'^add/$', bookmark_add),
)
views.py:
def bookmark_add(request):
BookmarkForm = forms.models.form_for_model(Bookmark)
form = BookmarkForm()
template = "bookmarks/bookmark_add.html"
context = {
'form': form,
}
return render_to_response(template, context)
It works to add bookmarks with tags from within the admin
panel.
Python version: 2.5.1
Django version: 0.96
django-tagging version: 0.1
I'm sure I have missed something fundamental since I'm new
to Django,
but if someone could guide me to some documentation or
explain the
error I would be grateful.
Thanks!
Erik Nordlund
--~--~---------~--~----~------------~-------~--~----~
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-unsubscribe googlegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|