Airavata provides a mixin for filtering views. Originally
MultipleObjectMixin subclasses but feel free to use it on any View which provides a
get_queryset by the current site. By default
SiteFilteredViewMixin looks for a
site field but you can override this with the
from django.views.generic import DetailView, ListView from airavata.views import SiteFilteredViewMixin from .models import MyModel class MyModelListView(SiteFilteredViewMixin, ListView): model = MyModel class MyModelDetailView(SiteFilteredViewMixin, DetailView): model = MyModel site_field = 'base_site'