Project

General

Profile

« Previous | Next » 

Revision 836b9f76

Added by Serghei Mihai over 9 years ago

users listing using django_tables

View differences:

uauth/organization/views.py
1
from django.utils.translation import ugettext as _
1 2
from django.core.urlresolvers import reverse_lazy
3

  
2 4
from django.views.generic.base import TemplateView
5
from django.views.generic.list import ListView
6

  
7
from django_tables2 import RequestConfig
8

  
9
from .models import LocalAccount, Organization
10
from .tables import AccountTable
3 11

  
4 12

  
5 13
class OrganizationMixin(object):
......
20 28
    template_name = 'organization/manage.html'
21 29

  
22 30
manage = ManageView.as_view()
31

  
32
class UsersPageView(OrganizationMixin, ListView):
33
    template_name = 'organization/users.html'
34
    model = LocalAccount
35

  
36
    def get_context_data(self, *args, **kwargs):
37
        context = super(UsersPageView, self).get_context_data(*args, **kwargs)
38
        table = AccountTable(context['object_list'])
39
        RequestConfig(self.request).configure(table)
40
        context['table'] = table
41
        return context
42

  
43
users = UsersPageView.as_view()

Also available in: Unified diff