61 lines
1.4 KiB
Python
61 lines
1.4 KiB
Python
from django.views.generic import TemplateView, ListView, DetailView
|
|
from haystack.generic_views import SearchView
|
|
from haystack.forms import SearchForm
|
|
from haystack.query import SearchQuerySet
|
|
from comments.views import AddCommentView, ModifyCommentView
|
|
from .models import Category, Tag, Game, GameComment
|
|
|
|
|
|
class InventoryView(TemplateView):
|
|
template_name = "inventory/inventory.html"
|
|
|
|
|
|
class CategoryListView(ListView):
|
|
model = Category
|
|
template_name = "inventory/category_list.html"
|
|
|
|
|
|
class CategoryView(DetailView):
|
|
model = Category
|
|
template_name = "inventory/category.html"
|
|
|
|
|
|
class TagListView(ListView):
|
|
model = Tag
|
|
template_name = "inventory/tag_list.html"
|
|
|
|
|
|
class TagView(DetailView):
|
|
model = Tag
|
|
template_name = "inventory/tag.html"
|
|
|
|
|
|
class GameListView(ListView):
|
|
model = Game
|
|
template_name = "inventory/game_list.html"
|
|
|
|
|
|
class GameView(DetailView):
|
|
model = Game
|
|
template_name = "inventory/game.html"
|
|
|
|
|
|
class InventorySearchView(SearchView):
|
|
form_class = SearchForm
|
|
template_name = "inventory/search.html"
|
|
|
|
def get_queryset(self):
|
|
return SearchQuerySet().models(Category, Tag, Game)
|
|
|
|
|
|
class AddGameCommentView(AddCommentView):
|
|
model = Game
|
|
comment_model = GameComment
|
|
pattern_name = "inventory:game"
|
|
|
|
|
|
class ModifyGameCommentView(ModifyCommentView):
|
|
model = Game
|
|
comment_model = GameComment
|
|
template_name = "inventory/game.html"
|
|
success_pattern_name = "inventory:game"
|