def report(request, post_id): post = get_object_or_404(Post, id=post_id) form = build_form(ReportForm, request, reported_by=request.user, post=post_id) if request.method == 'POST' and form.is_valid(): form.save() return HttpResponseRedirect(post.get_absolute_url()) return {'form':form}
def profile(request): form = build_form(ForumProfileForm, request, instance=request.user) if request.method == 'POST' and form.is_valid(): form.save() return HttpResponseRedirect(reverse('djangobb:index')) return {'active_menu':'privacy', 'form': form, 'TEMPLATE': 'djangobb_forum/profile/profile_privacy.html' }
def edit_post(request, post_id): from templatetags.forum_extras import forum_editable_by post = get_object_or_404(Post, pk=post_id) if forum_settings.POST_MODIF_DEATHLINE and \ (datetime.now() - post.created).seconds > forum_settings.POST_MODIF_DEATHLINE: return HttpResponseRedirect(post.get_absolute_url()) topic = post.topic if not forum_editable_by(post, request.user): return HttpResponseRedirect(post.get_absolute_url()) form = build_form(EditPostForm, request, topic=topic, instance=post) if form.is_valid(): post = form.save(commit=False) post.updated_by = request.user post.save() return HttpResponseRedirect(post.get_absolute_url()) return { 'form': form, 'post': post, }