def index(request): data = wrap_data_forum(request) site = data["site"] forums = site.forums.all() data["forums"] = forums response = _r("forum/index.html", data) return response
def index(request): data = wrap_data_forum(request) site = data['site'] forums = site.forums.all() data['forums'] = forums response = _r('forum/index.html', data) return response
def thread(request, tid=None): thread = get_object_or_404(ForumThread, id=tid) data = wrap_data_forum(request) data.update(csrf(request)) message_creation_form = MessageCreationForm() data["message_creation_form"] = message_creation_form data["thread"] = thread response = _r("forum/thread.html", data) return response
def thread(request, tid=None): thread = get_object_or_404(ForumThread, id=tid) data = wrap_data_forum(request) data.update(csrf(request)) message_creation_form = MessageCreationForm() data['message_creation_form'] = message_creation_form data['thread'] = thread response = _r('forum/thread.html', data) return response
def forum(request, fid): data = wrap_data_forum(request) forum = get_object_or_404(Forum, id=fid) data.update(csrf(request)) data["forum"] = forum thread_creation_form = ThreadCreationForm() data["thread_creation_form"] = thread_creation_form data["threads"] = forum.threads.order_by("sticky", "-updated") response = _r("forum/forum.html", data) return response
def forum(request, fid): data = wrap_data_forum(request) forum = get_object_or_404(Forum, id=fid) data.update(csrf(request)) data['forum'] = forum thread_creation_form = ThreadCreationForm() data['thread_creation_form'] = thread_creation_form data['threads'] = forum.threads.order_by('sticky', '-updated') response = _r('forum/forum.html', data) return response
def message_create(request, tid=None): thread = get_object_or_404(ForumThread, id=tid) data = wrap_data_forum(request) data["thread"] = thread user = data["user"] data.update(csrf(request)) success = False if request.method == "POST": message_creation_form = MessageCreationForm(request.POST) if message_creation_form.is_valid(): message = message_creation_form.save(author=user, thread=thread) success = True else: for error in auth_form.non_field_errors(): data["errors"].append(error) else: message_creation_form = MessageCreationForm(None) if success: response = redirect(reverse("forum_thread", args=(thread.id,))) else: data["message_creation_form"] = message_creation_form response = _r("forum/message_create.html", data) return response
def thread_create(request, fid=None): forum = get_object_or_404(Forum, id=fid) data = wrap_data_forum(request) user = data["user"] data.update(csrf(request)) data["forum"] = forum success = False if request.method == "POST": thread_creation_form = ThreadCreationForm(request.POST) if thread_creation_form.is_valid(): thread = thread_creation_form.save(author=user, forum=forum) success = True else: for error in thread_creation_form.non_field_errors(): data["errors"].append(error) else: thread_creation_form = ThreadCreationForm(None) if success: response = redirect(reverse("forum_thread", args=(thread.id,))) else: data["forms"].append(thread_creation_form) data["thread_creation_form"] = thread_creation_form response = _r("forum/thread_create.html", data) return response
def message_create(request, tid=None): thread = get_object_or_404(ForumThread, id=tid) data = wrap_data_forum(request) data['thread'] = thread user = data['user'] data.update(csrf(request)) success = False if request.method == 'POST': message_creation_form = MessageCreationForm(request.POST) if message_creation_form.is_valid(): message = message_creation_form.save(author=user, thread=thread) success = True else: for error in auth_form.non_field_errors(): data['errors'].append(error) else: message_creation_form = MessageCreationForm(None) if success: response = redirect(reverse('forum_thread', args=(thread.id, ))) else: data['message_creation_form'] = message_creation_form response = _r('forum/message_create.html', data) return response
def thread_create(request, fid=None): forum = get_object_or_404(Forum, id=fid) data = wrap_data_forum(request) user = data['user'] data.update(csrf(request)) data['forum'] = forum success = False if request.method == 'POST': thread_creation_form = ThreadCreationForm(request.POST) if thread_creation_form.is_valid(): thread = thread_creation_form.save(author=user, forum=forum) success = True else: for error in thread_creation_form.non_field_errors(): data['errors'].append(error) else: thread_creation_form = ThreadCreationForm(None) if success: response = redirect(reverse('forum_thread', args=(thread.id, ))) else: data['forms'].append(thread_creation_form) data['thread_creation_form'] = thread_creation_form response = _r('forum/thread_create.html', data) return response