from django.shortcuts import render
+from organization.magazine.models import Article
+from organization.core.views import SlugMixin
# Create your views here.
+class ArticleDetailView(SlugMixin, DetailView):
+
+ model = Article
+ template_name='magazine/article/article_detail.html'
+ context_object_name = 'article'
+
+ def get_context_data(self, **kwargs):
+ context = super(ArticleDetailView, self).get_context_data(**kwargs)
+ return context
+
+
+def blog_post_detail(request, slug, year=None, month=None, day=None,
+ template="blog/blog_post_detail.html",
+ extra_context=None):
+ """. Custom templates are checked for using the name
+ ``blog/blog_post_detail_XXX.html`` where ``XXX`` is the blog
+ posts's slug.
+ """
+ blog_posts = BlogPost.objects.published(
+ for_user=request.user).select_related()
+ blog_post = get_object_or_404(blog_posts, slug=slug)
+ related_posts = blog_post.related_posts.published(for_user=request.user)
+ context = {"blog_post": blog_post, "editable_obj": blog_post,
+ "related_posts": related_posts}
+ context.update(extra_context or {})
+ templates = [u"blog/blog_post_detail_%s.html" % str(slug), template]
+ return TemplateResponse(request, templates, context)
--- /dev/null
+{% extends "blog/blog_post_list.html" %}
+{% load mezzanine_tags comment_tags keyword_tags rating_tags i18n disqus_tags featured_tags %}
+
+{% block meta_title %}{{ blog_post.meta_title }}{% endblock %}
+
+{% block meta_keywords %}{% metablock %}
+{% keywords_for blog_post as tags %}
+{% for tag in tags %}{% if not forloop.first %}, {% endif %}{{ tag }}{% endfor %}
+{% endmetablock %}{% endblock %}
+
+{% block meta_description %}{% metablock %}
+{{ blog_post.description }}
+{% endmetablock %}{% endblock %}
+
+{% block title %}
+{% editable blog_post.title %}{{ blog_post.title }}{% endeditable %}
+{% endblock %}
+
+{% block breadcrumb_menu %}
+{{ block.super }}
+<li class="active">{{ blog_post.title }}</li>
+{% endblock %}
+
+{% block main %}
+coucou
+{% block blog_post_detail_postedby %}
+{% editable blog_post.publish_date %}
+<h6 class="post-meta">
+ {% trans "published on" %} {{ blog_post.publish_date|date:"DATE_FORMAT" }}
+</h6>
+{% endeditable %}
+{% endblock %}
+{% block blog_post_detail_commentlink %}
+<p>
+ {% if blog_post.allow_comments %}
+ {% if settings.COMMENTS_DISQUS_SHORTNAME %}
+ (<a href="{{ blog_post.get_absolute_url }}#disqus_thread"
+ data-disqus-identifier="{% disqus_id_for blog_post %}">{% spaceless %}
+ {% trans "Comments" %}
+ {% endspaceless %}</a>)
+ {% else %}(<a href="#comments">{% spaceless %}
+ {% blocktrans count comments_count=blog_post.comments_count %}{{ comments_count }} comment{% plural %}{{ comments_count }} comments{% endblocktrans %}
+ {% endspaceless %}</a>)
+ {% endif %}
+ {% endif %}
+</p>
+{% endblock %}
+
+{% comment %}
+{% block blog_post_detail_featured_image %}
+{% if settings.BLOG_USE_FEATURED_IMAGE and blog_post.featured_image %}
+<p><img class="img-responsive" src="{{ MEDIA_URL }}{% thumbnail blog_post.featured_image 600 0 %}"></p>
+{% endif %}
+{% endblock %}
+{% endcomment %}
+
+{% if settings.COMMENTS_DISQUS_SHORTNAME %}
+{% include "generic/includes/disqus_counts.html" %}
+{% endif %}
+
+{% block blog_post_detail_content %}
+{% editable blog_post.content %}
+{{ blog_post.content|richtext_filters|safe }}
+{% endeditable %}
+{% endblock %}
+
+{% block blog_post_detail_keywords %}
+{% keywords_for blog_post as tags %}
+{% if tags %}
+{% spaceless %}
+<ul class="list-inline tags">
+ <li>{% trans "Tags" %}:</li>
+ {% for tag in tags %}
+ <li><a href="{% url "blog_post_list_tag" tag.slug %}">{{ tag }}</a>{% if not forloop.last %}, {% endif %}</li>
+ {% endfor %}
+</ul>
+{% endspaceless %}
+{% endif %}
+{% endblock %}
+
+{% comment %}
+{% block blog_post_detail_rating %}
+<div class="panel panel-default rating">
+ <div class="panel-body">
+ {% rating_for blog_post %}
+ </div>
+</div>
+{% endblock %}
+{% endcomment %}
+
+{% block event_detail_sharebuttons %}
+ {% with blog_post as object %}
+ {% include "includes/share_buttons.html" %}
+ {% endwith %}
+{% endblock %}
+
+{% block blog_post_previous_next %}
+<ul class="pager">
+{% with blog_post.get_previous_by_publish_date as previous %}
+{% if previous %}
+<li class="previous">
+ <a href="{{ previous.get_absolute_url }}">← {{ previous }}</a>
+</li>
+{% endif %}
+{% endwith %}
+{% with blog_post.get_next_by_publish_date as next %}
+{% if next %}
+<li class="next">
+ <a href="{{ next.get_absolute_url }}">{{ next }} →</a>
+</li>
+{% endif %}
+{% endwith %}
+</ul>
+{% endblock %}
+
+
+{% block blog_post_detail_related_posts %}
+{% if related_posts or blog_post.events.all %}
+<div id="related-posts">
+<h3>{% trans "Also discover" %}</h3>
+ <div class="msry__container">
+ <div class="msry__sizer"></div>
+ {% for post in related_posts %}
+ {% include 'blog/includes/post_card.html' %}
+ {% endfor %}
+ {% for event in blog_post.events.all|no_parents %}
+ {% for artist in event.artists.all %}
+ {% include "festival/inc/artist_card.html" %}
+ {% endfor %}
+ {% for video in event.videos.all %}
+ {% include 'festival/inc/video_card.html' %}
+ {% endfor %}
+ {% for post in event.blog_posts.all %}
+ {% if post != blog_post %}
+ {% include 'blog/includes/post_card.html' %}
+ {% endif %}
+ {% endfor %}
+ {% endfor %}
+ </div>
+</div>
+{% endif %}
+{% endblock %}
+
+{% block blog_post_detail_comments %}
+{% if blog_post.allow_comments %}{% comments_for blog_post %}{% endif %}
+{% endblock %}
+
+{% endblock %}