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

Compare commits

..

1 Commits

Author SHA1 Message Date
1c5e951c2f Merge branch 'beta' into 'master'
Various fixes

See merge request bde/nk20!133
2020-10-07 12:06:48 +02:00
39 changed files with 160 additions and 946 deletions

View File

@ -267,18 +267,14 @@ La documentation plus haut niveau sur le développement est disponible sur [le W
### Regénérer les fichiers de traduction ### Regénérer les fichiers de traduction
Pour regénérer les traductions vous pouvez vous placer à la racine du projet et lancer le script `makemessages`. Pour regénérer les traductions vous pouvez vous placer à la racine du projet et lancer le script `makemessages`. Il faut penser à ignorer les dossiers ne contenant pas notre code, dont le virtualenv.
Il faut penser à ignorer les dossiers ne contenant pas notre code, dont le virtualenv.
De plus, il faut aussi extraire les variables des fichiers JavaScript.
```bash ```bash
python3 manage.py makemessages -i env django-admin makemessages -i env
python3 manage.py makemessages -i env -e js -d djangojs
``` ```
Une fois les fichiers édités, vous pouvez compiler les nouvelles traductions avec Une fois les fichiers édités, vous pouvez compiler les nouvelles traductions avec
```bash ```bash
python3 manage.py compilemessages django-admin compilemessages
python3 manage.py compilejsmessages
``` ```

View File

@ -1,10 +1,4 @@
--- ---
- name: Collect static files
command: /var/www/note_kfet/env/bin/python manage.py collectstatic --noinput
args:
chdir: /var/www/note_kfet
become_user: www-data
- name: Migrate Django database - name: Migrate Django database
command: /var/www/note_kfet/env/bin/python manage.py migrate command: /var/www/note_kfet/env/bin/python manage.py migrate
args: args:
@ -17,14 +11,14 @@
chdir: /var/www/note_kfet chdir: /var/www/note_kfet
become_user: www-data become_user: www-data
- name: Compile JavaScript messages
command: /var/www/note_kfet/env/bin/python manage.py compilejsmessages
args:
chdir: /var/www/note_kfet
become_user: www-data
- name: Install initial fixtures - name: Install initial fixtures
command: /var/www/note_kfet/env/bin/python manage.py loaddata initial command: /var/www/note_kfet/env/bin/python manage.py loaddata initial
args: args:
chdir: /var/www/note_kfet chdir: /var/www/note_kfet
become_user: postgres become_user: postgres
- name: Collect static files
command: /var/www/note_kfet/env/bin/python manage.py collectstatic --noinput
args:
chdir: /var/www/note_kfet
become_user: www-data

View File

@ -30,7 +30,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
headers: {"X-CSRFTOKEN": CSRF_TOKEN} headers: {"X-CSRFTOKEN": CSRF_TOKEN}
}) })
.done(function() { .done(function() {
addMsg('{% trans "Guest deleted" %}', 'success'); addMsg('Invité supprimé','success');
$("#guests_table").load(location.pathname + " #guests_table"); $("#guests_table").load(location.pathname + " #guests_table");
}) })
.fail(function(xhr, textStatus, error) { .fail(function(xhr, textStatus, error) {

View File

@ -86,10 +86,10 @@ SPDX-License-Identifier: GPL-3.0-or-later
}).done(function () { }).done(function () {
if (target.hasClass("table-info")) if (target.hasClass("table-info"))
addMsg( addMsg(
"{% trans "Entry done, but caution: the user is not a Kfet member." %}", "Entrée effectuée, mais attention : la personne n'est plus adhérente Kfet.",
"warning", 10000); "warning", 10000);
else else
addMsg("Entry made!", "success", 4000); addMsg("Entrée effectuée !", "success", 4000);
reloadTable(true); reloadTable(true);
}).fail(function (xhr) { }).fail(function (xhr) {
errMsg(xhr.responseJSON, 4000); errMsg(xhr.responseJSON, 4000);
@ -121,10 +121,10 @@ SPDX-License-Identifier: GPL-3.0-or-later
}).done(function () { }).done(function () {
if (target.hasClass("table-info")) if (target.hasClass("table-info"))
addMsg( addMsg(
"{% trans "Entry done, but caution: the user is not a Kfet member." %}", "Entrée effectuée, mais attention : la personne n'est plus adhérente Kfet.",
"warning", 10000); "warning", 10000);
else else
addMsg("{% trans "Entry done!" %}", "success", 4000); addMsg("Entrée effectuée !", "success", 4000);
reloadTable(true); reloadTable(true);
}).fail(function (xhr) { }).fail(function (xhr) {
errMsg(xhr.responseJSON, 4000); errMsg(xhr.responseJSON, 4000);

View File

@ -1,50 +0,0 @@
import sys
from django.db import migrations
def give_note_account_permissions(apps, schema_editor):
"""
Automatically manage the membership of the Note account.
"""
User = apps.get_model("auth", "user")
Membership = apps.get_model("member", "membership")
Role = apps.get_model("permission", "role")
note = User.objects.filter(username="note")
if not note.exists():
# We are in a test environment, don't log error message
if len(sys.argv) > 1 and sys.argv[1] == 'test':
return
print("Warning: Note account was not found. The note account was not imported.")
print("Make sure you have imported the NK15 database. The new import script handles correctly the permissions.")
print("This migration will be ignored, you can re-run it if you forgot the note account or ignore it if you "
"don't want this account.")
return
note = note.get()
# Set for the two clubs a large expiration date and the correct role.
for m in Membership.objects.filter(user_id=note.id).all():
m.date_end = "3142-12-12"
m.roles.set(Role.objects.filter(name="PC Kfet").all())
m.save()
# By default, the note account is only authorized to be logged from localhost.
note.password = "ipbased$127.0.0.1"
note.is_active = True
note.save()
# Ensure that the note of the account is disabled
note.note.inactivity_reason = 'forced'
note.note.is_active = False
note.save()
class Migration(migrations.Migration):
dependencies = [
('member', '0005_remove_null_tag_on_charfields'),
('permission', '0001_initial'),
]
operations = [
migrations.RunPython(give_note_account_permissions),
]

View File

@ -14,7 +14,7 @@ function create_alias (e) {
}).done(function () { }).done(function () {
// Reload table // Reload table
$('#alias_table').load(location.pathname + ' #alias_table') $('#alias_table').load(location.pathname + ' #alias_table')
addMsg(gettext('Alias successfully added'), 'success') addMsg('Alias ajouté', 'success')
}).fail(function (xhr, _textStatus, _error) { }).fail(function (xhr, _textStatus, _error) {
errMsg(xhr.responseJSON) errMsg(xhr.responseJSON)
}) })
@ -22,7 +22,7 @@ function create_alias (e) {
/** /**
* On click of "delete", delete the alias * On click of "delete", delete the alias
* @param button_id:Integer Alias id to remove * @param Integer button_id Alias id to remove
*/ */
function delete_button (button_id) { function delete_button (button_id) {
$.ajax({ $.ajax({
@ -30,7 +30,7 @@ function delete_button (button_id) {
method: 'DELETE', method: 'DELETE',
headers: { 'X-CSRFTOKEN': CSRF_TOKEN } headers: { 'X-CSRFTOKEN': CSRF_TOKEN }
}).done(function () { }).done(function () {
addMsg(gettext('Alias successfully deleted'), 'success') addMsg('Alias supprimé', 'success')
$('#alias_table').load(location.pathname + ' #alias_table') $('#alias_table').load(location.pathname + ' #alias_table')
}).fail(function (xhr, _textStatus, _error) { }).fail(function (xhr, _textStatus, _error) {
errMsg(xhr.responseJSON) errMsg(xhr.responseJSON)

View File

@ -43,24 +43,8 @@ class UserTable(tables.Table):
section = tables.Column(accessor='profile__section') section = tables.Column(accessor='profile__section')
# Override the column to let replace the URL
email = tables.EmailColumn(linkify=lambda record: "mailto:{}".format(record.email))
balance = tables.Column(accessor='note__balance', verbose_name=_("Balance")) balance = tables.Column(accessor='note__balance', verbose_name=_("Balance"))
def render_email(self, record, value):
# Replace the email by a dash if the user can't see the profile detail
# Replace also the URL
if not PermissionBackend.check_perm(get_current_authenticated_user(), "member.view_profile", record.profile):
value = ""
record.email = value
return value
def render_section(self, record, value):
return value \
if PermissionBackend.check_perm(get_current_authenticated_user(), "member.view_profile", record.profile) \
else ""
def render_balance(self, record, value): def render_balance(self, record, value):
return pretty_money(value)\ return pretty_money(value)\
if PermissionBackend.check_perm(get_current_authenticated_user(), "note.view_note", record.note) else "" if PermissionBackend.check_perm(get_current_authenticated_user(), "note.view_note", record.note) else ""

View File

@ -25,27 +25,25 @@
</a> </a>
</dd> </dd>
{% if "member.view_profile"|has_perm:user_object.profile %} <dt class="col-xl-6">{% trans 'section'|capfirst %}</dt>
<dt class="col-xl-6">{% trans 'section'|capfirst %}</dt> <dd class="col-xl-6">{{ user_object.profile.section }}</dd>
<dd class="col-xl-6">{{ user_object.profile.section }}</dd>
<dt class="col-xl-6">{% trans 'email'|capfirst %}</dt> <dt class="col-xl-6">{% trans 'email'|capfirst %}</dt>
<dd class="col-xl-6"><a href="mailto:{{ user_object.email }}">{{ user_object.email }}</a></dd> <dd class="col-xl-6"><a href="mailto:{{ user_object.email }}">{{ user_object.email }}</a></dd>
<dt class="col-xl-6">{% trans 'phone number'|capfirst %}</dt> <dt class="col-xl-6">{% trans 'phone number'|capfirst %}</dt>
<dd class="col-xl-6"><a href="tel:{{ user_object.profile.phone_number }}">{{ user_object.profile.phone_number }}</a> <dd class="col-xl-6"><a href="tel:{{ user_object.profile.phone_number }}">{{ user_object.profile.phone_number }}</a>
</dd> </dd>
<dt class="col-xl-6">{% trans 'address'|capfirst %}</dt> <dt class="col-xl-6">{% trans 'address'|capfirst %}</dt>
<dd class="col-xl-6">{{ user_object.profile.address }}</dd> <dd class="col-xl-6">{{ user_object.profile.address }}</dd>
{% if user_object.note and "note.view_note"|has_perm:user_object.note %} {% if user_object.note and "note.view_note"|has_perm:user_object.note %}
<dt class="col-xl-6">{% trans 'balance'|capfirst %}</dt> <dt class="col-xl-6">{% trans 'balance'|capfirst %}</dt>
<dd class="col-xl-6">{{ user_object.note.balance | pretty_money }}</dd> <dd class="col-xl-6">{{ user_object.note.balance | pretty_money }}</dd>
<dt class="col-xl-6">{% trans 'paid'|capfirst %}</dt> <dt class="col-xl-6">{% trans 'paid'|capfirst %}</dt>
<dd class="col-xl-6">{{ user_object.profile.paid|yesno }}</dd> <dd class="col-xl-6">{{ user_object.profile.paid|yesno }}</dd>
{% endif %}
{% endif %} {% endif %}
</dl> </dl>

View File

@ -5,7 +5,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
{% load i18n perms %} {% load i18n perms %}
{% block content %} {% block content %}
{% if can_manage_registrations %} {% if "member.change_profile_registration_valid"|has_perm:user %}
<a class="btn btn-block btn-secondary mb-3" href="{% url 'registration:future_user_list' %}"> <a class="btn btn-block btn-secondary mb-3" href="{% url 'registration:future_user_list' %}">
<i class="fa fa-user-plus"></i> {% trans "Registrations" %} <i class="fa fa-user-plus"></i> {% trans "Registrations" %}
</a> </a>

View File

@ -70,11 +70,10 @@ class UserUpdateView(ProtectQuerysetMixin, LoginRequiredMixin, UpdateView):
form.fields['email'].required = True form.fields['email'].required = True
form.fields['email'].help_text = _("This address must be valid.") form.fields['email'].help_text = _("This address must be valid.")
if PermissionBackend.check_perm(self.request.user, "member.change_profile", context['user_object'].profile): context['profile_form'] = self.profile_form(instance=context['user_object'].profile,
context['profile_form'] = self.profile_form(instance=context['user_object'].profile, data=self.request.POST if self.request.POST else None)
data=self.request.POST if self.request.POST else None) if not self.object.profile.report_frequency:
if not self.object.profile.report_frequency: del context['profile_form'].fields["last_report"]
del context['profile_form'].fields["last_report"]
return context return context
@ -235,13 +234,6 @@ class UserListView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTableView):
return qs return qs
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
pre_registered_users = User.objects.filter(PermissionBackend.filter_queryset(self.request.user, User, "view"))\
.filter(profile__registration_valid=False)
context["can_manage_registrations"] = pre_registered_users.exists()
return context
class ProfileAliasView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView): class ProfileAliasView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView):
""" """
@ -255,8 +247,8 @@ class ProfileAliasView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
note = context['object'].note note = context['object'].note
context["aliases"] = AliasTable( context["aliases"] = AliasTable(note.alias_set.filter(PermissionBackend
note.alias_set.filter(PermissionBackend.filter_queryset(self.request.user, Alias, "view")).distinct().all()) .filter_queryset(self.request.user, Alias, "view")).all())
context["can_create"] = PermissionBackend.check_perm(self.request.user, "note.add_alias", Alias( context["can_create"] = PermissionBackend.check_perm(self.request.user, "note.add_alias", Alias(
note=context["object"].note, note=context["object"].note,
name="", name="",
@ -458,8 +450,8 @@ class ClubAliasView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
note = context['object'].note note = context['object'].note
context["aliases"] = AliasTable(note.alias_set.filter( context["aliases"] = AliasTable(note.alias_set.filter(PermissionBackend
PermissionBackend.filter_queryset(self.request.user, Alias, "view")).distinct().all()) .filter_queryset(self.request.user, Alias, "view")).all())
context["can_create"] = PermissionBackend.check_perm(self.request.user, "note.add_alias", Alias( context["can_create"] = PermissionBackend.check_perm(self.request.user, "note.add_alias", Alias(
note=context["object"].note, note=context["object"].note,
name="", name="",
@ -678,13 +670,11 @@ class ClubAddMemberView(ProtectQuerysetMixin, ProtectedCreateView):
if not last_name or not first_name or (not bank and credit_type.special_type == "Chèque"): if not last_name or not first_name or (not bank and credit_type.special_type == "Chèque"):
if not last_name: if not last_name:
form.add_error('last_name', _("This field is required.")) form.add_error('last_name', _("This field is required."))
error = True
if not first_name: if not first_name:
form.add_error('first_name', _("This field is required.")) form.add_error('first_name', _("This field is required."))
error = True
if not bank and credit_type.special_type == "Chèque": if not bank and credit_type.special_type == "Chèque":
form.add_error('bank', _("This field is required.")) form.add_error('bank', _("This field is required."))
error = True return self.form_invalid(form)
return not error return not error

View File

@ -222,14 +222,17 @@ function consume (source, source_alias, dest, quantity, amount, reason, type, ca
if (!isNaN(source.balance)) { if (!isNaN(source.balance)) {
const newBalance = source.balance - quantity * amount const newBalance = source.balance - quantity * amount
if (newBalance <= -5000) { if (newBalance <= -5000) {
addMsg(interpolate(gettext('Warning, the transaction from the note %s succeed, ' + addMsg('Attention, La transaction depuis la note ' + source_alias + ' a été réalisée avec ' +
'but the emitter note %s is very negative.', [source_alias, source_alias])), 'danger', 30000) 'succès, mais la note émettrice ' + source_alias + ' est en négatif sévère.',
'danger', 30000)
} else if (newBalance < 0) { } else if (newBalance < 0) {
addMsg(interpolate(gettext('Warning, the transaction from the note %s succeed, ' + addMsg('Attention, La transaction depuis la note ' + source_alias + ' a été réalisée avec ' +
'but the emitter note %s is negative.', [source_alias, source_alias])), 'warning', 30000) 'succès, mais la note émettrice ' + source_alias + ' est en négatif.',
'warning', 30000)
} }
if (source.membership && source.membership.date_end < new Date().toISOString()) { if (source.membership && source.membership.date_end < new Date().toISOString()) {
addMsg(interpolate(gettext('Warning, the emitter note %s is no more a BDE member.', [source_alias])), 'danger', 30000) addMsg('Attention : la note émettrice ' + source.name + " n'est plus adhérente.",
'danger', 30000)
} }
} }
reset() reset()
@ -250,7 +253,7 @@ function consume (source, source_alias, dest, quantity, amount, reason, type, ca
template: template template: template
}).done(function () { }).done(function () {
reset() reset()
addMsg(gettext("The transaction couldn't be validated because of insufficient balance."), 'danger', 10000) addMsg("La transaction n'a pas pu être validée pour cause de solde insuffisant.", 'danger', 10000)
}).fail(function () { }).fail(function () {
reset() reset()
errMsg(e.responseJSON) errMsg(e.responseJSON)

View File

@ -239,20 +239,20 @@ $('#btn_transfer').click(function () {
if (!amount_field.val() || isNaN(amount_field.val()) || amount_field.val() <= 0) { if (!amount_field.val() || isNaN(amount_field.val()) || amount_field.val() <= 0) {
amount_field.addClass('is-invalid') amount_field.addClass('is-invalid')
$('#amount-required').html('<strong>' + gettext('This field is required and must contain a decimal positive number.') + '</strong>') $('#amount-required').html('<strong>Ce champ est requis et doit comporter un nombre décimal strictement positif.</strong>')
error = true error = true
} }
const amount = Math.floor(100 * amount_field.val()) const amount = Math.floor(100 * amount_field.val())
if (amount > 2147483647) { if (amount > 2147483647) {
amount_field.addClass('is-invalid') amount_field.addClass('is-invalid')
$('#amount-required').html('<strong>' + gettext('The amount must stay under 21,474,836.47 €.') + '</strong>') $('#amount-required').html('<strong>Le montant ne doit pas excéder 21474836.47 €.</strong>')
error = true error = true
} }
if (!reason_field.val() && $('#type_transfer').is(':checked')) { if (!reason_field.val() && $('#type_transfer').is(':checked')) {
reason_field.addClass('is-invalid') reason_field.addClass('is-invalid')
$('#reason-required').html('<strong>' + gettext('This field is required.') + '</strong>') $('#reason-required').html('<strong>Ce champ est requis.</strong>')
error = true error = true
} }
@ -278,8 +278,9 @@ $('#btn_transfer').click(function () {
[...sources_notes_display].forEach(function (source) { [...sources_notes_display].forEach(function (source) {
[...dests_notes_display].forEach(function (dest) { [...dests_notes_display].forEach(function (dest) {
if (source.note.id === dest.note.id) { if (source.note.id === dest.note.id) {
addMsg(interpolate(gettext('Warning: the transaction of %s from %s to %s was not made because ' + addMsg('Attention : la transaction de ' + pretty_money(amount) + ' de la note ' + source.name +
'it is the same source and destination note.'), [pretty_money(amount), source.name, dest.name]), 'warning', 10000) ' vers la note ' + dest.name + " n'a pas été faite car il s'agit de la même note au départ" +
" et à l'arrivée.", 'warning', 10000)
LOCK = false LOCK = false
return return
} }
@ -299,35 +300,43 @@ $('#btn_transfer').click(function () {
destination_alias: dest.name destination_alias: dest.name
}).done(function () { }).done(function () {
if (source.note.membership && source.note.membership.date_end < new Date().toISOString()) { if (source.note.membership && source.note.membership.date_end < new Date().toISOString()) {
addMsg(interpolate(gettext('Warning, the emitter note %s is no more a BDE member.'), [source.name]), 'danger', 30000) addMsg('Attention : la note émettrice ' + source.name + " n'est plus adhérente.",
'danger', 30000)
} }
if (dest.note.membership && dest.note.membership.date_end < new Date().toISOString()) { if (dest.note.membership && dest.note.membership.date_end < new Date().toISOString()) {
addMsg(interpolate(gettext('Warning, the destination note %s is no more a BDE member.'), [source.name]), 'danger', 30000) addMsg('Attention : la note destination ' + dest.name + " n'est plus adhérente.",
'danger', 30000)
} }
if (!isNaN(source.note.balance)) { if (!isNaN(source.note.balance)) {
const newBalance = source.note.balance - source.quantity * dest.quantity * amount const newBalance = source.note.balance - source.quantity * dest.quantity * amount
if (newBalance <= -5000) { if (newBalance <= -5000) {
addMsg(interpolate(gettext('Warning, the transaction of %s from the note %s to the note %s succeed, but the emitter note %s is very negative.'), addMsg('Le transfert de ' +
[pretty_money(source.quantity * dest.quantity * amount), source.name, dest.name, source.name]), 'danger', 10000) pretty_money(source.quantity * dest.quantity * amount) + ' de la note ' +
source.name + ' vers la note ' + dest.name + ' a été fait avec succès, ' +
'mais la note émettrice est en négatif sévère.', 'danger', 10000)
reset() reset()
return return
} else if (newBalance < 0) { } else if (newBalance < 0) {
addMsg(interpolate(gettext('Warning, the transaction of %s from the note %s to the note %s succeed, but the emitter note %s is negative.'), addMsg('Le transfert de ' +
[pretty_money(source.quantity * dest.quantity * amount), source.name, dest.name, source.name]), 'danger', 10000) pretty_money(source.quantity * dest.quantity * amount) + ' de la note ' +
source.name + ' vers la note ' + dest.name + ' a été fait avec succès, ' +
'mais la note émettrice est en négatif.', 'warning', 10000)
reset() reset()
return return
} }
} }
addMsg(interpolate(gettext('Transfer of %s from %s to %s succeed!'), addMsg('Le transfert de ' +
[pretty_money(source.quantity * dest.quantity * amount), source.name, dest.name]), 'success', 10000) pretty_money(source.quantity * dest.quantity * amount) + ' de la note ' + source.name +
' vers la note ' + dest.name + ' a été fait avec succès !', 'success', 10000)
reset() reset()
}).fail(function (err) { // do it again but valid = false }).fail(function (err) { // do it again but valid = false
const errObj = JSON.parse(err.responseText) const errObj = JSON.parse(err.responseText)
if (errObj.non_field_errors) { if (errObj.non_field_errors) {
addMsg(interpolate(gettext('Transfer of %s from %s to %s failed: %s'), addMsg('Le transfert de ' +
[pretty_money(source.quantity * dest.quantity * amount), source.name, dest.name, errObj.non_field_errors]), 'danger') pretty_money(source.quantity * dest.quantity * amount) + ' de la note ' + source.name +
' vers la note ' + dest.name + ' a échoué : ' + errObj.non_field_errors, 'danger')
LOCK = false LOCK = false
return return
} }
@ -347,15 +356,17 @@ $('#btn_transfer').click(function () {
destination: dest.note.id, destination: dest.note.id,
destination_alias: dest.name destination_alias: dest.name
}).done(function () { }).done(function () {
addMsg(interpolate(gettext('Transfer of %s from %s to %s failed: %s'), addMsg('Le transfert de ' +
[pretty_money(source.quantity * dest.quantity * amount), source.name, + dest.name, gettext('insufficient funds')]), 'danger', 10000) pretty_money(source.quantity * dest.quantity * amount) + ' de la note ' + source.name +
' vers la note ' + dest.name + ' a échoué : Solde insuffisant', 'danger', 10000)
reset() reset()
}).fail(function (err) { }).fail(function (err) {
const errObj = JSON.parse(err.responseText) const errObj = JSON.parse(err.responseText)
let error = errObj.detail ? errObj.detail : errObj.non_field_errors let error = errObj.detail ? errObj.detail : errObj.non_field_errors
if (!error) { error = err.responseText } if (!error) { error = err.responseText }
addMsg(interpolate(gettext('Transfer of %s from %s to %s failed: %s'), addMsg('Le transfert de ' +
[pretty_money(source.quantity * dest.quantity * amount), source.name, + dest.name, error]), 'danger') pretty_money(source.quantity * dest.quantity * amount) + ' de la note ' + source.name +
' vers la note ' + dest.name + ' a échoué : ' + error, 'danger')
LOCK = false LOCK = false
}) })
}) })
@ -401,14 +412,14 @@ $('#btn_transfer').click(function () {
first_name: $('#first_name').val(), first_name: $('#first_name').val(),
bank: $('#bank').val() bank: $('#bank').val()
}).done(function () { }).done(function () {
addMsg(gettext('Credit/debit succeed!'), 'success', 10000) addMsg('Le crédit/retrait a bien été effectué !', 'success', 10000)
if (user_note.membership && user_note.membership.date_end < new Date().toISOString()) { addMsg(gettext('Warning, the emitter note %s is no more a BDE member.'), 'danger', 10000) } if (user_note.membership && user_note.membership.date_end < new Date().toISOString()) { addMsg('Attention : la note ' + alias + " n'est plus adhérente.", 'danger', 10000) }
reset() reset()
}).fail(function (err) { }).fail(function (err) {
const errObj = JSON.parse(err.responseText) const errObj = JSON.parse(err.responseText)
let error = errObj.detail ? errObj.detail : errObj.non_field_errors let error = errObj.detail ? errObj.detail : errObj.non_field_errors
if (!error) { error = err.responseText } if (!error) { error = err.responseText }
addMsg(interpolate(gettext('Credit/debit failed: %s'), [error]), 'danger', 10000) addMsg('Le crédit/retrait a échoué : ' + error, 'danger', 10000)
LOCK = false LOCK = false
}) })
} }

View File

@ -799,12 +799,12 @@
"member", "member",
"membership" "membership"
], ],
"query": "{}", "query": "{\"club\": [\"club\"]}",
"type": "change", "type": "change",
"mask": 3, "mask": 3,
"field": "roles", "field": "roles",
"permanent": false, "permanent": false,
"description": "Modifier les rôles d'une adhésion" "description": "Modifier les rôles d'un adhérent d'un club"
} }
}, },
{ {
@ -2081,7 +2081,7 @@
], ],
"query": "{}", "query": "{}",
"type": "change", "type": "change",
"mask": 2, "mask": 1,
"field": "invalidity_reason", "field": "invalidity_reason",
"permanent": false, "permanent": false,
"description": "Modifier la raison d'invalidité d'une transaction" "description": "Modifier la raison d'invalidité d'une transaction"
@ -2807,70 +2807,6 @@
"description": "Voir ses propres alias, pour toujours" "description": "Voir ses propres alias, pour toujours"
} }
}, },
{
"model": "permission.permission",
"pk": 180,
"fields": {
"model": [
"auth",
"user"
],
"query": "{\"profile__registration_valid\": false}",
"type": "view",
"mask": 2,
"field": "",
"permanent": false,
"description": "Voir n'importe quel utilisateur non encore inscrit"
}
},
{
"model": "permission.permission",
"pk": 181,
"fields": {
"model": [
"member",
"profile"
],
"query": "{\"registration_valid\": false}",
"type": "view",
"mask": 2,
"field": "",
"permanent": false,
"description": "Voir n'importe quel profil non encore inscrit"
}
},
{
"model": "permission.permission",
"pk": 182,
"fields": {
"model": [
"auth",
"user"
],
"query": "{\"memberships__club__name\": \"BDE\", \"memberships__roles__name\": \"Adhérent BDE\", \"memberships__date_start__lte\": [\"today\"], \"memberships__date_end__gte\": [\"today\"]}",
"type": "view",
"mask": 2,
"field": "",
"permanent": false,
"description": "Voir n'importe quel utilisateur qui est adhérent BDE"
}
},
{
"model": "permission.permission",
"pk": 183,
"fields": {
"model": [
"note",
"note"
],
"query": "{}",
"type": "change",
"mask": 1,
"field": "display_image",
"permanent": false,
"description": "Changer l'image de n'importe quelle note"
}
},
{ {
"model": "permission.role", "model": "permission.role",
"pk": 1, "pk": 1,
@ -3003,14 +2939,14 @@
62, 62,
127, 127,
133, 133,
135,
136, 136,
141, 141,
142, 142,
150, 150,
166, 166,
167, 167,
168, 168
182
] ]
} }
}, },
@ -3086,8 +3022,7 @@
175, 175,
176, 176,
177, 177,
178, 178
183
] ]
} }
}, },
@ -3270,12 +3205,7 @@
175, 175,
176, 176,
177, 177,
178, 178
179,
180,
181,
182,
183
] ]
} }
}, },
@ -3309,12 +3239,7 @@
170, 170,
171, 171,
176, 176,
177, 177
178,
179,
180,
181,
182
] ]
} }
}, },
@ -3477,6 +3402,7 @@
135, 135,
136, 136,
137, 137,
138,
139, 139,
140, 140,
143, 143,
@ -3489,41 +3415,6 @@
] ]
} }
}, },
{
"model": "permission.role",
"pk": 20,
"fields": {
"for_club": 2,
"name": "PC Kfet",
"permissions": [
6,
22,
24,
25,
26,
27,
30,
49,
50,
55,
56,
57,
58,
137,
143,
147,
150,
166,
167,
168,
176,
177,
180,
181,
182
]
}
},
{ {
"model": "wei.weirole", "model": "wei.weirole",
"pk": 12, "pk": 12,

View File

@ -45,7 +45,6 @@ class InstancedPermission:
with transaction.atomic(): with transaction.atomic():
sid = transaction.savepoint() sid = transaction.savepoint()
for o in self.model.model_class().objects.filter(pk=0).all(): for o in self.model.model_class().objects.filter(pk=0).all():
o._no_signal = True
o._force_delete = True o._force_delete = True
Model.delete(o) Model.delete(o)
# An object with pk 0 wouldn't deleted. That's not normal, we alert admins. # An object with pk 0 wouldn't deleted. That's not normal, we alert admins.
@ -63,6 +62,10 @@ class InstancedPermission:
obj._no_signal = True obj._no_signal = True
Model.save(obj, force_insert=True) Model.save(obj, force_insert=True)
ret = self.model.model_class().objects.filter(self.query & Q(pk=0)).exists() ret = self.model.model_class().objects.filter(self.query & Q(pk=0)).exists()
# Delete testing object
obj._no_signal = True
obj._force_delete = True
Model.delete(obj)
transaction.savepoint_rollback(sid) transaction.savepoint_rollback(sid)
return ret return ret

View File

@ -51,10 +51,8 @@ class ProtectQuerysetMixin:
# No worry if the user change the hidden fields: a 403 error will be performed if the user tries to make # No worry if the user change the hidden fields: a 403 error will be performed if the user tries to make
# a custom request. # a custom request.
# We could also delete the field, but some views might be affected. # We could also delete the field, but some views might be affected.
meta = form.instance._meta
for key in form.base_fields: for key in form.base_fields:
if not PermissionBackend.check_perm(self.request.user, if not PermissionBackend.check_perm(self.request.user, "wei.change_weiregistration_" + key, self.object):
f"{meta.app_label}.change_{meta.model_name}_" + key, self.object):
form.fields[key].widget = HiddenInput() form.fields[key].widget = HiddenInput()
return form return form

View File

@ -4,8 +4,6 @@
import django_tables2 as tables import django_tables2 as tables
from django.contrib.auth.models import User from django.contrib.auth.models import User
from treasury.models import SogeCredit
class FutureUserTable(tables.Table): class FutureUserTable(tables.Table):
""" """
@ -23,7 +21,6 @@ class FutureUserTable(tables.Table):
fields = ('last_name', 'first_name', 'username', 'email', ) fields = ('last_name', 'first_name', 'username', 'email', )
model = User model = User
row_attrs = { row_attrs = {
'class': lambda record: 'table-row' 'class': 'table-row',
+ (' bg-warning' if SogeCredit.objects.filter(user=record).exists() else ''),
'data-href': lambda record: record.pk 'data-href': lambda record: record.pk
} }

View File

@ -235,7 +235,7 @@ class FutureUserDetailView(ProtectQuerysetMixin, LoginRequiredMixin, FormMixin,
fee += 8000 fee += 8000
ctx["total_fee"] = "{:.02f}".format(fee / 100, ) ctx["total_fee"] = "{:.02f}".format(fee / 100, )
ctx["declare_soge_account"] = SogeCredit.objects.filter(user=user).exists() ctx["declare_soge_account"] = True
return ctx return ctx

View File

@ -28,8 +28,6 @@ class TreasuryConfig(AppConfig):
source__in=NoteSpecial.objects.filter(~Q(remittancetype=None)), source__in=NoteSpecial.objects.filter(~Q(remittancetype=None)),
specialtransactionproxy=None, specialtransactionproxy=None,
): ):
proxy = SpecialTransactionProxy(transaction=transaction, remittance=None) SpecialTransactionProxy.objects.create(transaction=transaction, remittance=None)
proxy._force_save = True
proxy.save()
post_migrate.connect(setup_specialtransactions_proxies, sender=SpecialTransactionProxy) post_migrate.connect(setup_specialtransactions_proxies, sender=SpecialTransactionProxy)

View File

@ -10,8 +10,9 @@ def save_special_transaction(instance, created, **kwargs):
""" """
if not hasattr(instance, "_no_signal"): if not hasattr(instance, "_no_signal"):
if created and RemittanceType.objects.filter( if instance.is_credit():
note=instance.source if instance.is_credit() else instance.destination).exists(): if created and RemittanceType.objects.filter(note=instance.source).exists():
proxy = SpecialTransactionProxy(transaction=instance, remittance=None) SpecialTransactionProxy.objects.create(transaction=instance, remittance=None).save()
proxy._force_save = True else:
proxy.save() if created and RemittanceType.objects.filter(note=instance.destination).exists():
SpecialTransactionProxy.objects.create(transaction=instance, remittance=None).save()

View File

@ -147,4 +147,4 @@ class SogeCreditTable(tables.Table):
class Meta: class Meta:
model = SogeCredit model = SogeCredit
fields = ('user', 'user__last_name', 'user__first_name', 'amount', 'valid', ) fields = ('user', 'amount', 'valid', )

View File

@ -11,14 +11,8 @@ SPDX-License-Identifier: GPL-3.0-or-later
</div> </div>
<div class="card-body"> <div class="card-body">
<dl class="row"> <dl class="row">
<dt class="col-xl-6 text-right">{% trans 'last name'|capfirst %}</dt> <dt class="col-xl-6 text-right">{% trans 'user'|capfirst %}</dt>
<dd class="col-xl-6">{{ object.user.last_name }}</dd> <dd class="col-xl-6"><a href="{% url 'member:user_detail' pk=object.user.pk %}">{{ object.user }}</a></dd>
<dt class="col-xl-6 text-right">{% trans 'first name'|capfirst %}</dt>
<dd class="col-xl-6">{{ object.user.first_name }}</dd>
<dt class="col-xl-6 text-right">{% trans 'username'|capfirst %}</dt>
<dd class="col-xl-6"><a href="{% url 'member:user_detail' pk=object.user.pk %}">{{ object.user.username }}</a></dd>
{% if "note.view_note_balance"|has_perm:object.user.note %} {% if "note.view_note_balance"|has_perm:object.user.note %}
<dt class="col-xl-6 text-right">{% trans 'balance'|capfirst %}</dt> <dt class="col-xl-6 text-right">{% trans 'balance'|capfirst %}</dt>

View File

@ -14,7 +14,6 @@ fi
# Set up Django project # Set up Django project
python3 manage.py collectstatic --noinput python3 manage.py collectstatic --noinput
python3 manage.py compilemessages python3 manage.py compilemessages
python3 manage.py compilejsmessages
python3 manage.py migrate python3 manage.py migrate
if [ "$1" ]; then if [ "$1" ]; then

View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-11-15 23:26+0100\n" "POT-Creation-Date: 2020-10-07 11:42+0200\n"
"PO-Revision-Date: 2020-09-13 12:39+0200\n" "PO-Revision-Date: 2020-09-13 12:39+0200\n"
"Last-Translator: elkmaennchen <elkmaennchen@crans.org>\n" "Last-Translator: elkmaennchen <elkmaennchen@crans.org>\n"
"Language-Team: \n" "Language-Team: \n"
@ -279,17 +279,11 @@ msgstr "Kontostand"
msgid "Guests list" msgid "Guests list"
msgstr "Gastliste" msgstr "Gastliste"
#: apps/activity/templates/activity/activity_detail.html:33
#, fuzzy
#| msgid "Guests list"
msgid "Guest deleted"
msgstr "Gastliste"
#: apps/activity/templates/activity/activity_entry.html:14 #: apps/activity/templates/activity/activity_entry.html:14
#: apps/note/models/transactions.py:256 #: apps/note/models/transactions.py:256
#: apps/note/templates/note/transaction_form.html:16 #: apps/note/templates/note/transaction_form.html:16
#: apps/note/templates/note/transaction_form.html:148 #: apps/note/templates/note/transaction_form.html:148
#: note_kfet/templates/base.html:73 #: note_kfet/templates/base.html:70
msgid "Transfer" msgid "Transfer"
msgstr "Überweisen" msgstr "Überweisen"
@ -314,17 +308,6 @@ msgstr "Eintritte"
msgid "Return to activity page" msgid "Return to activity page"
msgstr "Zurück zur Veranstaltungseite" msgstr "Zurück zur Veranstaltungseite"
#: apps/activity/templates/activity/activity_entry.html:89
#: apps/activity/templates/activity/activity_entry.html:124
msgid "Entry done, but caution: the user is not a Kfet member."
msgstr ""
#: apps/activity/templates/activity/activity_entry.html:127
#, fuzzy
#| msgid "Entry page"
msgid "Entry done!"
msgstr "Eintrittseite"
#: apps/activity/templates/activity/activity_form.html:16 #: apps/activity/templates/activity/activity_form.html:16
#: apps/member/templates/member/add_members.html:46 #: apps/member/templates/member/add_members.html:46
#: apps/member/templates/member/club_form.html:16 #: apps/member/templates/member/club_form.html:16
@ -395,7 +378,7 @@ msgstr "Einladen"
msgid "Create new activity" msgid "Create new activity"
msgstr "Neue Veranstaltung schaffen" msgstr "Neue Veranstaltung schaffen"
#: apps/activity/views.py:67 note_kfet/templates/base.html:91 #: apps/activity/views.py:67 note_kfet/templates/base.html:88
msgid "Activities" msgid "Activities"
msgstr "Veranstaltungen" msgstr "Veranstaltungen"
@ -1637,7 +1620,7 @@ msgstr "Tatsen finden"
msgid "Update button" msgid "Update button"
msgstr "Tatse bearbeiten" msgstr "Tatse bearbeiten"
#: apps/note/views.py:151 note_kfet/templates/base.html:67 #: apps/note/views.py:151 note_kfet/templates/base.html:64
msgid "Consumptions" msgid "Consumptions"
msgstr "Verbräuche" msgstr "Verbräuche"
@ -1815,7 +1798,7 @@ msgstr ""
"diesen Parametern zu erstellen. Bitte korrigieren Sie Ihre Daten und " "diesen Parametern zu erstellen. Bitte korrigieren Sie Ihre Daten und "
"versuchen Sie es erneut." "versuchen Sie es erneut."
#: apps/permission/views.py:110 note_kfet/templates/base.html:109 #: apps/permission/views.py:110 note_kfet/templates/base.html:106
msgid "Rights" msgid "Rights"
msgstr "Rechten" msgstr "Rechten"
@ -2024,7 +2007,7 @@ msgstr ""
msgid "Invalidate pre-registration" msgid "Invalidate pre-registration"
msgstr "Ungültige Vorregistrierung" msgstr "Ungültige Vorregistrierung"
#: apps/treasury/apps.py:12 note_kfet/templates/base.html:97 #: apps/treasury/apps.py:12 note_kfet/templates/base.html:94
msgid "Treasury" msgid "Treasury"
msgstr "Quaestor" msgstr "Quaestor"
@ -2426,7 +2409,7 @@ msgstr "Krediten von der Société générale handeln"
#: apps/wei/apps.py:10 apps/wei/models.py:49 apps/wei/models.py:50 #: apps/wei/apps.py:10 apps/wei/models.py:49 apps/wei/models.py:50
#: apps/wei/models.py:61 apps/wei/models.py:167 #: apps/wei/models.py:61 apps/wei/models.py:167
#: note_kfet/templates/base.html:103 #: note_kfet/templates/base.html:100
msgid "WEI" msgid "WEI"
msgstr "WEI" msgstr "WEI"
@ -3038,34 +3021,34 @@ msgstr "Reset"
msgid "The ENS Paris-Saclay BDE note." msgid "The ENS Paris-Saclay BDE note."
msgstr "Die BDE ENS-Paris-Saclay Note." msgstr "Die BDE ENS-Paris-Saclay Note."
#: note_kfet/templates/base.html:79 #: note_kfet/templates/base.html:76
msgid "Users" msgid "Users"
msgstr "Users" msgstr "Users"
#: note_kfet/templates/base.html:85 #: note_kfet/templates/base.html:82
msgid "Clubs" msgid "Clubs"
msgstr "Clubs" msgstr "Clubs"
#: note_kfet/templates/base.html:114 #: note_kfet/templates/base.html:111
msgid "Admin" msgid "Admin"
msgstr "Admin" msgstr "Admin"
#: note_kfet/templates/base.html:128 #: note_kfet/templates/base.html:125
msgid "My account" msgid "My account"
msgstr "Mein Konto" msgstr "Mein Konto"
#: note_kfet/templates/base.html:131 #: note_kfet/templates/base.html:128
msgid "Log out" msgid "Log out"
msgstr "Abmelden" msgstr "Abmelden"
#: note_kfet/templates/base.html:139 #: note_kfet/templates/base.html:136
#: note_kfet/templates/registration/signup.html:6 #: note_kfet/templates/registration/signup.html:6
#: note_kfet/templates/registration/signup.html:11 #: note_kfet/templates/registration/signup.html:11
#: note_kfet/templates/registration/signup.html:28 #: note_kfet/templates/registration/signup.html:28
msgid "Sign up" msgid "Sign up"
msgstr "Registrieren" msgstr "Registrieren"
#: note_kfet/templates/base.html:146 #: note_kfet/templates/base.html:143
#: note_kfet/templates/registration/login.html:6 #: note_kfet/templates/registration/login.html:6
#: note_kfet/templates/registration/login.html:15 #: note_kfet/templates/registration/login.html:15
#: note_kfet/templates/registration/login.html:38 #: note_kfet/templates/registration/login.html:38

View File

@ -1,119 +0,0 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-11-15 23:21+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: apps/member/static/member/js/alias.js:17
msgid "Alias successfully added"
msgstr ""
#: apps/member/static/member/js/alias.js:33
msgid "Alias successfully deleted"
msgstr ""
#: apps/note/static/note/js/consos.js:225
#, javascript-format
msgid ""
"Warning, the transaction from the note %s succeed, but the emitter note %s "
"is very negative."
msgstr ""
#: apps/note/static/note/js/consos.js:228
#, javascript-format
msgid ""
"Warning, the transaction from the note %s succeed, but the emitter note %s "
"is negative."
msgstr ""
#: apps/note/static/note/js/consos.js:232
#: apps/note/static/note/js/transfer.js:298
#: apps/note/static/note/js/transfer.js:401
#, javascript-format
msgid "Warning, the emitter note %s is no more a BDE member."
msgstr ""
#: apps/note/static/note/js/consos.js:253
msgid "The transaction couldn't be validated because of insufficient balance."
msgstr ""
#: apps/note/static/note/js/transfer.js:238
msgid "This field is required and must contain a decimal positive number."
msgstr ""
#: apps/note/static/note/js/transfer.js:245
msgid "The amount must stay under 21,474,836.47 €."
msgstr ""
#: apps/note/static/note/js/transfer.js:251
msgid "This field is required."
msgstr ""
#: apps/note/static/note/js/transfer.js:277
#, javascript-format
msgid ""
"Warning: the transaction of %s from %s to %s was not made because it is the "
"same source and destination note."
msgstr ""
#: apps/note/static/note/js/transfer.js:301
#, javascript-format
msgid "Warning, the destination note %s is no more a BDE member."
msgstr ""
#: apps/note/static/note/js/transfer.js:307
#, javascript-format
msgid ""
"Warning, the transaction of %s from the note %s to the note %s succeed, but "
"the emitter note %s is very negative."
msgstr ""
#: apps/note/static/note/js/transfer.js:312
#, javascript-format
msgid ""
"Warning, the transaction of %s from the note %s to the note %s succeed, but "
"the emitter note %s is negative."
msgstr ""
#: apps/note/static/note/js/transfer.js:318
#, javascript-format
msgid "Transfer of %s from %s to %s succeed!"
msgstr ""
#: apps/note/static/note/js/transfer.js:325
#: apps/note/static/note/js/transfer.js:346
#: apps/note/static/note/js/transfer.js:353
#, javascript-format
msgid "Transfer of %s from %s to %s failed: %s"
msgstr ""
#: apps/note/static/note/js/transfer.js:347
msgid "insufficient funds"
msgstr ""
#: apps/note/static/note/js/transfer.js:400
msgid "Credit/debit succeed!"
msgstr ""
#: apps/note/static/note/js/transfer.js:407
#, javascript-format
msgid "Credit/debit failed: %s"
msgstr ""
#: note_kfet/static/js/base.js:366
msgid "An error occured while (in)validating this transaction:"
msgstr ""

View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-11-15 23:26+0100\n" "POT-Creation-Date: 2020-10-07 11:42+0200\n"
"PO-Revision-Date: 2020-09-19 14:56+0200\n" "PO-Revision-Date: 2020-09-19 14:56+0200\n"
"Last-Translator: elkmaennchen <elkmaennchen@crans.org>\n" "Last-Translator: elkmaennchen <elkmaennchen@crans.org>\n"
"Language-Team: \n" "Language-Team: \n"
@ -278,17 +278,11 @@ msgstr "Saldo de la cuenta"
msgid "Guests list" msgid "Guests list"
msgstr "Lista de los invitados" msgstr "Lista de los invitados"
#: apps/activity/templates/activity/activity_detail.html:33
#, fuzzy
#| msgid "Guests list"
msgid "Guest deleted"
msgstr "Lista de los invitados"
#: apps/activity/templates/activity/activity_entry.html:14 #: apps/activity/templates/activity/activity_entry.html:14
#: apps/note/models/transactions.py:256 #: apps/note/models/transactions.py:256
#: apps/note/templates/note/transaction_form.html:16 #: apps/note/templates/note/transaction_form.html:16
#: apps/note/templates/note/transaction_form.html:148 #: apps/note/templates/note/transaction_form.html:148
#: note_kfet/templates/base.html:73 #: note_kfet/templates/base.html:70
msgid "Transfer" msgid "Transfer"
msgstr "Transferencia" msgstr "Transferencia"
@ -313,17 +307,6 @@ msgstr "Entradas"
msgid "Return to activity page" msgid "Return to activity page"
msgstr "Regresar a la página de la actividad" msgstr "Regresar a la página de la actividad"
#: apps/activity/templates/activity/activity_entry.html:89
#: apps/activity/templates/activity/activity_entry.html:124
msgid "Entry done, but caution: the user is not a Kfet member."
msgstr ""
#: apps/activity/templates/activity/activity_entry.html:127
#, fuzzy
#| msgid "Entry page"
msgid "Entry done!"
msgstr "Página de las entradas"
#: apps/activity/templates/activity/activity_form.html:16 #: apps/activity/templates/activity/activity_form.html:16
#: apps/member/templates/member/add_members.html:46 #: apps/member/templates/member/add_members.html:46
#: apps/member/templates/member/club_form.html:16 #: apps/member/templates/member/club_form.html:16
@ -394,7 +377,7 @@ msgstr "Invitar"
msgid "Create new activity" msgid "Create new activity"
msgstr "Crear una nueva actividad" msgstr "Crear una nueva actividad"
#: apps/activity/views.py:67 note_kfet/templates/base.html:91 #: apps/activity/views.py:67 note_kfet/templates/base.html:88
msgid "Activities" msgid "Activities"
msgstr "Actividades" msgstr "Actividades"
@ -1634,7 +1617,7 @@ msgstr "Buscar un botón"
msgid "Update button" msgid "Update button"
msgstr "Modificar el botón" msgstr "Modificar el botón"
#: apps/note/views.py:151 note_kfet/templates/base.html:67 #: apps/note/views.py:151 note_kfet/templates/base.html:64
msgid "Consumptions" msgid "Consumptions"
msgstr "Consumiciones" msgstr "Consumiciones"
@ -1810,7 +1793,7 @@ msgid ""
"with these parameters. Please correct your data and retry." "with these parameters. Please correct your data and retry."
msgstr "" msgstr ""
#: apps/permission/views.py:110 note_kfet/templates/base.html:109 #: apps/permission/views.py:110 note_kfet/templates/base.html:106
msgid "Rights" msgid "Rights"
msgstr "Permisos" msgstr "Permisos"
@ -2018,7 +2001,7 @@ msgstr ""
msgid "Invalidate pre-registration" msgid "Invalidate pre-registration"
msgstr "Invalidar la afiliación" msgstr "Invalidar la afiliación"
#: apps/treasury/apps.py:12 note_kfet/templates/base.html:97 #: apps/treasury/apps.py:12 note_kfet/templates/base.html:94
msgid "Treasury" msgid "Treasury"
msgstr "Tesorería" msgstr "Tesorería"
@ -2415,7 +2398,7 @@ msgstr "Gestionar los créditos de la Société Générale"
#: apps/wei/apps.py:10 apps/wei/models.py:49 apps/wei/models.py:50 #: apps/wei/apps.py:10 apps/wei/models.py:49 apps/wei/models.py:50
#: apps/wei/models.py:61 apps/wei/models.py:167 #: apps/wei/models.py:61 apps/wei/models.py:167
#: note_kfet/templates/base.html:103 #: note_kfet/templates/base.html:100
msgid "WEI" msgid "WEI"
msgstr "WEI" msgstr "WEI"
@ -3020,34 +3003,34 @@ msgstr ""
msgid "The ENS Paris-Saclay BDE note." msgid "The ENS Paris-Saclay BDE note."
msgstr "La note del BDE de la ENS Paris-Saclay." msgstr "La note del BDE de la ENS Paris-Saclay."
#: note_kfet/templates/base.html:79 #: note_kfet/templates/base.html:76
msgid "Users" msgid "Users"
msgstr "Usuarios" msgstr "Usuarios"
#: note_kfet/templates/base.html:85 #: note_kfet/templates/base.html:82
msgid "Clubs" msgid "Clubs"
msgstr "Clubs" msgstr "Clubs"
#: note_kfet/templates/base.html:114 #: note_kfet/templates/base.html:111
msgid "Admin" msgid "Admin"
msgstr "" msgstr ""
#: note_kfet/templates/base.html:128 #: note_kfet/templates/base.html:125
msgid "My account" msgid "My account"
msgstr "Mi cuenta" msgstr "Mi cuenta"
#: note_kfet/templates/base.html:131 #: note_kfet/templates/base.html:128
msgid "Log out" msgid "Log out"
msgstr "Desconectarse" msgstr "Desconectarse"
#: note_kfet/templates/base.html:139 #: note_kfet/templates/base.html:136
#: note_kfet/templates/registration/signup.html:6 #: note_kfet/templates/registration/signup.html:6
#: note_kfet/templates/registration/signup.html:11 #: note_kfet/templates/registration/signup.html:11
#: note_kfet/templates/registration/signup.html:28 #: note_kfet/templates/registration/signup.html:28
msgid "Sign up" msgid "Sign up"
msgstr "Registrar" msgstr "Registrar"
#: note_kfet/templates/base.html:146 #: note_kfet/templates/base.html:143
#: note_kfet/templates/registration/login.html:6 #: note_kfet/templates/registration/login.html:6
#: note_kfet/templates/registration/login.html:15 #: note_kfet/templates/registration/login.html:15
#: note_kfet/templates/registration/login.html:38 #: note_kfet/templates/registration/login.html:38

View File

@ -1,119 +0,0 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-11-15 23:21+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: apps/member/static/member/js/alias.js:17
msgid "Alias successfully added"
msgstr ""
#: apps/member/static/member/js/alias.js:33
msgid "Alias successfully deleted"
msgstr ""
#: apps/note/static/note/js/consos.js:225
#, javascript-format
msgid ""
"Warning, the transaction from the note %s succeed, but the emitter note %s "
"is very negative."
msgstr ""
#: apps/note/static/note/js/consos.js:228
#, javascript-format
msgid ""
"Warning, the transaction from the note %s succeed, but the emitter note %s "
"is negative."
msgstr ""
#: apps/note/static/note/js/consos.js:232
#: apps/note/static/note/js/transfer.js:298
#: apps/note/static/note/js/transfer.js:401
#, javascript-format
msgid "Warning, the emitter note %s is no more a BDE member."
msgstr ""
#: apps/note/static/note/js/consos.js:253
msgid "The transaction couldn't be validated because of insufficient balance."
msgstr ""
#: apps/note/static/note/js/transfer.js:238
msgid "This field is required and must contain a decimal positive number."
msgstr ""
#: apps/note/static/note/js/transfer.js:245
msgid "The amount must stay under 21,474,836.47 €."
msgstr ""
#: apps/note/static/note/js/transfer.js:251
msgid "This field is required."
msgstr ""
#: apps/note/static/note/js/transfer.js:277
#, javascript-format
msgid ""
"Warning: the transaction of %s from %s to %s was not made because it is the "
"same source and destination note."
msgstr ""
#: apps/note/static/note/js/transfer.js:301
#, javascript-format
msgid "Warning, the destination note %s is no more a BDE member."
msgstr ""
#: apps/note/static/note/js/transfer.js:307
#, javascript-format
msgid ""
"Warning, the transaction of %s from the note %s to the note %s succeed, but "
"the emitter note %s is very negative."
msgstr ""
#: apps/note/static/note/js/transfer.js:312
#, javascript-format
msgid ""
"Warning, the transaction of %s from the note %s to the note %s succeed, but "
"the emitter note %s is negative."
msgstr ""
#: apps/note/static/note/js/transfer.js:318
#, javascript-format
msgid "Transfer of %s from %s to %s succeed!"
msgstr ""
#: apps/note/static/note/js/transfer.js:325
#: apps/note/static/note/js/transfer.js:346
#: apps/note/static/note/js/transfer.js:353
#, javascript-format
msgid "Transfer of %s from %s to %s failed: %s"
msgstr ""
#: apps/note/static/note/js/transfer.js:347
msgid "insufficient funds"
msgstr ""
#: apps/note/static/note/js/transfer.js:400
msgid "Credit/debit succeed!"
msgstr ""
#: apps/note/static/note/js/transfer.js:407
#, javascript-format
msgid "Credit/debit failed: %s"
msgstr ""
#: note_kfet/static/js/base.js:366
msgid "An error occured while (in)validating this transaction:"
msgstr ""

View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-11-15 23:26+0100\n" "POT-Creation-Date: 2020-10-07 11:42+0200\n"
"PO-Revision-Date: 2020-09-13 12:36+0200\n" "PO-Revision-Date: 2020-09-13 12:36+0200\n"
"Last-Translator: elkmaennchen <elkmaennchen@crans.org>\n" "Last-Translator: elkmaennchen <elkmaennchen@crans.org>\n"
"Language-Team: \n" "Language-Team: \n"
@ -279,15 +279,11 @@ msgstr "Solde du compte"
msgid "Guests list" msgid "Guests list"
msgstr "Liste des invités" msgstr "Liste des invités"
#: apps/activity/templates/activity/activity_detail.html:33
msgid "Guest deleted"
msgstr "Invité supprimé"
#: apps/activity/templates/activity/activity_entry.html:14 #: apps/activity/templates/activity/activity_entry.html:14
#: apps/note/models/transactions.py:256 #: apps/note/models/transactions.py:256
#: apps/note/templates/note/transaction_form.html:16 #: apps/note/templates/note/transaction_form.html:16
#: apps/note/templates/note/transaction_form.html:148 #: apps/note/templates/note/transaction_form.html:148
#: note_kfet/templates/base.html:73 #: note_kfet/templates/base.html:70
msgid "Transfer" msgid "Transfer"
msgstr "Virement" msgstr "Virement"
@ -312,16 +308,6 @@ msgstr "Entrées"
msgid "Return to activity page" msgid "Return to activity page"
msgstr "Retour à la page de l'activité" msgstr "Retour à la page de l'activité"
#: apps/activity/templates/activity/activity_entry.html:89
#: apps/activity/templates/activity/activity_entry.html:124
msgid "Entry done, but caution: the user is not a Kfet member."
msgstr ""
"Entrée effectuée, mais attention : la personne n'est pas un adhérent Kfet."
#: apps/activity/templates/activity/activity_entry.html:127
msgid "Entry done!"
msgstr "Entrée effectuée !"
#: apps/activity/templates/activity/activity_form.html:16 #: apps/activity/templates/activity/activity_form.html:16
#: apps/member/templates/member/add_members.html:46 #: apps/member/templates/member/add_members.html:46
#: apps/member/templates/member/club_form.html:16 #: apps/member/templates/member/club_form.html:16
@ -392,7 +378,7 @@ msgstr "Inviter"
msgid "Create new activity" msgid "Create new activity"
msgstr "Créer une nouvelle activité" msgstr "Créer une nouvelle activité"
#: apps/activity/views.py:67 note_kfet/templates/base.html:91 #: apps/activity/views.py:67 note_kfet/templates/base.html:88
msgid "Activities" msgid "Activities"
msgstr "Activités" msgstr "Activités"
@ -1636,7 +1622,7 @@ msgstr "Chercher un bouton"
msgid "Update button" msgid "Update button"
msgstr "Modifier le bouton" msgstr "Modifier le bouton"
#: apps/note/views.py:151 note_kfet/templates/base.html:67 #: apps/note/views.py:151 note_kfet/templates/base.html:64
msgid "Consumptions" msgid "Consumptions"
msgstr "Consommations" msgstr "Consommations"
@ -1815,7 +1801,7 @@ msgstr ""
"Vous n'avez pas la permission d'ajouter une instance du modèle « {model} » " "Vous n'avez pas la permission d'ajouter une instance du modèle « {model} » "
"avec ces paramètres. Merci de les corriger et de réessayer." "avec ces paramètres. Merci de les corriger et de réessayer."
#: apps/permission/views.py:110 note_kfet/templates/base.html:109 #: apps/permission/views.py:110 note_kfet/templates/base.html:106
msgid "Rights" msgid "Rights"
msgstr "Droits" msgstr "Droits"
@ -2022,7 +2008,7 @@ msgstr ""
msgid "Invalidate pre-registration" msgid "Invalidate pre-registration"
msgstr "Invalider l'inscription" msgstr "Invalider l'inscription"
#: apps/treasury/apps.py:12 note_kfet/templates/base.html:97 #: apps/treasury/apps.py:12 note_kfet/templates/base.html:94
msgid "Treasury" msgid "Treasury"
msgstr "Trésorerie" msgstr "Trésorerie"
@ -2422,7 +2408,7 @@ msgstr "Gérer les crédits de la Société générale"
#: apps/wei/apps.py:10 apps/wei/models.py:49 apps/wei/models.py:50 #: apps/wei/apps.py:10 apps/wei/models.py:49 apps/wei/models.py:50
#: apps/wei/models.py:61 apps/wei/models.py:167 #: apps/wei/models.py:61 apps/wei/models.py:167
#: note_kfet/templates/base.html:103 #: note_kfet/templates/base.html:100
msgid "WEI" msgid "WEI"
msgstr "WEI" msgstr "WEI"
@ -3034,34 +3020,34 @@ msgstr "Réinitialiser"
msgid "The ENS Paris-Saclay BDE note." msgid "The ENS Paris-Saclay BDE note."
msgstr "La note du BDE de l'ENS Paris-Saclay." msgstr "La note du BDE de l'ENS Paris-Saclay."
#: note_kfet/templates/base.html:79 #: note_kfet/templates/base.html:76
msgid "Users" msgid "Users"
msgstr "Utilisateurs" msgstr "Utilisateurs"
#: note_kfet/templates/base.html:85 #: note_kfet/templates/base.html:82
msgid "Clubs" msgid "Clubs"
msgstr "Clubs" msgstr "Clubs"
#: note_kfet/templates/base.html:114 #: note_kfet/templates/base.html:111
msgid "Admin" msgid "Admin"
msgstr "Admin" msgstr "Admin"
#: note_kfet/templates/base.html:128 #: note_kfet/templates/base.html:125
msgid "My account" msgid "My account"
msgstr "Mon compte" msgstr "Mon compte"
#: note_kfet/templates/base.html:131 #: note_kfet/templates/base.html:128
msgid "Log out" msgid "Log out"
msgstr "Se déconnecter" msgstr "Se déconnecter"
#: note_kfet/templates/base.html:139 #: note_kfet/templates/base.html:136
#: note_kfet/templates/registration/signup.html:6 #: note_kfet/templates/registration/signup.html:6
#: note_kfet/templates/registration/signup.html:11 #: note_kfet/templates/registration/signup.html:11
#: note_kfet/templates/registration/signup.html:28 #: note_kfet/templates/registration/signup.html:28
msgid "Sign up" msgid "Sign up"
msgstr "Inscription" msgstr "Inscription"
#: note_kfet/templates/base.html:146 #: note_kfet/templates/base.html:143
#: note_kfet/templates/registration/login.html:6 #: note_kfet/templates/registration/login.html:6
#: note_kfet/templates/registration/login.html:15 #: note_kfet/templates/registration/login.html:15
#: note_kfet/templates/registration/login.html:38 #: note_kfet/templates/registration/login.html:38

View File

@ -1,134 +0,0 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-11-15 23:21+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: apps/member/static/member/js/alias.js:17
msgid "Alias successfully added"
msgstr "Alias ajouté avec succès"
#: apps/member/static/member/js/alias.js:33
msgid "Alias successfully deleted"
msgstr "Alias supprimé avec succès"
#: apps/note/static/note/js/consos.js:225
#, javascript-format
msgid ""
"Warning, the transaction from the note %s succeed, but the emitter note %s "
"is very negative."
msgstr ""
"Attention, La transaction depuis la note %s a été réalisée avec succès, mais "
"la note émettrice %s est en négatif sévère."
#: apps/note/static/note/js/consos.js:228
#, javascript-format
msgid ""
"Warning, the transaction from the note %s succeed, but the emitter note %s "
"is negative."
msgstr ""
"Attention, La transaction depuis la note %s a été réalisée avec succès, mais "
"la note émettrice %s est en négatif."
#: apps/note/static/note/js/consos.js:232
#: apps/note/static/note/js/transfer.js:298
#: apps/note/static/note/js/transfer.js:401
#, javascript-format
msgid "Warning, the emitter note %s is no more a BDE member."
msgstr "Attention, la note émettrice %s n'est plus adhérente."
#: apps/note/static/note/js/consos.js:253
msgid "The transaction couldn't be validated because of insufficient balance."
msgstr ""
"La transaction n'a pas pu être validée pour cause de solde insuffisant."
#: apps/note/static/note/js/transfer.js:238
msgid "This field is required and must contain a decimal positive number."
msgstr ""
"Ce champ est requis et doit comporter un nombre décimal strictement positif."
#: apps/note/static/note/js/transfer.js:245
msgid "The amount must stay under 21,474,836.47 €."
msgstr "Le montant ne doit pas excéder 21 474 836.47 €."
#: apps/note/static/note/js/transfer.js:251
msgid "This field is required."
msgstr "Ce champ est requis."
#: apps/note/static/note/js/transfer.js:277
#, javascript-format
msgid ""
"Warning: the transaction of %s from %s to %s was not made because it is the "
"same source and destination note."
msgstr ""
"Attention : la transaction de %s de la note %s vers la note %s n'a pas été "
"faite car il s'agit de la même note au départ et à l'arrivée."
#: apps/note/static/note/js/transfer.js:301
#, javascript-format
msgid "Warning, the destination note %s is no more a BDE member."
msgstr "Attention, la note de destination %s n'est plus adhérente."
#: apps/note/static/note/js/transfer.js:307
#, javascript-format
msgid ""
"Warning, the transaction of %s from the note %s to the note %s succeed, but "
"the emitter note %s is very negative."
msgstr ""
"Attention, La transaction de %s depuis la note %s vers la note %s a été "
"réalisée avec succès, mais la note émettrice %s est en négatif sévère."
#: apps/note/static/note/js/transfer.js:312
#, javascript-format
msgid ""
"Warning, the transaction of %s from the note %s to the note %s succeed, but "
"the emitter note %s is negative."
msgstr ""
"Attention, La transaction de %s depuis la note %s vers la note %s a été "
"réalisée avec succès, mais la note émettrice %s est en négatif."
#: apps/note/static/note/js/transfer.js:318
#, javascript-format
msgid "Transfer of %s from %s to %s succeed!"
msgstr ""
"Le transfert de %s de la note %s vers la note %s a été fait avec succès !"
#: apps/note/static/note/js/transfer.js:325
#: apps/note/static/note/js/transfer.js:346
#: apps/note/static/note/js/transfer.js:353
#, javascript-format
msgid "Transfer of %s from %s to %s failed: %s"
msgstr "Le transfert de %s de la note %s vers la note %s a échoué : %s"
#: apps/note/static/note/js/transfer.js:347
msgid "insufficient funds"
msgstr "solde insuffisant"
#: apps/note/static/note/js/transfer.js:400
msgid "Credit/debit succeed!"
msgstr "Le crédit/retrait a bien été effectué !"
#: apps/note/static/note/js/transfer.js:407
#, javascript-format
msgid "Credit/debit failed: %s"
msgstr "Le crédit/retrait a échoué : %s"
#: note_kfet/static/js/base.js:366
msgid "An error occured while (in)validating this transaction:"
msgstr ""
"Une erreur est survenue lors de la validation/dévalidation de cette "
"transaction :"

View File

@ -2,12 +2,12 @@
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
from django.conf import settings from django.conf import settings
from django.contrib.auth import login
from django.contrib.auth.models import AnonymousUser, User from django.contrib.auth.models import AnonymousUser, User
from django.contrib.sessions.backends.db import SessionStore
from threading import local from threading import local
from django.contrib.sessions.backends.db import SessionStore
USER_ATTR_NAME = getattr(settings, 'LOCAL_USER_ATTR_NAME', '_current_user') USER_ATTR_NAME = getattr(settings, 'LOCAL_USER_ATTR_NAME', '_current_user')
SESSION_ATTR_NAME = getattr(settings, 'LOCAL_SESSION_ATTR_NAME', '_current_session') SESSION_ATTR_NAME = getattr(settings, 'LOCAL_SESSION_ATTR_NAME', '_current_session')
IP_ATTR_NAME = getattr(settings, 'LOCAL_IP_ATTR_NAME', '_current_ip') IP_ATTR_NAME = getattr(settings, 'LOCAL_IP_ATTR_NAME', '_current_ip')
@ -78,41 +78,6 @@ class SessionMiddleware(object):
return response return response
class LoginByIPMiddleware(object):
"""
Allow some users to be authenticated based on their IP address.
For example, the "note" account should not be used elsewhere than the Kfet computer,
and should not have any password.
The password that is stored in database should be on the form "ipbased$my.public.ip.address".
"""
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
"""
If the user is not authenticated, get the used IP address
and check if an user is authorized to be automatically logged with this address.
If it is the case, the logging is performed with the full rights.
"""
if not request.user.is_authenticated:
if 'HTTP_X_REAL_IP' in request.META:
ip = request.META.get('HTTP_X_REAL_IP')
elif 'HTTP_X_FORWARDED_FOR' in request.META:
ip = request.META.get('HTTP_X_FORWARDED_FOR').split(', ')[0]
else:
ip = request.META.get('REMOTE_ADDR')
qs = User.objects.filter(password=f"ipbased${ip}")
if qs.exists():
login(request, qs.get())
session = request.session
session["permission_mask"] = 42
session.save()
return self.get_response(request)
class TurbolinksMiddleware(object): class TurbolinksMiddleware(object):
""" """
Send the `Turbolinks-Location` header in response to a visit that was redirected, Send the `Turbolinks-Location` header in response to a visit that was redirected,

View File

@ -49,6 +49,9 @@ try:
except ImportError: except ImportError:
pass pass
if "logs" in INSTALLED_APPS:
MIDDLEWARE += ('note_kfet.middlewares.SessionMiddleware',)
if DEBUG: if DEBUG:
PASSWORD_HASHERS += ['member.hashers.DebugSuperuserBackdoor'] PASSWORD_HASHERS += ['member.hashers.DebugSuperuserBackdoor']
if "debug_toolbar" in INSTALLED_APPS: if "debug_toolbar" in INSTALLED_APPS:

View File

@ -79,8 +79,6 @@ MIDDLEWARE = [
'django.middleware.locale.LocaleMiddleware', 'django.middleware.locale.LocaleMiddleware',
'django.contrib.sites.middleware.CurrentSiteMiddleware', 'django.contrib.sites.middleware.CurrentSiteMiddleware',
'django_htcpcp_tea.middleware.HTCPCPTeaMiddleware', 'django_htcpcp_tea.middleware.HTCPCPTeaMiddleware',
'note_kfet.middlewares.SessionMiddleware',
'note_kfet.middlewares.LoginByIPMiddleware',
'note_kfet.middlewares.TurbolinksMiddleware', 'note_kfet.middlewares.TurbolinksMiddleware',
] ]

View File

@ -363,7 +363,8 @@ function de_validate (id, validated, resourcetype) {
const errObj = JSON.parse(err.responseText) const errObj = JSON.parse(err.responseText)
let error = errObj.detail ? errObj.detail : errObj.non_field_errors let error = errObj.detail ? errObj.detail : errObj.non_field_errors
if (!error) { error = err.responseText } if (!error) { error = err.responseText }
addMsg(gettext('An error occured while (in)validating this transaction:') + ' ' + error, 'danger') addMsg('Une erreur est survenue lors de la validation/dévalidation ' +
'de cette transaction : ' + error, 'danger')
refreshBalance() refreshBalance()
// error if this method doesn't exist. Please define it. // error if this method doesn't exist. Please define it.

View File

@ -1,134 +0,0 @@
/*
* You should never see this file.
* It is here only for compatibility reasons in case of the command `compilejsmessages` was never executed.
* Please execute this command to generate translation strings.
*/
(function(globals) {
var django = globals.django || (globals.django = {});
django.pluralidx = function(n) {
var v=(n != 1);
if (typeof(v) == 'boolean') {
return v ? 1 : 0;
} else {
return v;
}
};
/* gettext library */
django.catalog = django.catalog || {};
if (!django.jsi18n_initialized) {
django.gettext = function(msgid) {
var value = django.catalog[msgid];
if (typeof(value) == 'undefined') {
return msgid;
} else {
return (typeof(value) == 'string') ? value : value[0];
}
};
django.ngettext = function(singular, plural, count) {
var value = django.catalog[singular];
if (typeof(value) == 'undefined') {
return (count == 1) ? singular : plural;
} else {
return value.constructor === Array ? value[django.pluralidx(count)] : value;
}
};
django.gettext_noop = function(msgid) { return msgid; };
django.pgettext = function(context, msgid) {
var value = django.gettext(context + '\x04' + msgid);
if (value.indexOf('\x04') != -1) {
value = msgid;
}
return value;
};
django.npgettext = function(context, singular, plural, count) {
var value = django.ngettext(context + '\x04' + singular, context + '\x04' + plural, count);
if (value.indexOf('\x04') != -1) {
value = django.ngettext(singular, plural, count);
}
return value;
};
django.interpolate = function(fmt, obj, named) {
if (named) {
return fmt.replace(/%\(\w+\)s/g, function(match){return String(obj[match.slice(2,-2)])});
} else {
return fmt.replace(/%s/g, function(match){return String(obj.shift())});
}
};
/* formatting library */
django.formats = {
"DATETIME_FORMAT": "j \\d\\e F \\d\\e Y \\a \\l\\a\\s H:i",
"DATETIME_INPUT_FORMATS": [
"%d/%m/%Y %H:%M:%S",
"%d/%m/%Y %H:%M:%S.%f",
"%d/%m/%Y %H:%M",
"%d/%m/%y %H:%M:%S",
"%d/%m/%y %H:%M:%S.%f",
"%d/%m/%y %H:%M",
"%Y-%m-%d %H:%M:%S",
"%Y-%m-%d %H:%M:%S.%f",
"%Y-%m-%d %H:%M",
"%Y-%m-%d"
],
"DATE_FORMAT": "j \\d\\e F \\d\\e Y",
"DATE_INPUT_FORMATS": [
"%d/%m/%Y",
"%d/%m/%y",
"%Y-%m-%d"
],
"DECIMAL_SEPARATOR": ",",
"FIRST_DAY_OF_WEEK": 1,
"MONTH_DAY_FORMAT": "j \\d\\e F",
"NUMBER_GROUPING": 3,
"SHORT_DATETIME_FORMAT": "d/m/Y H:i",
"SHORT_DATE_FORMAT": "d/m/Y",
"THOUSAND_SEPARATOR": ".",
"TIME_FORMAT": "H:i",
"TIME_INPUT_FORMATS": [
"%H:%M:%S",
"%H:%M:%S.%f",
"%H:%M"
],
"YEAR_MONTH_FORMAT": "F \\d\\e Y"
};
django.get_format = function(format_type) {
var value = django.formats[format_type];
if (typeof(value) == 'undefined') {
return format_type;
} else {
return value;
}
};
/* add to global namespace */
globals.pluralidx = django.pluralidx;
globals.gettext = django.gettext;
globals.ngettext = django.ngettext;
globals.gettext_noop = django.gettext_noop;
globals.pgettext = django.pgettext;
globals.npgettext = django.npgettext;
globals.interpolate = django.interpolate;
globals.get_format = django.get_format;
django.jsi18n_initialized = true;
}
}(this));

View File

@ -1 +0,0 @@
_default.js

View File

@ -1 +0,0 @@
_default.js

View File

@ -1 +0,0 @@
_default.js

View File

@ -38,9 +38,6 @@ SPDX-License-Identifier: GPL-3.0-or-later
<script src="{% static "js/base.js" %}"></script> <script src="{% static "js/base.js" %}"></script>
<script src="{% static "js/konami.js" %}"></script> <script src="{% static "js/konami.js" %}"></script>
{# Translation in javascript files #}
<script src="{% static "js/jsi18n/jsi18n."|add:LANGUAGE_CODE|add:".js" %}"></script>
{# If extra ressources are needed for a form, load here #} {# If extra ressources are needed for a form, load here #}
{% if form.media %} {% if form.media %}
{{ form.media }} {{ form.media }}

View File

@ -7,7 +7,7 @@ django-extensions~=2.1.4
django-filter~=2.1.0 django-filter~=2.1.0
django-htcpcp-tea~=0.3.1 django-htcpcp-tea~=0.3.1
django-mailer~=2.0.1 django-mailer~=2.0.1
django-oauth-toolkit~=1.3.3 django-oauth-toolkit~=1.1.2
django-phonenumber-field~=5.0.0 django-phonenumber-field~=5.0.0
django-polymorphic~=2.0.3 django-polymorphic~=2.0.3
djangorestframework~=3.9.0 djangorestframework~=3.9.0