##// END OF EJS Templates
Changed the url to the post page. Added one more TODO.
neko259 -
r6:5fb6f373 default
parent child Browse files
Show More
@@ -1,14 +1,14 b''
1 1 from django.conf.urls import patterns, url
2 2 from boards import views
3 3
4 4 urlpatterns = patterns('',
5 5 # /boards/
6 6 url(r'^$', views.index, name = 'index'),
7 7 # /boards/tag/
8 8 url(r'^(?P<tag>\w+)/$', views.tag, name = 'tag'),
9 9 # /boards/post_id/
10 10 url(r'^(?P<post>\w+)/$', views.thread, name = 'thread'),
11 11 # /boards/tag/post/
12 url(r'^(?P<tag>\w+)/post.html$', views.new_post,
12 url(r'^post.html$', views.new_post,
13 13 name='post'),
14 14 )
@@ -1,38 +1,40 b''
1 1 from django.http import HttpResponse
2 2
3 3 from boards.models import Post
4 4
5 5 def index(request):
6 6 # TODO Show a real index page with all threads list
7 7 threads = Post.objects.get_threads()
8 8
9 9 return HttpResponse('Imageboard, motherfucker! Do you post to it?!')
10 10
11 11 def new_post(request):
12 12 """Add a new post (in thread or as a reply)."""
13 13
14 14 title = request.POST['title']
15 15 text = request.POST['text']
16 16
17 17 image = request.POST['image']
18 18
19 # TODO Get tags list, download image (if link is given)
20
19 21 post = Post.objects.create_post(title = title, text = text, image = image)
20 22
21 23 # TODO Show the thread with a newly created post
22 24
23 25 def tag(request):
24 26 """Get all tag threads (posts without a parent)."""
25 27
26 28 tag_name = request.GET['tag']
27 29
28 30 posts = Post.objects.get_threads(tag = tag)
29 31
30 32 # TODO Send a response with the post list
31 33
32 34 def thread(request):
33 35 """Get all thread posts"""
34 36
35 37 opening_post_id = request.GET['id']
36 38 posts = Post.objects.get_thread(opening_post_id)
37 39
38 40 # TODO Show all posts for the current thread No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now