Project

General

Profile

« Previous | Next » 

Revision c98c7b82

Added by Serghei Mihai almost 9 years ago

mixing providing organization into context and resolving manage page url

View differences:

uauth/organization/views.py
1
from django.core.urlresolvers import reverse_lazy
1 2
from django.views.generic.base import TemplateView
2 3

  
4

  
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

  
3 19
class ManageView(TemplateView):
4 20
    template_name = 'organization/manage.html'
5 21

  

Also available in: Unified diff