changing namespace and urls
This commit is contained in:
31
project_directory/three_d_viewer/views.py
Normal file
31
project_directory/three_d_viewer/views.py
Normal file
@@ -0,0 +1,31 @@
|
||||
from django import template
|
||||
from django.shortcuts import get_object_or_404, render
|
||||
from django.http import HttpResponseRedirect, HttpResponse
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.views import generic
|
||||
|
||||
from three_d_viewer.models import Sample
|
||||
register = template.Library()
|
||||
|
||||
|
||||
@register.inclusion_tag('children.html')
|
||||
def children_tag(category):
|
||||
children = category.children.all()
|
||||
return {'children': children}
|
||||
|
||||
|
||||
class IndexView(generic.ListView):
|
||||
template_name = 'three_d_viewer/index.html'
|
||||
context_object_name = 'active_samples'
|
||||
|
||||
def get_queryset(self):
|
||||
"""
|
||||
Return the last five published polls (not including those set to be
|
||||
published in the future).
|
||||
"""
|
||||
return Sample.objects.filter(active=True)
|
||||
|
||||
|
||||
class DetailView(generic.DetailView):
|
||||
model = Sample
|
||||
template_name = 'three_d_viewer/detail.html'
|
||||
Reference in New Issue
Block a user