summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerghei Mihai <smihai@entrouvert.com>2015-04-28 08:59:41 (GMT)
committerSerghei Mihai <smihai@entrouvert.com>2015-04-29 08:24:40 (GMT)
commitc98c7b826ef7531bbfe8322045fd44afbe385cea (patch)
treeaabdae1264b4a0ea45e7d0014c44609174f989e7
parentefabc3eaf71e78f40add785b060d3854d42296e7 (diff)
downloadu-auth-c98c7b826ef7531bbfe8322045fd44afbe385cea.zip
u-auth-c98c7b826ef7531bbfe8322045fd44afbe385cea.tar.gz
u-auth-c98c7b826ef7531bbfe8322045fd44afbe385cea.tar.bz2
mixing providing organization into context and resolving manage page url
-rw-r--r--uauth/organization/views.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/uauth/organization/views.py b/uauth/organization/views.py
index 4f90f16..61bb002 100644
--- a/uauth/organization/views.py
+++ b/uauth/organization/views.py
@@ -1,5 +1,21 @@
+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'