def add_super_form_note(request, ajax=None): if request.method == 'POST': blog_object = Blog.objects.select_related().get_or_create(user=request.user) form = SuperForm(request.POST) if form.is_valid(): post = Post() post.author = blog_object[0] post.body = form.cleaned_data["body"] txt = " ".join(post.body.split(' '))[:50] if form.cleaned_data["related_film"]: post.title = _('Review') + ": " + form.cleaned_data["related_film"][0].title post.title = post.title[:200] permalink = slughifi(post.title + " " + txt) else: post.title = _('Review') +": " + txt post.title = post.title[:200] permalink = slughifi(post.title[:128]) post.type = Post.TYPE_POST post.status = Post.PUBLIC_STATUS post.save(permalink=permalink) for film in form.cleaned_data["related_film"]:post.related_film.add(film) if ajax=="json": context = { 'success': True, 'data': post.id, } return json_return(context) else: return HttpResponseRedirect(full_url("PLANET")) else: if ajax == "json": context = { 'success': False, 'errors': str(form.errors), } return JSONResponse(context, is_iterable=False) else: return HttpResponseRedirect(full_url("PLANET"))