23 lines
795 B
Python
23 lines
795 B
Python
from django.core.urlresolvers import reverse_lazy
|
|
from django.views.generic.base import TemplateView
|
|
|
|
|
|
class OrganizationMixin(object):
|
|
|
|
def get_queryset(self):
|
|
qs = super(OrganizationMixin, self).get_queryset()
|
|
return qs.filter(organization__slug=self.kwargs['organization_slug'])
|
|
|
|
def get_success_url(self):
|
|
return reverse_lazy('manage-users', kwargs={'organization_slug': self.kwargs['organization_slug']})
|
|
|
|
def get_context_data(self, *args, **kwargs):
|
|
ctx = super(OrganizationMixin, self).get_context_data(*args, **kwargs)
|
|
ctx['organization'] = Organization.objects.get(slug=self.kwargs['organization_slug'])
|
|
return ctx
|
|
|
|
class ManageView(TemplateView):
|
|
template_name = 'organization/manage.html'
|
|
|
|
manage = ManageView.as_view()
|