Tsung,  what was the problem in your views.py?
I am working on this same problem.  Here is my views.py
-------------------------------------------------------------------------------------
 
@login_required
def bookmark_save_page(request):
    ajax = 'ajax' in request.GET
    if request.method == 'POST':
        form = BookmarkSaveForm(request.POST)
        if form.is_valid():
            bookmark = _bookmark_save(form)
            if ajax:
                variables = RequestContext (request,{
                    'bookmarks':[bookmark],
                    'show_edit': True,
                    'show_tags': True
                })
                return render_to_response('bookmark_list.html',variables)
            else:
                return HttpResponseRedirect('/user/%s' % 
request.user.username)
        else:
            if ajax:
                return HttpResponse(u'failure')
    elif 'url' in request.GET:
        url = request.GET['url']
        title = ''
        tags = ''
        try:
            link = Link.objects.get(url=url)
            bookmark = Bookmark.objects.get(link=link,user=request.user)
            title = bookmark.title
            tags = ' '.join(tag.name for tag in bookmark.tag_set.all())
        except (Link.DoesNotExist, Bookmark.DoesNotExist):
            pass
        form = BookmarkSaveForm({
            'url':url,
            'title':title,
            'tags':tags
        })
    else:
        form = BookmarkSaveForm()
    variables = RequestContext (request,{
        'form':form
    })
    if ajax:
        return render_to_response('bookmark_save_form.html',variables)
    else:
        return render_to_response('bookmark_save.html',variables)
-------------------------------------------------------------------------------------
 

Help from anyone is appreciated, I've been stuck on this too long.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/4ba7eDfberEJ.
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