1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-06-21 01:48:21 +02:00

Added a 'trust back' button, front can be improved

This commit is contained in:
Nicolas Margulies
2022-09-21 11:53:31 +02:00
parent 7afc583282
commit 6a69590a82
2 changed files with 51 additions and 15 deletions

View File

@ -185,6 +185,31 @@ class TrustedTable(tables.Table):
show_header = False
trusting = tables.Column(attrs={'td': {'class': 'text-center'}})
trust_back = tables.Column(
verbose_name=_("Trust back"),
accessor="pk",
attrs={
'td': {
'class': 'col-sm-1',
'id': lambda record: "trust_back_" + str(record.pk),
}
},
)
def render_trust_back(self, record):
user_note = record.trusted
trusting_note = record.trusting
if Trust.objects.filter(trusted=trusting_note, trusting=user_note) :
return ""
val = '<button id="'
val += str(record.pk)
val += '" class="btn btn-success btn-sm" \
onclick="create_trust(' + str(record.trusted.pk) + ',' + \
str(record.trusting.pk) + ')">'
val += str(_("Trust back"))
val += '</button>'
return mark_safe(val)
class AliasTable(tables.Table):
class Meta: