##// END OF EJS Templates
Fixed the tests. Added exists() method for the post.
Fixed the tests. Added exists() method for the post.

File last commit:

r6:5fb6f373 default
r8:b62ef70f default
Show More
views.py
39 lines | 1.0 KiB | text/x-python | PythonLexer
neko259
Initial commit. One test doesn't work, missing posting form.
r0 from django.http import HttpResponse
neko259
Removed old views. Added a proper deletion of post with children.
r3 from boards.models import Post
neko259
Initial commit. One test doesn't work, missing posting form.
r0
def index(request):
neko259
Added methods for getting opening posts and threads.
r5 # TODO Show a real index page with all threads list
threads = Post.objects.get_threads()
neko259
Initial commit. One test doesn't work, missing posting form.
r0 return HttpResponse('Imageboard, motherfucker! Do you post to it?!')
neko259
Removed images directory. Removed old urls. Added a bit code for the views.
r4 def new_post(request):
"""Add a new post (in thread or as a reply)."""
neko259
Initial commit. One test doesn't work, missing posting form.
r0 title = request.POST['title']
text = request.POST['text']
image = request.POST['image']
neko259
Changed the url to the post page. Added one more TODO.
r6 # TODO Get tags list, download image (if link is given)
neko259
Removed old views. Added a proper deletion of post with children.
r3 post = Post.objects.create_post(title = title, text = text, image = image)
neko259
Removed images directory. Removed old urls. Added a bit code for the views.
r4
neko259
Added methods for getting opening posts and threads.
r5 # TODO Show the thread with a newly created post
neko259
Removed images directory. Removed old urls. Added a bit code for the views.
r4 def tag(request):
"""Get all tag threads (posts without a parent)."""
tag_name = request.GET['tag']
neko259
Added methods for getting opening posts and threads.
r5 posts = Post.objects.get_threads(tag = tag)
# TODO Send a response with the post list
neko259
Removed images directory. Removed old urls. Added a bit code for the views.
r4
neko259
Added methods for getting opening posts and threads.
r5 def thread(request):
"""Get all thread posts"""
opening_post_id = request.GET['id']
posts = Post.objects.get_thread(opening_post_id)
# TODO Show all posts for the current thread