Project

General

Profile

« Previous | Next » 

Revision c98c7b82

Added by Serghei Mihai over 10 years ago

mixing providing organization into context and resolving manage page url

View differences:

uauth/organization/views.py
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'

Also available in: Unified diff