Commit a0bc11a1 authored by Simon Daron's avatar Simon Daron
Browse files

News view extend news

parent 09270903
...@@ -22,7 +22,7 @@ urlpatterns = patterns('', ...@@ -22,7 +22,7 @@ urlpatterns = patterns('',
url(r'^get$', 'panikweb.views.get', name='get'), url(r'^get$', 'panikweb.views.get', name='get'),
url(r'^listen$', 'panikweb.views.listen', name='listen'), url(r'^listen$', 'panikweb.views.listen', name='listen'),
url(r'^news/$', 'panikweb.views.news', name='news'), url(r'^news/$', 'panikweb.views.news', name='news'),
url(r'^news/(?P<slug>[\w,-]+)$', 'panikweb.views.newsitem', name='news-view'), url(r'^news/(?P<slug>[\w,-]+)$', 'panikweb.views.newsitemview', name='news-view'),
url(r'^search/', 'panikweb.search.view', name='search'), url(r'^search/', 'panikweb.search.view', name='search'),
......
...@@ -364,15 +364,15 @@ class Home(TemplateView): ...@@ -364,15 +364,15 @@ class Home(TemplateView):
home = Home.as_view() home = Home.as_view()
class NewsItemDetailView(DetailView): class NewsItemView(DetailView):
model = NewsItem model = NewsItem
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super(NewsItemView, self).get_context_data(**kwargs)
context['sectionName'] = "News" context['sectionName'] = "News"
context = super(NewsItemDetailView, self).get_context_data(**kwargs)
context['news'] = list(NewsItem.objects.all().order_by('-datetime')[:60]) context['news'] = list(NewsItem.objects.all().order_by('-datetime')[:60])
context['categories'] = list(NewsCategory.objects.all()) context['categories'] = list(NewsCategory.objects.all())
return context return context
newsitem = NewsItemDetailView.as_view() newsitemview = NewsItemView.as_view()
class News(TemplateView): class News(TemplateView):
template_name = 'news.html' template_name = 'news.html'
......
...@@ -6,6 +6,10 @@ ...@@ -6,6 +6,10 @@
<span class="icon-home" ></span> <span class="icon-home" ></span>
<span class="iconLabel">Home</span> <span class="iconLabel">Home</span>
</a></li> </a></li>
<li><a href="{% url 'news' %}">
<span class="icon-bullhorn" ></span>
<span class="iconLabel">News</span>
</a></li>
<li><a href="{% url 'listen' %}"> <li><a href="{% url 'listen' %}">
<span class="icon-headphones" ></span> <span class="icon-headphones" ></span>
<span class="iconLabel">Listen</span> <span class="iconLabel">Listen</span>
...@@ -17,10 +21,6 @@ ...@@ -17,10 +21,6 @@
<!-- <!--
--> -->
<!-- <!--
<li><a href="{% url 'news' %}">
<span class="icon-group" ></span>
<span class="iconLabel">News</span>
</a></li>
<li><a href="{% url 'grid' %}"> <li><a href="{% url 'grid' %}">
<span class="icon-th-large" ></span> <span class="icon-th-large" ></span>
<span class="iconLabel">Grid</span> <span class="iconLabel">Grid</span>
......
...@@ -15,8 +15,9 @@ ...@@ -15,8 +15,9 @@
</div> </div>
{% endblock %} {% endblock %}
{% block links %} {% block links %}
<div class="wrapper"> <div class="wrapper">
<ul class="news columns padded"> <div class="padded ">
<ul class="news columns padded list custom">
{% for NewsItem in news %} {% for NewsItem in news %}
<li class="item ellipsis small "> <li class="item ellipsis small ">
<a href="{% url 'news-view' slug=NewsItem.slug %}"> <a href="{% url 'news-view' slug=NewsItem.slug %}">
...@@ -26,4 +27,5 @@ ...@@ -26,4 +27,5 @@
{% endfor %} {% endfor %}
</ul> </ul>
</div> </div>
</div>
{% endblock %} {% endblock %}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment