New issue 6 by g...@nott.cc: Bookmarks cannot be added with Django 1.2
http://code.google.com/p/django-bookmarks/issues/detail?id=6
What steps will reproduce the problem?
* Use django-bookmarks with Django 1.2 (with Pinax 0.9a also)
* Try to add a bookmark
What is the expected output? What do you see instead?
* After clicking "add new bookmark" button I get an exception caused by
line 23 of forms.py module. The reason of exception: function clean returns
None, while an iterable is expected. I cannot provide the stack trace at
the moment, please let me know if you need it.
=== forms.py ===
21 def clean(self):
22 if 'url' not in self.cleaned_data:
23 return
24 if
BookmarkInstance.objects.filter(bookmark__url=self.cleaned_data['url'],
user=self.user).count() > 0:
25 raise forms.ValidationError(_("You have already bookmarked
this link."))
26 return self.cleaned_data
* When the error above is fixed, it's still impossible to add a new
bookmark, as the form isn't validated (there is no error message, the form
is just displayed once again). The fields that cannot be validated are
BookmarkInstance.user and BookmarkInstance.bookmark
What version of the product are you using? On what operating system?
django-bookmarks 0.1.0, Django 1.2, Python 2.6
Operating system: openSUSE 11.3
Please provide any additional information below.
A patch is attached, The proposed solution doesn't seem to be pure, but it
won't require lots of changes. Another approach (with widgets) can also be
applied.
Attachments:
bookmarks-django1.2.patch 730 bytes
> When the error above is fixed, it's still impossible to add a new
> bookmark,
> as the form isn't validated (there is no error message, the form is just
> displayed
> once again). The fields that cannot be validated are BookmarkInstance.user
> and BookmarkInstance.bookmark
This problem is caused by the user value which is expected by the form
validator, but not present in the submitted data.
Uncommenting the following line in bookmarks/forms.py solves the problem.
The side effects are not throughly checked though...
#fields = ('url', 'description', 'note', 'redirect')