This repository has been archived on 2019-11-11. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
tofu/projects/views.py

23 lines
619 B
Python
Raw Normal View History

2019-06-03 17:57:25 +02:00
from django.views import generic
from .models import Project
2019-06-03 17:57:25 +02:00
class IndexView(generic.ListView):
template_name = 'projects/index.html'
context_object_name = 'project_list'
2019-06-03 17:57:25 +02:00
def get_queryset(self):
return Project.objects.order_by('project_key')
2019-06-03 17:57:25 +02:00
class ProjectView(generic.DetailView):
model = Project
template_name = 'projects/view.html'
slug_field = slug_url_kwarg = 'project_key'
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['issue_list'] = self.get_object().issue_set.order_by('create_date')
return context