- {% autoescape off %}
- {{ image.get_view }}
- {% endautoescape %}
+ {{ image.get_view|safe }}
{% with image.get_random_associated_post as post %}
{{ post.get_link_view|safe }}
diff --git a/boards/urls.py b/boards/urls.py
--- a/boards/urls.py
+++ b/boards/urls.py
@@ -15,6 +15,7 @@ from boards.views.random import RandomIm
from boards.views.tag_gallery import TagGalleryView
from boards.views.translation import cached_javascript_catalog
from boards.views.search import BoardSearchView
+from boards.views.landing import LandingView
js_info_dict = {
@@ -23,7 +24,7 @@ js_info_dict = {
urlpatterns = [
# /boards/
- url(r'^$', all_threads.AllThreadsView.as_view(), name='index'),
+ url(r'^all/$', all_threads.AllThreadsView.as_view(), name='index'),
# /boards/tag/tag_name/
url(r'^tag/(?P\w+)/$', tag_threads.TagView.as_view(),
@@ -51,6 +52,7 @@ urlpatterns = [
url(r'^random/$', RandomImageView.as_view(), name='random'),
url(r'^tag/(?P\w+)/gallery/$', TagGalleryView.as_view(), name='tag_gallery'),
url(r'^search/$', BoardSearchView.as_view(), name='search'),
+ url(r'^$', LandingView.as_view(), name='landing'),
# RSS feeds
url(r'^rss/$', AllThreadsFeed()),
diff --git a/boards/views/landing.py b/boards/views/landing.py
new file mode 100644
--- /dev/null
+++ b/boards/views/landing.py
@@ -0,0 +1,32 @@
+from django.shortcuts import render
+from django.utils.decorators import method_decorator
+from django.views.decorators.csrf import csrf_protect
+
+from boards.views.base import BaseBoardView
+from boards.models import Tag, Post, Attachment
+
+
+PARAM_SECTION_STR = 'section_str'
+PARAM_LATEST_THREADS = 'latest_threads'
+PARAM_IMAGES = 'images'
+
+TEMPLATE = 'boards/landing.html'
+
+MAX_NEW_THREADS = 10
+RANDOM_IMAGE_COUNT = 3
+
+
+class LandingView(BaseBoardView):
+ @method_decorator(csrf_protect)
+ def get(self, request):
+ params = dict()
+
+ params[PARAM_SECTION_STR] = Tag.objects.get_tag_url_list(
+ Tag.objects.filter(required=True))
+ params[PARAM_LATEST_THREADS] = Post.objects.filter(opening=True)\
+ .order_by('-pub_time')[:MAX_NEW_THREADS]
+ params[PARAM_IMAGES] = Attachment.objects.get_random_images(
+ RANDOM_IMAGE_COUNT)
+
+ return render(request, TEMPLATE, params)
+