Commit d28ff5f8 authored by fred's avatar fred
Browse files

fill homepage with five random emissions

parent 9982e698
from django.views.generic.base import TemplateView
from emissions.models import Emission
class Home(TemplateView):
template_name = 'home.html'
def get_context_data(self, **kwargs):
context = super(Home, self).get_context_data(**kwargs)
context['emissions'] = Emission.objects.all().order_by('?')[:5]
return context
home = Home.as_view()
......@@ -4,4 +4,10 @@
{% for emission in emissions %}
<a href="{% url 'emission-view' slug=emission.slug %}">{{ emission.title }}</a>
{% endfor %}
{% endblock %}
Supports Markdown
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