Last active
October 3, 2016 09:03
-
-
Save Neceros/6fd0db1c1a082b117d19b66aa3c8dec5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.shortcuts import render | |
from django.views.generic import View | |
from .models import Event | |
class EventsList(View): | |
model = Event | |
title = 'Events' | |
def get(self, request, *args, **kwargs): | |
events = Event.objects.all() | |
subjects = [] | |
whats = [] | |
wheres = [] | |
extras = [] | |
for event in events: | |
subjects.append(event.subject) | |
whats.append(event.what) | |
wheres.append(event.where) | |
extras.append(event.extra) | |
template = "events/view.html" | |
context = { | |
"title": self.title, | |
"subjects": subjects, | |
"whats": whats, | |
"wheres": wheres, | |
"extras": extras, | |
} | |
return render(request, template, context) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment