mirror of
https://github.com/nikdoof/vapemap.git
synced 2025-12-19 20:59:21 +00:00
Initial Import.
This commit is contained in:
20
app/stores/views/chains.py
Normal file
20
app/stores/views/chains.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from django.views.generic import ListView, DetailView
|
||||
from .mixins import EditorCheckMixin
|
||||
from ..models import Chain
|
||||
|
||||
|
||||
class ChainListView(ListView):
|
||||
model = Chain
|
||||
paginate_by = 10
|
||||
|
||||
def get_queryset(self):
|
||||
qs = super(ChainListView, self).get_queryset()
|
||||
return qs.filter(active=True).prefetch_related('stores')
|
||||
|
||||
|
||||
class ChainDetailView(EditorCheckMixin, DetailView):
|
||||
model = Chain
|
||||
|
||||
def get_queryset(self):
|
||||
qs = super(ChainDetailView, self).get_queryset()
|
||||
return qs.filter(active=True).prefetch_related('stores', 'stores__address')
|
||||
Reference in New Issue
Block a user