From 4fb0b7d73661ac95b8a69b7d0f93c927ab6ce31a Mon Sep 17 00:00:00 2001 From: Nicolas Margulies Date: Thu, 14 Apr 2022 19:07:33 +0200 Subject: [PATCH 01/11] First pass on a display of users trusting you, added a corresponding right --- .../templates/member/profile_trust.html | 11 ++++++-- apps/member/views.py | 4 ++- apps/note/tables.py | 15 ++++++++++- apps/permission/fixtures/initial.json | 25 ++++++++++++++++--- 4 files changed, 47 insertions(+), 8 deletions(-) diff --git a/apps/member/templates/member/profile_trust.html b/apps/member/templates/member/profile_trust.html index bd8d6b50..5a65462e 100644 --- a/apps/member/templates/member/profile_trust.html +++ b/apps/member/templates/member/profile_trust.html @@ -7,7 +7,7 @@ SPDX-License-Identifier: GPL-3.0-or-later {% block profile_content %}

- {% trans "Note friendships" %} + {% trans "Add friends" %}

{% if can_create %} @@ -24,7 +24,7 @@ SPDX-License-Identifier: GPL-3.0-or-later {% render_table trusting %}
-
+
{% blocktrans trimmed %} Adding someone as a friend enables them to initiate transactions coming from your account (while keeping your balance positive). This is @@ -33,6 +33,13 @@ SPDX-License-Identifier: GPL-3.0-or-later friends without needing additional rights among them. {% endblocktrans %}
+ +
+

+ {% trans "People trusting you" %} +

+ {% render_table trusted_by %} +
{% endblock %} {% block extrajavascript %} diff --git a/apps/member/views.py b/apps/member/views.py index 63307383..a41b0bff 100644 --- a/apps/member/views.py +++ b/apps/member/views.py @@ -21,7 +21,7 @@ from django_tables2.views import SingleTableView from rest_framework.authtoken.models import Token from note.models import Alias, NoteClub, NoteUser, Trust from note.models.transactions import Transaction, SpecialTransaction -from note.tables import HistoryTable, AliasTable, TrustTable +from note.tables import HistoryTable, AliasTable, TrustTable, TrustedTable from note_kfet.middlewares import _set_current_request from permission.backends import PermissionBackend from permission.models import Role @@ -258,6 +258,8 @@ class ProfileTrustView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView): note = context['object'].note context["trusting"] = TrustTable( note.trusting.filter(PermissionBackend.filter_queryset(self.request, Trust, "view")).distinct().all()) + context["trusted_by"] = TrustedTable( + note.trusted.filter(PermissionBackend.filter_queryset(self.request, Trust, "view")).distinct().all()) context["can_create"] = PermissionBackend.check_perm(self.request, "note.add_trust", Trust( trusting=context["object"].note, trusted=context["object"].note diff --git a/apps/note/tables.py b/apps/note/tables.py index 1e94a39f..6c684d69 100644 --- a/apps/note/tables.py +++ b/apps/note/tables.py @@ -159,7 +159,7 @@ class TrustTable(tables.Table): template_name = 'django_tables2/bootstrap4.html' show_header = False - trusted = tables.Column(attrs={'td': {'class': 'text_center'}}) + trusted = tables.Column(attrs={'td': {'class': 'text-center'}}) delete_col = tables.TemplateColumn( template_code=DELETE_TEMPLATE, @@ -172,6 +172,19 @@ class TrustTable(tables.Table): else '')}}, verbose_name=_("Delete"),) +class TrustedTable(tables.Table): + class Meta: + attrs = { + 'class': 'table table condensed table-striped', + 'id': 'trusted_table' + } + Model = Trust + fields = ("trusting",) + template_name = "django_tables2/bootstrap4.html" + + show_header = False + trusting = tables.Column(attrs={'td': {'class': 'text-center'}}) + class AliasTable(tables.Table): class Meta: diff --git a/apps/permission/fixtures/initial.json b/apps/permission/fixtures/initial.json index 5776abab..0553f39f 100644 --- a/apps/permission/fixtures/initial.json +++ b/apps/permission/fixtures/initial.json @@ -3093,6 +3093,22 @@ "field": "", "permanent": false, "description": "Créer un crédit quelconque" + } + }, + { + "model": "permission.permission", + "pk": 198, + "fields": { + "model": [ + "note", + "trust" + ], + "query": "{\"trusted__noteuser__user\": [\"user\"]}", + "type": "view", + "mask": 1, + "field": "", + "permanent": true, + "description": "Voir ceux nous ayant pour ami, pour toujours" } }, { @@ -3132,10 +3148,11 @@ 187, 188, 189, - 190, - 191, - 195, - 196 + 190, + 191, + 195, + 196, + 198 ] } }, From 7afc5832826abbdb3aa828a1f9705495236be8bb Mon Sep 17 00:00:00 2001 From: Nicolas Margulies Date: Fri, 29 Apr 2022 01:40:43 +0200 Subject: [PATCH 02/11] Made trust adding widget resetable, corrected the unexpected empty field behavior and improved autocomplete's responsiveness --- apps/member/views.py | 3 +-- note_kfet/static/js/autocomplete_model.js | 15 +++++++++------ note_kfet/templates/autocomplete_model.html | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/apps/member/views.py b/apps/member/views.py index a41b0bff..2bc2133c 100644 --- a/apps/member/views.py +++ b/apps/member/views.py @@ -266,11 +266,10 @@ class ProfileTrustView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView): )) context["widget"] = { "name": "trusted", + "resetable": True, "attrs": { - "model_pk": ContentType.objects.get_for_model(Alias).pk, "class": "autocomplete form-control", "id": "trusted", - "resetable": True, "api_url": "/api/note/alias/?note__polymorphic_ctype__model=noteuser", "name_field": "name", "placeholder": "" diff --git a/note_kfet/static/js/autocomplete_model.js b/note_kfet/static/js/autocomplete_model.js index 2a2677d4..a8b2461c 100644 --- a/note_kfet/static/js/autocomplete_model.js +++ b/note_kfet/static/js/autocomplete_model.js @@ -1,3 +1,5 @@ +const keycodes = [32, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 106, 107, 109, 110, 111, 186, 187, 188, 189, 190, 191, 219, 220, 221, 222] + $(document).ready(function () { $('.autocomplete').keyup(function (e) { const target = $('#' + e.target.id) @@ -10,7 +12,6 @@ $(document).ready(function () { const input = target.val() target.addClass('is-invalid') target.removeClass('is-valid') - $('#' + prefix + '_reset').removeClass('d-none') $.getJSON(api_url + (api_url.includes('?') ? '&' : '?') + 'format=json&search=^' + input + api_url_suffix, function (objects) { let html = '
    ' @@ -41,11 +42,14 @@ $(document).ready(function () { if (typeof autocompleted !== 'undefined') { autocompleted(obj, prefix) } }) - - if (input === obj[name_field]) { $('#' + prefix + '_pk').val(obj.id) } }) - if (objects.results.length === 1 && e.originalEvent.keyCode >= 32) { + if (objects.results.length >= 2) { + $('#' + prefix + '_pk').val(objects.results[0].id) + } + if (objects.results.length === 1 && + (keycodes.includes(e.originalEvent.keyCode) || + input === objects.results[0][name_field])) { $('#' + prefix + '_' + objects.results[0].id).trigger('click') } }) @@ -55,7 +59,6 @@ $(document).ready(function () { const name = $(this).attr('id').replace('_reset', '') $('#' + name + '_pk').val('') $('#' + name).val('') - $('#' + name + '_list').html('') - $(this).addClass('d-none') + $('#' + name).tooltip('hide') }) }) diff --git a/note_kfet/templates/autocomplete_model.html b/note_kfet/templates/autocomplete_model.html index 20c8041e..fa24213f 100644 --- a/note_kfet/templates/autocomplete_model.html +++ b/note_kfet/templates/autocomplete_model.html @@ -12,6 +12,6 @@ SPDX-License-Identifier: GPL-3.0-or-later {% endfor %} aria-describedby="{{widget.attrs.id}}_tooltip"> {% if widget.resetable %} - {% trans "Reset" %} + {% trans "Reset" %} {% endif %} From 6a69590a828b2b65206a8677745f273ad4100a47 Mon Sep 17 00:00:00 2001 From: Nicolas Margulies Date: Wed, 21 Sep 2022 11:53:31 +0200 Subject: [PATCH 03/11] Added a 'trust back' button, front can be improved --- apps/member/static/member/js/trust.js | 41 +++++++++++++++++---------- apps/note/tables.py | 25 ++++++++++++++++ 2 files changed, 51 insertions(+), 15 deletions(-) diff --git a/apps/member/static/member/js/trust.js b/apps/member/static/member/js/trust.js index a16bed08..15b5359f 100644 --- a/apps/member/static/member/js/trust.js +++ b/apps/member/static/member/js/trust.js @@ -1,7 +1,7 @@ /** * On form submit, create a new friendship */ -function create_trust (e) { +function form_create_trust (e) { // Do not submit HTML form e.preventDefault() @@ -14,25 +14,35 @@ function create_trust (e) { addMsg(gettext("You can't add yourself as a friend"), "danger") return } - $.post('/api/note/trust/', { - csrfmiddlewaretoken: formData.get('csrfmiddlewaretoken'), - trusting: formData.get('trusting'), - trusted: trusted_alias.note - }).done(function () { - // Reload table - $('#trust_table').load(location.pathname + ' #trust_table') - addMsg(gettext('Friendship successfully added'), 'success') - }).fail(function (xhr, _textStatus, _error) { - errMsg(xhr.responseJSON) - }) + create_trust(formData.get('trusting'), trusted_alias.note) }).fail(function (xhr, _textStatus, _error) { errMsg(xhr.responseJSON) }) } /** - * On click of "delete", delete the alias - * @param button_id:Integer Alias id to remove + * Create a trust between users + * @param trusting:Integer trusting note id + * @param trusted:Integer trusted note id + */ +function create_trust(trusting, trusted) { + $.post('/api/note/trust/', { + trusting: trusting, + trusted: trusted, + csrfmiddlewaretoken: CSRF_TOKEN + }).done(function () { + // Reload tables + $('#trust_table').load(location.pathname + ' #trust_table') + $('#trusted_table').load(location.pathname + ' #trusted_table') + addMsg(gettext('Friendship successfully added'), 'success') + }).fail(function (xhr, _textStatus, _error) { + errMsg(xhr.responseJSON) + }) +} + +/** + * On click of "delete", delete the trust + * @param button_id:Integer Trust id to remove */ function delete_button (button_id) { $.ajax({ @@ -42,6 +52,7 @@ function delete_button (button_id) { }).done(function () { addMsg(gettext('Friendship successfully deleted'), 'success') $('#trust_table').load(location.pathname + ' #trust_table') + $('#trusted_table').load(location.pathname + ' #trusted_table') }).fail(function (xhr, _textStatus, _error) { errMsg(xhr.responseJSON) }) @@ -49,5 +60,5 @@ function delete_button (button_id) { $(document).ready(function () { // Attach event - document.getElementById('form_trust').addEventListener('submit', create_trust) + document.getElementById('form_trust').addEventListener('submit', form_create_trust) }) diff --git a/apps/note/tables.py b/apps/note/tables.py index 6c684d69..3e6e4f0a 100644 --- a/apps/note/tables.py +++ b/apps/note/tables.py @@ -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 = '' + return mark_safe(val) + class AliasTable(tables.Table): class Meta: From d81b1f2710f719795c0951359ae2fc0acae48d6f Mon Sep 17 00:00:00 2001 From: Nicolas Margulies Date: Wed, 28 Sep 2022 10:28:47 +0200 Subject: [PATCH 04/11] Tweaked trust back display --- apps/member/templates/member/profile_trust.html | 2 +- apps/note/tables.py | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/apps/member/templates/member/profile_trust.html b/apps/member/templates/member/profile_trust.html index 5a65462e..b89f05f6 100644 --- a/apps/member/templates/member/profile_trust.html +++ b/apps/member/templates/member/profile_trust.html @@ -36,7 +36,7 @@ SPDX-License-Identifier: GPL-3.0-or-later

    - {% trans "People trusting you" %} + {% trans "People having you as a friend" %}

    {% render_table trusted_by %}
    diff --git a/apps/note/tables.py b/apps/note/tables.py index 3e6e4f0a..0a0fd4ed 100644 --- a/apps/note/tables.py +++ b/apps/note/tables.py @@ -183,14 +183,15 @@ class TrustedTable(tables.Table): template_name = "django_tables2/bootstrap4.html" show_header = False - trusting = tables.Column(attrs={'td': {'class': 'text-center'}}) + trusting = tables.Column(attrs={ + 'td': {'class': 'text-center', 'width':'100%'}}) trust_back = tables.Column( verbose_name=_("Trust back"), accessor="pk", attrs={ 'td': { - 'class': 'col-sm-1', + 'class': '', 'id': lambda record: "trust_back_" + str(record.pk), } }, @@ -203,10 +204,10 @@ class TrustedTable(tables.Table): return "" val = '' return mark_safe(val) From 977eb7c0d48b74ba1f2a79fdefb8895e217e8b9f Mon Sep 17 00:00:00 2001 From: Nicolas Margulies Date: Wed, 28 Sep 2022 11:24:42 +0200 Subject: [PATCH 05/11] Generated translation files, did french --- locale/de/LC_MESSAGES/django.po | 58 +++++++++++++++++++----------- locale/es/LC_MESSAGES/django.po | 62 ++++++++++++++++++++++----------- locale/fr/LC_MESSAGES/django.po | 58 +++++++++++++++++++----------- 3 files changed, 116 insertions(+), 62 deletions(-) diff --git a/locale/de/LC_MESSAGES/django.po b/locale/de/LC_MESSAGES/django.po index c9e084a5..cc65b7e9 100644 --- a/locale/de/LC_MESSAGES/django.po +++ b/locale/de/LC_MESSAGES/django.po @@ -391,7 +391,7 @@ msgid "validate" msgstr "" #: apps/activity/templates/activity/includes/activity_info.html:71 -#: apps/logs/models.py:64 apps/note/tables.py:220 +#: apps/logs/models.py:64 apps/note/tables.py:259 msgid "edit" msgstr "bearbeiten" @@ -467,8 +467,8 @@ msgstr "neue Daten" msgid "create" msgstr "schaffen" -#: apps/logs/models.py:65 apps/note/tables.py:166 apps/note/tables.py:190 -#: apps/note/tables.py:237 apps/permission/models.py:127 +#: apps/logs/models.py:65 apps/note/tables.py:166 apps/note/tables.py:229 +#: apps/note/tables.py:276 apps/permission/models.py:127 #: apps/treasury/tables.py:38 apps/wei/tables.py:74 msgid "delete" msgstr "entfernen" @@ -1011,8 +1011,8 @@ msgstr "" "erlaubt." #: apps/member/templates/member/club_alias.html:10 -#: apps/member/templates/member/profile_alias.html:10 apps/member/views.py:287 -#: apps/member/views.py:517 +#: apps/member/templates/member/profile_alias.html:10 apps/member/views.py:288 +#: apps/member/views.py:518 msgid "Note aliases" msgstr "Note Aliases" @@ -1192,8 +1192,8 @@ msgstr "Click hier um eine Bestätigunglinke zu schicken." msgid "View my memberships" msgstr "Meine Mitgliedschaften schauen" -#: apps/member/templates/member/profile_trust.html:10 apps/member/views.py:254 -msgid "Note friendships" +#: apps/member/templates/member/profile_trust.html:10 +msgid "Add friends" msgstr "" #: apps/member/templates/member/profile_trust.html:28 @@ -1205,6 +1205,10 @@ msgid "" "without needing additional rights among them." msgstr "" +#: apps/member/templates/member/profile_trust.html:39 +msgid "People having you as a friend" +msgstr "" + #: apps/member/templates/member/profile_update.html:18 msgid "Save Changes" msgstr "Speichern" @@ -1225,35 +1229,39 @@ msgstr "Profile detail" msgid "Search user" msgstr "User finden" -#: apps/member/views.py:308 +#: apps/member/views.py:254 +msgid "Note friendships" +msgstr "" + +#: apps/member/views.py:309 msgid "Update note picture" msgstr "Notebild ändern" -#: apps/member/views.py:354 +#: apps/member/views.py:355 msgid "Manage auth token" msgstr "Auth token bearbeiten" -#: apps/member/views.py:381 +#: apps/member/views.py:382 msgid "Create new club" msgstr "Neue Club" -#: apps/member/views.py:400 +#: apps/member/views.py:401 msgid "Search club" msgstr "Club finden" -#: apps/member/views.py:433 +#: apps/member/views.py:434 msgid "Club detail" msgstr "Club Details" -#: apps/member/views.py:540 +#: apps/member/views.py:541 msgid "Update club" msgstr "Club bearbeiten" -#: apps/member/views.py:574 +#: apps/member/views.py:575 msgid "Add new member to the club" msgstr "Neue Mitglieder" -#: apps/member/views.py:703 apps/wei/views.py:973 +#: apps/member/views.py:704 apps/wei/views.py:973 msgid "" "This user don't have enough money to join this club, and can't have a " "negative balance." @@ -1261,11 +1269,11 @@ msgstr "" "Diese User hat nicht genug Geld um Mitglied zu werden, und darf nich im Rot " "sein." -#: apps/member/views.py:725 +#: apps/member/views.py:726 msgid "The membership must start after {:%m-%d-%Y}." msgstr "Die Mitgliedschaft muss nach {:%m-%d-Y} anfängen." -#: apps/member/views.py:730 +#: apps/member/views.py:731 msgid "The membership must begin before {:%m-%d-%Y}." msgstr "Die Mitgliedschaft muss vor {:%m-%d-Y} anfängen." @@ -1606,7 +1614,7 @@ msgstr "Klicken Sie zum gültigmachen" msgid "No reason specified" msgstr "Kein Grund gegeben" -#: apps/note/tables.py:173 apps/note/tables.py:194 apps/note/tables.py:239 +#: apps/note/tables.py:173 apps/note/tables.py:233 apps/note/tables.py:278 #: apps/treasury/tables.py:39 #: apps/treasury/templates/treasury/invoice_confirm_delete.html:30 #: apps/treasury/templates/treasury/sogecredit_detail.html:65 @@ -1618,7 +1626,17 @@ msgstr "Kein Grund gegeben" msgid "Delete" msgstr "Löschen" -#: apps/note/tables.py:222 apps/note/templates/note/conso_form.html:132 +#: apps/note/tables.py:190 +msgid "Trust back" +msgstr "" + +#: apps/note/tables.py:210 +#, fuzzy +#| msgid "Add bus" +msgid "Add back" +msgstr "Neue Bus" + +#: apps/note/tables.py:261 apps/note/templates/note/conso_form.html:132 #: apps/wei/tables.py:49 apps/wei/tables.py:50 #: apps/wei/templates/wei/base.html:89 #: apps/wei/templates/wei/bus_detail.html:20 @@ -1628,7 +1646,7 @@ msgstr "Löschen" msgid "Edit" msgstr "Bearbeiten" -#: apps/note/tables.py:226 apps/note/tables.py:253 +#: apps/note/tables.py:265 apps/note/tables.py:292 msgid "Hide/Show" msgstr "" diff --git a/locale/es/LC_MESSAGES/django.po b/locale/es/LC_MESSAGES/django.po index 5d2aaa9e..ddcbde43 100644 --- a/locale/es/LC_MESSAGES/django.po +++ b/locale/es/LC_MESSAGES/django.po @@ -386,7 +386,7 @@ msgid "validate" msgstr "validar" #: apps/activity/templates/activity/includes/activity_info.html:71 -#: apps/logs/models.py:64 apps/note/tables.py:220 +#: apps/logs/models.py:64 apps/note/tables.py:259 msgid "edit" msgstr "modificar" @@ -464,8 +464,8 @@ msgstr "nuevos datos" msgid "create" msgstr "crear" -#: apps/logs/models.py:65 apps/note/tables.py:166 apps/note/tables.py:190 -#: apps/note/tables.py:237 apps/permission/models.py:127 +#: apps/logs/models.py:65 apps/note/tables.py:166 apps/note/tables.py:229 +#: apps/note/tables.py:276 apps/permission/models.py:127 #: apps/treasury/tables.py:38 apps/wei/tables.py:74 msgid "delete" msgstr "suprimir" @@ -1002,8 +1002,8 @@ msgstr "" "nuevo posibles." #: apps/member/templates/member/club_alias.html:10 -#: apps/member/templates/member/profile_alias.html:10 apps/member/views.py:287 -#: apps/member/views.py:517 +#: apps/member/templates/member/profile_alias.html:10 apps/member/views.py:288 +#: apps/member/views.py:518 msgid "Note aliases" msgstr "Alias de la note" @@ -1175,9 +1175,11 @@ msgstr "Hacer clic aquí para reenviar un enlace de validación." msgid "View my memberships" msgstr "Ver mis afiliaciones" -#: apps/member/templates/member/profile_trust.html:10 apps/member/views.py:254 -msgid "Note friendships" -msgstr "Amistades de note" +#: apps/member/templates/member/profile_trust.html:10 +#, fuzzy +#| msgid "friendships" +msgid "Add friends" +msgstr "amistades" #: apps/member/templates/member/profile_trust.html:28 msgid "" @@ -1192,6 +1194,10 @@ msgstr "" "simplificar el reembolso entre amig@s por Note Kfet. Pues una persona puede " "crear todas la transacciones sin tener derechos particulares." +#: apps/member/templates/member/profile_trust.html:39 +msgid "People having you as a friend" +msgstr "" + #: apps/member/templates/member/profile_update.html:18 msgid "Save Changes" msgstr "Guardar cambios" @@ -1212,35 +1218,39 @@ msgstr "Detalles del usuario" msgid "Search user" msgstr "Buscar un usuario" -#: apps/member/views.py:308 +#: apps/member/views.py:254 +msgid "Note friendships" +msgstr "Amistades de note" + +#: apps/member/views.py:309 msgid "Update note picture" msgstr "Modificar la imagen de la note" -#: apps/member/views.py:354 +#: apps/member/views.py:355 msgid "Manage auth token" msgstr "Gestionar los token de autentificación" -#: apps/member/views.py:381 +#: apps/member/views.py:382 msgid "Create new club" msgstr "Crear un nuevo club" -#: apps/member/views.py:400 +#: apps/member/views.py:401 msgid "Search club" msgstr "Buscar un club" -#: apps/member/views.py:433 +#: apps/member/views.py:434 msgid "Club detail" msgstr "Detalles del club" -#: apps/member/views.py:540 +#: apps/member/views.py:541 msgid "Update club" msgstr "Modificar el club" -#: apps/member/views.py:574 +#: apps/member/views.py:575 msgid "Add new member to the club" msgstr "Añadir un nuevo miembro al club" -#: apps/member/views.py:703 apps/wei/views.py:973 +#: apps/member/views.py:704 apps/wei/views.py:973 msgid "" "This user don't have enough money to join this club, and can't have a " "negative balance." @@ -1248,11 +1258,11 @@ msgstr "" "Este usuario no tiene suficiente dinero para unirse a este club, y no puede " "tener un saldo negativo." -#: apps/member/views.py:725 +#: apps/member/views.py:726 msgid "The membership must start after {:%m-%d-%Y}." msgstr "La afiliación tiene que empezar después del {:%d-%m-%Y}." -#: apps/member/views.py:730 +#: apps/member/views.py:731 msgid "The membership must begin before {:%m-%d-%Y}." msgstr "La afiliación tiene que empezar antes del {:%d-%m-%Y}." @@ -1593,7 +1603,7 @@ msgstr "Hacer clic para validar" msgid "No reason specified" msgstr "Ningún motivo dado" -#: apps/note/tables.py:173 apps/note/tables.py:194 apps/note/tables.py:239 +#: apps/note/tables.py:173 apps/note/tables.py:233 apps/note/tables.py:278 #: apps/treasury/tables.py:39 #: apps/treasury/templates/treasury/invoice_confirm_delete.html:30 #: apps/treasury/templates/treasury/sogecredit_detail.html:65 @@ -1605,7 +1615,17 @@ msgstr "Ningún motivo dado" msgid "Delete" msgstr "Suprimir" -#: apps/note/tables.py:222 apps/note/templates/note/conso_form.html:132 +#: apps/note/tables.py:190 +msgid "Trust back" +msgstr "" + +#: apps/note/tables.py:210 +#, fuzzy +#| msgid "Add bus" +msgid "Add back" +msgstr "Añadir un bus" + +#: apps/note/tables.py:261 apps/note/templates/note/conso_form.html:132 #: apps/wei/tables.py:49 apps/wei/tables.py:50 #: apps/wei/templates/wei/base.html:89 #: apps/wei/templates/wei/bus_detail.html:20 @@ -1615,7 +1635,7 @@ msgstr "Suprimir" msgid "Edit" msgstr "Editar" -#: apps/note/tables.py:226 apps/note/tables.py:253 +#: apps/note/tables.py:265 apps/note/tables.py:292 msgid "Hide/Show" msgstr "Ocultar/Mostrar" diff --git a/locale/fr/LC_MESSAGES/django.po b/locale/fr/LC_MESSAGES/django.po index 0f26bca0..8ab38cb7 100644 --- a/locale/fr/LC_MESSAGES/django.po +++ b/locale/fr/LC_MESSAGES/django.po @@ -388,7 +388,7 @@ msgid "validate" msgstr "valider" #: apps/activity/templates/activity/includes/activity_info.html:71 -#: apps/logs/models.py:64 apps/note/tables.py:220 +#: apps/logs/models.py:64 apps/note/tables.py:259 msgid "edit" msgstr "modifier" @@ -466,8 +466,8 @@ msgstr "nouvelles données" msgid "create" msgstr "créer" -#: apps/logs/models.py:65 apps/note/tables.py:166 apps/note/tables.py:190 -#: apps/note/tables.py:237 apps/permission/models.py:127 +#: apps/logs/models.py:65 apps/note/tables.py:166 apps/note/tables.py:229 +#: apps/note/tables.py:276 apps/permission/models.py:127 #: apps/treasury/tables.py:38 apps/wei/tables.py:74 msgid "delete" msgstr "supprimer" @@ -1005,8 +1005,8 @@ msgstr "" "seront à nouveau possible." #: apps/member/templates/member/club_alias.html:10 -#: apps/member/templates/member/profile_alias.html:10 apps/member/views.py:287 -#: apps/member/views.py:517 +#: apps/member/templates/member/profile_alias.html:10 apps/member/views.py:288 +#: apps/member/views.py:518 msgid "Note aliases" msgstr "Alias de la note" @@ -1178,9 +1178,9 @@ msgstr "Cliquez ici pour renvoyer un lien de validation." msgid "View my memberships" msgstr "Voir mes adhésions" -#: apps/member/templates/member/profile_trust.html:10 apps/member/views.py:254 -msgid "Note friendships" -msgstr "Amitiés note" +#: apps/member/templates/member/profile_trust.html:10 +msgid "Add friends" +msgstr "Ajouter des amis" #: apps/member/templates/member/profile_trust.html:28 msgid "" @@ -1195,6 +1195,10 @@ msgstr "" "ami⋅es via note. En effet, une personne peut effectuer tous les transferts " "sans posséder de droits supplémentaires." +#: apps/member/templates/member/profile_trust.html:39 +msgid "People having you as a friend" +msgstr "Personnes vous ayant ajouté" + #: apps/member/templates/member/profile_update.html:18 msgid "Save Changes" msgstr "Sauvegarder les changements" @@ -1215,35 +1219,39 @@ msgstr "Détails de l'utilisateur" msgid "Search user" msgstr "Chercher un utilisateur" -#: apps/member/views.py:308 +#: apps/member/views.py:254 +msgid "Note friendships" +msgstr "Amitiés note" + +#: apps/member/views.py:309 msgid "Update note picture" msgstr "Modifier la photo de la note" -#: apps/member/views.py:354 +#: apps/member/views.py:355 msgid "Manage auth token" msgstr "Gérer les jetons d'authentification" -#: apps/member/views.py:381 +#: apps/member/views.py:382 msgid "Create new club" msgstr "Créer un nouveau club" -#: apps/member/views.py:400 +#: apps/member/views.py:401 msgid "Search club" msgstr "Chercher un club" -#: apps/member/views.py:433 +#: apps/member/views.py:434 msgid "Club detail" msgstr "Détails du club" -#: apps/member/views.py:540 +#: apps/member/views.py:541 msgid "Update club" msgstr "Modifier le club" -#: apps/member/views.py:574 +#: apps/member/views.py:575 msgid "Add new member to the club" msgstr "Ajouter un nouveau membre au club" -#: apps/member/views.py:703 apps/wei/views.py:973 +#: apps/member/views.py:704 apps/wei/views.py:973 msgid "" "This user don't have enough money to join this club, and can't have a " "negative balance." @@ -1251,11 +1259,11 @@ msgstr "" "Cet utilisateur n'a pas assez d'argent pour rejoindre ce club et ne peut pas " "avoir un solde négatif." -#: apps/member/views.py:725 +#: apps/member/views.py:726 msgid "The membership must start after {:%m-%d-%Y}." msgstr "L'adhésion doit commencer après le {:%d/%m/%Y}." -#: apps/member/views.py:730 +#: apps/member/views.py:731 msgid "The membership must begin before {:%m-%d-%Y}." msgstr "L'adhésion doit commencer avant le {:%d/%m/%Y}." @@ -1599,7 +1607,7 @@ msgstr "Cliquez pour valider" msgid "No reason specified" msgstr "Pas de motif spécifié" -#: apps/note/tables.py:173 apps/note/tables.py:194 apps/note/tables.py:239 +#: apps/note/tables.py:173 apps/note/tables.py:233 apps/note/tables.py:278 #: apps/treasury/tables.py:39 #: apps/treasury/templates/treasury/invoice_confirm_delete.html:30 #: apps/treasury/templates/treasury/sogecredit_detail.html:65 @@ -1611,7 +1619,15 @@ msgstr "Pas de motif spécifié" msgid "Delete" msgstr "Supprimer" -#: apps/note/tables.py:222 apps/note/templates/note/conso_form.html:132 +#: apps/note/tables.py:190 +msgid "Trust back" +msgstr "Ajouter en ami" + +#: apps/note/tables.py:210 +msgid "Add back" +msgstr "Ajouter" + +#: apps/note/tables.py:261 apps/note/templates/note/conso_form.html:132 #: apps/wei/tables.py:49 apps/wei/tables.py:50 #: apps/wei/templates/wei/base.html:89 #: apps/wei/templates/wei/bus_detail.html:20 @@ -1621,7 +1637,7 @@ msgstr "Supprimer" msgid "Edit" msgstr "Éditer" -#: apps/note/tables.py:226 apps/note/tables.py:253 +#: apps/note/tables.py:265 apps/note/tables.py:292 msgid "Hide/Show" msgstr "Afficher/Masquer" From f099cbc8797a9eef9ee6d7321c3df261fa3815a4 Mon Sep 17 00:00:00 2001 From: Nicolas Margulies Date: Wed, 28 Sep 2022 12:50:11 +0200 Subject: [PATCH 06/11] Linting --- apps/member/views.py | 1 - apps/note/tables.py | 5 +++-- apps/treasury/models.py | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/apps/member/views.py b/apps/member/views.py index 2bc2133c..066a7ef3 100644 --- a/apps/member/views.py +++ b/apps/member/views.py @@ -8,7 +8,6 @@ from django.contrib.auth import logout from django.contrib.auth.mixins import LoginRequiredMixin from django.contrib.auth.models import User from django.contrib.auth.views import LoginView -from django.contrib.contenttypes.models import ContentType from django.db import transaction from django.db.models import Q, F from django.shortcuts import redirect diff --git a/apps/note/tables.py b/apps/note/tables.py index 0a0fd4ed..11d8ba78 100644 --- a/apps/note/tables.py +++ b/apps/note/tables.py @@ -172,6 +172,7 @@ class TrustTable(tables.Table): else '')}}, verbose_name=_("Delete"),) + class TrustedTable(tables.Table): class Meta: attrs = { @@ -184,7 +185,7 @@ class TrustedTable(tables.Table): show_header = False trusting = tables.Column(attrs={ - 'td': {'class': 'text-center', 'width':'100%'}}) + 'td': {'class': 'text-center', 'width': '100%'}}) trust_back = tables.Column( verbose_name=_("Trust back"), @@ -200,7 +201,7 @@ class TrustedTable(tables.Table): def render_trust_back(self, record): user_note = record.trusted trusting_note = record.trusting - if Trust.objects.filter(trusted=trusting_note, trusting=user_note) : + if Trust.objects.filter(trusted=trusting_note, trusting=user_note): return "" val = '