mirror of
https://gitlab.crans.org/bde/nk20
synced 2024-12-22 23:42:25 +00:00
Update Django Tables 2, change accessor from dot to __
This commit is contained in:
parent
819795c1f9
commit
361ea8cad3
@ -33,7 +33,7 @@ class ActivityTable(tables.Table):
|
||||
class GuestTable(tables.Table):
|
||||
inviter = tables.LinkColumn(
|
||||
'member:user_detail',
|
||||
args=[A('inviter.user.pk'), ],
|
||||
args=[A('inviter__user__pk'), ],
|
||||
)
|
||||
|
||||
entry = tables.Column(
|
||||
|
@ -41,9 +41,9 @@ class UserTable(tables.Table):
|
||||
"""
|
||||
alias = tables.Column()
|
||||
|
||||
section = tables.Column(accessor='profile.section')
|
||||
section = tables.Column(accessor='profile__section')
|
||||
|
||||
balance = tables.Column(accessor='note.balance', verbose_name=_("Balance"))
|
||||
balance = tables.Column(accessor='note__balance', verbose_name=_("Balance"))
|
||||
|
||||
def render_balance(self, record, value):
|
||||
return pretty_money(value)\
|
||||
|
@ -53,7 +53,7 @@ class RightsTable(tables.Table):
|
||||
'style': 'table-layout: fixed;'
|
||||
}
|
||||
template_name = 'django_tables2/bootstrap4.html'
|
||||
fields = ('user.last_name', 'user.first_name', 'user', 'club', 'roles', )
|
||||
fields = ('user__last_name', 'user.first_name', 'user', 'club', 'roles', )
|
||||
model = Membership
|
||||
|
||||
|
||||
|
@ -9,9 +9,9 @@ class FutureUserTable(tables.Table):
|
||||
"""
|
||||
Display the list of pre-registered users
|
||||
"""
|
||||
phone_number = tables.Column(accessor='profile.phone_number')
|
||||
phone_number = tables.Column(accessor='profile__phone_number')
|
||||
|
||||
section = tables.Column(accessor='profile.section')
|
||||
section = tables.Column(accessor='profile__section')
|
||||
|
||||
class Meta:
|
||||
attrs = {
|
||||
|
@ -95,7 +95,7 @@ class SpecialTransactionTable(tables.Table):
|
||||
# Display add and remove buttons. Use the `exclude` field to select what is needed.
|
||||
remittance_add = tables.LinkColumn("treasury:link_transaction",
|
||||
verbose_name=_("Remittance"),
|
||||
args=[A("specialtransactionproxy.pk")],
|
||||
args=[A("specialtransactionproxy__pk")],
|
||||
text=_("Add"),
|
||||
attrs={
|
||||
'a': {'class': 'btn btn-primary'}
|
||||
@ -103,7 +103,7 @@ class SpecialTransactionTable(tables.Table):
|
||||
|
||||
remittance_remove = tables.LinkColumn("treasury:unlink_transaction",
|
||||
verbose_name=_("Remittance"),
|
||||
args=[A("specialtransactionproxy.pk")],
|
||||
args=[A("specialtransactionproxy__pk")],
|
||||
text=_("Remove"),
|
||||
attrs={
|
||||
'a': {'class': 'btn btn-primary btn-danger'}
|
||||
|
@ -38,7 +38,7 @@ class WEIRegistrationTable(tables.Table):
|
||||
"""
|
||||
user = tables.LinkColumn(
|
||||
'member:user_detail',
|
||||
args=[A('user.pk')],
|
||||
args=[A('user__pk')],
|
||||
)
|
||||
|
||||
edit = tables.LinkColumn(
|
||||
@ -108,7 +108,7 @@ class WEIRegistrationTable(tables.Table):
|
||||
}
|
||||
model = WEIRegistration
|
||||
template_name = 'django_tables2/bootstrap4.html'
|
||||
fields = ('user', 'user.first_name', 'user.last_name', 'first_year',)
|
||||
fields = ('user', 'user__first_name', 'user__last_name', 'first_year',)
|
||||
row_attrs = {
|
||||
'class': 'table-row',
|
||||
'id': lambda record: "row-" + str(record.pk),
|
||||
@ -119,7 +119,7 @@ class WEIRegistrationTable(tables.Table):
|
||||
class WEIMembershipTable(tables.Table):
|
||||
user = tables.LinkColumn(
|
||||
'wei:wei_update_registration',
|
||||
args=[A('registration.pk')],
|
||||
args=[A('registration__pk')],
|
||||
)
|
||||
|
||||
year = tables.Column(
|
||||
@ -129,12 +129,12 @@ class WEIMembershipTable(tables.Table):
|
||||
|
||||
bus = tables.LinkColumn(
|
||||
'wei:manage_bus',
|
||||
args=[A('bus.pk')],
|
||||
args=[A('bus__pk')],
|
||||
)
|
||||
|
||||
team = tables.LinkColumn(
|
||||
'wei:manage_bus_team',
|
||||
args=[A('team.pk')],
|
||||
args=[A('team__pk')],
|
||||
)
|
||||
|
||||
def render_year(self, record):
|
||||
@ -146,7 +146,7 @@ class WEIMembershipTable(tables.Table):
|
||||
}
|
||||
model = WEIMembership
|
||||
template_name = 'django_tables2/bootstrap4.html'
|
||||
fields = ('user', 'user.last_name', 'user.first_name', 'registration.gender', 'user.profile.department',
|
||||
fields = ('user', 'user__last_name', 'user__first_name', 'registration__gender', 'user__profile__department',
|
||||
'year', 'bus', 'team', )
|
||||
row_attrs = {
|
||||
'class': 'table-row',
|
||||
|
Loading…
Reference in New Issue
Block a user