1 |
c98c7b82
|
Serghei Mihai
|
from django.core.urlresolvers import reverse_lazy
|
2 |
3dc9d7a7
|
Serghei Mihai
|
from django.views.generic.base import TemplateView
|
3 |
09d398ce
|
Serghei MIHAI
|
|
4 |
c98c7b82
|
Serghei Mihai
|
|
5 |
|
|
class OrganizationMixin(object):
|
6 |
|
|
|
7 |
|
|
def get_queryset(self):
|
8 |
|
|
qs = super(OrganizationMixin, self).get_queryset()
|
9 |
|
|
return qs.filter(organization__slug=self.kwargs['organization_slug'])
|
10 |
|
|
|
11 |
|
|
def get_success_url(self):
|
12 |
|
|
return reverse_lazy('manage-users', kwargs={'organization_slug': self.kwargs['organization_slug']})
|
13 |
|
|
|
14 |
|
|
def get_context_data(self, *args, **kwargs):
|
15 |
|
|
ctx = super(OrganizationMixin, self).get_context_data(*args, **kwargs)
|
16 |
|
|
ctx['organization'] = Organization.objects.get(slug=self.kwargs['organization_slug'])
|
17 |
|
|
return ctx
|
18 |
|
|
|
19 |
3dc9d7a7
|
Serghei Mihai
|
class ManageView(TemplateView):
|
20 |
|
|
template_name = 'organization/manage.html'
|
21 |
|
|
|
22 |
|
|
manage = ManageView.as_view()
|