Skip to content
Snippets Groups Projects
Commit 361ea8ca authored by ynerant's avatar ynerant
Browse files

Update Django Tables 2, change accessor from dot to __

parent 819795c1
No related branches found
No related tags found
1 merge request!104Beta
Pipeline #8571 failed with stages
in 15 seconds
......@@ -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',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment