def add(self): form = BookmarkForm(request.REQUEST) if not form.is_valid(): ajax_response = { 'rc': 1, 'response': form.errors.as_text(), } return HttpResponse(simplejson.dumps(ajax_response)) form.save() return HttpResponse(simplejson.dumps(self.ajax_response))
def render_form(self): query = request.GET.copy() query['a'] = 'add' form = BookmarkForm(initial=query) form.populate(user = request.user) return HttpResponse(form.as_p())