nk20/apps/member/tables.py

28 lines
904 B
Python
Raw Normal View History

2019-08-15 19:52:10 +00:00
#!/usr/bin/env python
import django_tables2 as tables
from .models import Club
2019-09-23 10:50:14 +00:00
from django.conf import settings
from django.contrib.auth.models import User
2019-08-15 19:52:10 +00:00
class ClubTable(tables.Table):
class Meta:
attrs = {'class':'table table-bordered table-condensed table-striped table-hover'}
model = Club
template_name = 'django_tables2/bootstrap.html'
2019-09-23 10:50:14 +00:00
fields = ('id','name','email')
2019-08-15 19:52:10 +00:00
row_attrs = {'class':'table-row',
'data-href': lambda record: record.pk }
2019-09-23 10:50:14 +00:00
class UserTable(tables.Table):
section = tables.Column(accessor='profile.section')
solde = tables.Column(accessor='note.balance')
class Meta:
attrs = {'class':'table table-bordered table-condensed table-striped table-hover'}
template_name = 'django_tables2/bootstrap.html'
fields = ('last_name','first_name','username','email')
model = User