Compare commits

..

No commits in common. "ad2cc2296443e0a892848ee19a6c70ace20858dd" and "b49db390805674949a3a6b6bcd90600ac7ebea1f" have entirely different histories.

38 changed files with 397 additions and 860 deletions

View File

@ -23,7 +23,6 @@ from .tables import ActivityTable, GuestTable, EntryTable
class ActivityCreateView(ProtectQuerysetMixin, LoginRequiredMixin, CreateView):
model = Activity
form_class = ActivityForm
extra_context = {"title": _("Create new activity")}
def form_valid(self, form):
form.instance.creater = self.request.user
@ -38,7 +37,6 @@ class ActivityListView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTableView
model = Activity
table_class = ActivityTable
ordering = ('-date_start',)
extra_context = {"title": _("Activities")}
def get_queryset(self):
return super().get_queryset().distinct()
@ -46,6 +44,8 @@ class ActivityListView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTableView
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['title'] = _("Activities")
upcoming_activities = Activity.objects.filter(date_end__gt=datetime.now())
context['upcoming'] = ActivityTable(
data=upcoming_activities.filter(PermissionBackend.filter_queryset(self.request.user, Activity, "view")),
@ -58,7 +58,6 @@ class ActivityListView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTableView
class ActivityDetailView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView):
model = Activity
context_object_name = "activity"
extra_context = {"title": _("Activity detail")}
def get_context_data(self, **kwargs):
context = super().get_context_data()
@ -75,7 +74,6 @@ class ActivityDetailView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView):
class ActivityUpdateView(ProtectQuerysetMixin, LoginRequiredMixin, UpdateView):
model = Activity
form_class = ActivityForm
extra_context = {"title": _("Update activity")}
def get_success_url(self, **kwargs):
return reverse_lazy('activity:activity_detail', kwargs={"pk": self.kwargs["pk"]})
@ -86,12 +84,6 @@ class ActivityInviteView(ProtectQuerysetMixin, LoginRequiredMixin, CreateView):
form_class = GuestForm
template_name = "activity/activity_invite.html"
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
activity = context["form"].activity
context["title"] = _('Invite guest to the activity "{}"').format(activity.name)
return context
def get_form(self, form_class=None):
form = super().get_form(form_class)
form.activity = Activity.objects.filter(PermissionBackend.filter_queryset(self.request.user, Activity, "view"))\

View File

@ -14,11 +14,9 @@ class ReadProtectedModelViewSet(viewsets.ModelViewSet):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.model = ContentType.objects.get_for_model(self.serializer_class.Meta.model).model_class()
def get_queryset(self):
model = ContentType.objects.get_for_model(self.serializer_class.Meta.model).model_class()
user = get_current_authenticated_user()
return self.model.objects.filter(PermissionBackend.filter_queryset(user, self.model, "view"))
self.queryset = model.objects.filter(PermissionBackend.filter_queryset(user, model, "view"))
class ReadOnlyProtectedModelViewSet(viewsets.ReadOnlyModelViewSet):
@ -28,8 +26,6 @@ class ReadOnlyProtectedModelViewSet(viewsets.ReadOnlyModelViewSet):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.model = ContentType.objects.get_for_model(self.serializer_class.Meta.model).model_class()
def get_queryset(self):
model = ContentType.objects.get_for_model(self.serializer_class.Meta.model).model_class()
user = get_current_authenticated_user()
return self.model.objects.filter(PermissionBackend.filter_queryset(user, self.model, "view"))
self.queryset = model.objects.filter(PermissionBackend.filter_queryset(user, model, "view"))

View File

@ -4,8 +4,8 @@
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
from note_kfet.admin import admin_site
from note_kfet.admin import admin_site
from .forms import ProfileForm
from .models import Club, Membership, Profile

View File

@ -32,6 +32,7 @@ class UserForm(forms.ModelForm):
fields = ('first_name', 'last_name', 'username', 'email',)
class ProfileForm(forms.ModelForm):
"""
A form for the extras field provided by the :model:`member.Profile` model.

View File

@ -3,10 +3,8 @@
import hashlib
from django.conf import settings
from django.contrib.auth.hashers import PBKDF2PasswordHasher
from django.utils.crypto import constant_time_compare
from note_kfet.middlewares import get_current_authenticated_user, get_current_session
class CustomNK15Hasher(PBKDF2PasswordHasher):
@ -22,37 +20,8 @@ class CustomNK15Hasher(PBKDF2PasswordHasher):
"""
algorithm = "custom_nk15"
def must_update(self, encoded):
if settings.DEBUG:
current_user = get_current_authenticated_user()
if current_user is not None and current_user.is_superuser:
return False
return True
def verify(self, password, encoded):
if settings.DEBUG:
current_user = get_current_authenticated_user()
if current_user is not None and current_user.is_superuser\
and get_current_session().get("permission_mask", -1) >= 42:
return True
if '|' in encoded:
salt, db_hashed_pass = encoded.split('$')[2].split('|')
return constant_time_compare(hashlib.sha256((salt + password).encode("utf-8")).hexdigest(), db_hashed_pass)
return super().verify(password, encoded)
class DebugSuperuserBackdoor(PBKDF2PasswordHasher):
"""
In debug mode and during the beta, superusers can login into other accounts for tests.
"""
def must_update(self, encoded):
return False
def verify(self, password, encoded):
if settings.DEBUG:
current_user = get_current_authenticated_user()
if current_user is not None and current_user.is_superuser\
and get_current_session().get("permission_mask", -1) >= 42:
return True
return super().verify(password, encoded)

View File

@ -6,7 +6,6 @@ from datetime import datetime, timedelta
from PIL import Image
from django.conf import settings
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
@ -22,10 +21,10 @@ from note.forms import ImageForm
from note.models import Alias, NoteUser
from note.models.transactions import Transaction, SpecialTransaction
from note.tables import HistoryTable, AliasTable
from note_kfet.middlewares import _set_current_user_and_ip
from permission.backends import PermissionBackend
from permission.models import Role
from permission.views import ProtectQuerysetMixin
from wei.models import WEIClub
from .forms import ProfileForm, ClubForm, MembershipForm, CustomAuthenticationForm, UserForm
from .models import Club, Membership
@ -39,8 +38,6 @@ class CustomLoginView(LoginView):
form_class = CustomAuthenticationForm
def form_valid(self, form):
logout(self.request)
_set_current_user_and_ip(form.get_user(), self.request.session, None)
self.request.session['permission_mask'] = form.cleaned_data['permission_mask'].rank
return super().form_valid(form)
@ -53,7 +50,6 @@ class UserUpdateView(ProtectQuerysetMixin, LoginRequiredMixin, UpdateView):
form_class = UserForm
template_name = 'member/profile_update.html'
context_object_name = 'user_object'
extra_context = {"title": _("Update Profile")}
profile_form = ProfileForm
@ -69,6 +65,7 @@ class UserUpdateView(ProtectQuerysetMixin, LoginRequiredMixin, UpdateView):
form.fields['email'].help_text = _("This address must be valid.")
context['profile_form'] = self.profile_form(instance=context['user_object'].profile)
context['title'] = _("Update Profile")
return context
def form_valid(self, form):
@ -123,7 +120,6 @@ class UserDetailView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView):
model = User
context_object_name = "user_object"
template_name = "member/profile_detail.html"
extra_context = {"title": _("Profile detail")}
def get_queryset(self, **kwargs):
"""
@ -157,7 +153,6 @@ class UserListView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTableView):
model = User
table_class = UserTable
template_name = 'member/user_list.html'
extra_context = {"title": _("Search user")}
def get_queryset(self, **kwargs):
"""
@ -183,6 +178,13 @@ class UserListView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTableView):
return qs[:20]
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["title"] = _("Search user")
return context
class ProfileAliasView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView):
"""
@ -191,7 +193,6 @@ class ProfileAliasView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView):
model = User
template_name = 'member/profile_alias.html'
context_object_name = 'user_object'
extra_context = {"title": _("Note aliases")}
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
@ -205,7 +206,6 @@ class PictureUpdateView(ProtectQuerysetMixin, LoginRequiredMixin, FormMixin, Det
Update profile picture of the user note.
"""
form_class = ImageForm
extra_context = {"title": _("Update note picture")}
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
@ -263,7 +263,6 @@ class ManageAuthTokens(LoginRequiredMixin, TemplateView):
"""
model = Token
template_name = "member/manage_auth_tokens.html"
extra_context = {"title": _("Manage auth token")}
def get(self, request, *args, **kwargs):
if 'regenerate' in request.GET and Token.objects.filter(user=request.user).exists():
@ -291,7 +290,6 @@ class ClubCreateView(ProtectQuerysetMixin, LoginRequiredMixin, CreateView):
model = Club
form_class = ClubForm
success_url = reverse_lazy('member:club_list')
extra_context = {"title": _("Create new club")}
def form_valid(self, form):
return super().form_valid(form)
@ -303,7 +301,6 @@ class ClubListView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTableView):
"""
model = Club
table_class = ClubTable
extra_context = {"title": _("Search club")}
def get_queryset(self, **kwargs):
"""
@ -328,7 +325,6 @@ class ClubDetailView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView):
"""
model = Club
context_object_name = "club"
extra_context = {"title": _("Club detail")}
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
@ -373,7 +369,6 @@ class ClubAliasView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView):
model = Club
template_name = 'member/club_alias.html'
context_object_name = 'club'
extra_context = {"title": _("Note aliases")}
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
@ -390,7 +385,6 @@ class ClubUpdateView(ProtectQuerysetMixin, LoginRequiredMixin, UpdateView):
context_object_name = "club"
form_class = ClubForm
template_name = "member/club_form.html"
extra_context = {"title": _("Update club")}
def get_queryset(self, **kwargs):
qs = super().get_queryset(**kwargs)
@ -424,7 +418,6 @@ class ClubAddMemberView(ProtectQuerysetMixin, LoginRequiredMixin, CreateView):
model = Membership
form_class = MembershipForm
template_name = 'member/add_members.html'
extra_context = {"title": _("Add new member to the club")}
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
@ -435,7 +428,7 @@ class ClubAddMemberView(ProtectQuerysetMixin, LoginRequiredMixin, CreateView):
club = Club.objects.filter(PermissionBackend.filter_queryset(self.request.user, Club, "view"))\
.get(pk=self.kwargs["club_pk"], weiclub=None)
form.fields['credit_amount'].initial = club.membership_fee_paid
form.fields['roles'].queryset = Role.objects.filter(Q(weirole__isnull=not hasattr(club, 'weiclub'))
form.fields['roles'].queryset = Role.objects.filter(Q(weirole__isnull=not isinstance(club, WEIClub))
& (Q(for_club__isnull=True) | Q(for_club=club))).all()
form.fields['roles'].initial = Role.objects.filter(name="Membre de club").all()
@ -456,7 +449,7 @@ class ClubAddMemberView(ProtectQuerysetMixin, LoginRequiredMixin, CreateView):
user = old_membership.user
form.fields['user'].initial = user
form.fields['user'].disabled = True
form.fields['roles'].queryset = Role.objects.filter(Q(weirole__isnull=not hasattr(club, 'weiclub'))
form.fields['roles'].queryset = Role.objects.filter(Q(weirole__isnull=not isinstance(club, WEIClub))
& (Q(for_club__isnull=True) | Q(for_club=club))).all()
form.fields['roles'].initial = old_membership.roles.all()
form.fields['date_start'].initial = old_membership.date_end + timedelta(days=1)
@ -631,7 +624,6 @@ class ClubManageRolesView(ProtectQuerysetMixin, LoginRequiredMixin, UpdateView):
model = Membership
form_class = MembershipForm
template_name = 'member/add_members.html'
extra_context = {"title": _("Manage roles of an user in the club")}
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
@ -651,10 +643,10 @@ class ClubManageRolesView(ProtectQuerysetMixin, LoginRequiredMixin, UpdateView):
del form.fields['bank']
club = self.object.club
form.fields['roles'].queryset = Role.objects.filter(Q(weirole__isnull=not hasattr(club, 'weiclub'))
form.fields['roles'].queryset = Role.objects.filter(Q(weirole__isnull=not isinstance(club, WEIClub))
& (Q(for_club__isnull=True) | Q(for_club=club))).all()
return form
def get_success_url(self):
return reverse_lazy('member:user_detail', kwargs={'pk': self.object.user.id})
return reverse_lazy('member:club_detail', kwargs={'pk': self.object.club.id})

View File

@ -5,6 +5,7 @@ from django.contrib import admin
from django.utils.translation import gettext_lazy as _
from polymorphic.admin import PolymorphicChildModelAdmin, \
PolymorphicChildModelFilter, PolymorphicParentModelAdmin
from note_kfet.admin import admin_site
from .models.notes import Alias, Note, NoteClub, NoteSpecial, NoteUser

View File

@ -119,7 +119,7 @@ class ConsumerSerializer(serializers.ModelSerializer):
# If the user has no right to see the note, then we only display the note identifier
if PermissionBackend.check_perm(get_current_authenticated_user(), "note.view_note", obj.note):
return NotePolymorphicSerializer().to_representation(obj.note)
return dict(id=obj.note.id, name=str(obj.note))
return dict(id=obj.note.id)
def get_email_confirmed(self, obj):
if isinstance(obj.note, NoteUser):

View File

@ -106,8 +106,10 @@ class ConsumerViewSet(ReadOnlyProtectedModelViewSet):
queryset = super().get_queryset()
alias = self.request.query_params.get("alias", ".*")
queryset = queryset.filter(normalized_name__iregex="^" + Alias.normalize(alias))\
.order_by('name').prefetch_related('note')
queryset = queryset.filter(
Q(name__regex="^" + alias)
| Q(normalized_name__regex="^" + Alias.normalize(alias))
| Q(normalized_name__regex="^" + alias.lower())).order_by('name')
return queryset

View File

@ -8,8 +8,6 @@ from django.db.models import F
from django.utils.html import format_html
from django_tables2.utils import A
from django.utils.translation import gettext_lazy as _
from note_kfet.middlewares import get_current_authenticated_user
from permission.backends import PermissionBackend
from .models.notes import Alias
from .models.transactions import Transaction, TransactionTemplate
@ -54,26 +52,14 @@ class HistoryTable(tables.Table):
attrs={
"td": {
"id": lambda record: "validate_" + str(record.id),
"class": lambda record:
str(record.valid).lower()
+ (' validate' if PermissionBackend.check_perm(get_current_authenticated_user(),
"note.change_transaction_invalidity_reason",
record) else ''),
"class": lambda record: str(record.valid).lower() + ' validate',
"data-toggle": "tooltip",
"title": lambda record: (_("Click to invalidate") if record.valid else _("Click to validate"))
if PermissionBackend.check_perm(get_current_authenticated_user(),
"note.change_transaction_invalidity_reason", record) else None,
"onclick": lambda record: 'de_validate(' + str(record.id) + ', ' + str(record.valid).lower() + ')'
if PermissionBackend.check_perm(get_current_authenticated_user(),
"note.change_transaction_invalidity_reason", record) else None,
"title": lambda record: _("Click to invalidate") if record.valid else _("Click to validate"),
"onclick": lambda record: 'de_validate(' + str(record.id) + ', ' + str(record.valid).lower() + ')',
"onmouseover": lambda record: '$("#invalidity_reason_'
+ str(record.id) + '").show();$("#invalidity_reason_'
+ str(record.id) + '").focus();'
if PermissionBackend.check_perm(get_current_authenticated_user(),
"note.change_transaction_invalidity_reason", record) else None,
"onmouseout": lambda record: '$("#invalidity_reason_' + str(record.id) + '").hide()'
if PermissionBackend.check_perm(get_current_authenticated_user(),
"note.change_transaction_invalidity_reason", record) else None,
+ str(record.id) + '").focus();',
"onmouseout": lambda record: '$("#invalidity_reason_' + str(record.id) + '").hide()',
}
}
)
@ -102,10 +88,6 @@ class HistoryTable(tables.Table):
When the validation status is hovered, an input field is displayed to let the user specify an invalidity reason
"""
val = "" if value else ""
if not PermissionBackend\
.check_perm(get_current_authenticated_user(), "note.change_transaction_invalidity_reason", record):
return val
val += "<input type='text' class='form-control' id='invalidity_reason_" + str(record.id) \
+ "' value='" + (html.escape(record.invalidity_reason)
if record.invalidity_reason else ("" if value else str(_("No reason specified")))) \
@ -149,10 +131,12 @@ class ButtonTable(tables.Table):
row_attrs = {
'class': lambda record: 'table-row ' + ('table-success' if record.display else 'table-danger'),
'id': lambda record: "row-" + str(record.pk),
'data-href': lambda record: record.pk
}
model = TransactionTemplate
exclude = ('id',)
order_by = ('type', '-display', 'destination__name', 'name',)
edit = tables.LinkColumn('note:template_update',
args=[A('pk')],

View File

@ -5,7 +5,6 @@ import json
from django.conf import settings
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.contenttypes.models import ContentType
from django.db.models import Q
from django.utils.translation import gettext_lazy as _
from django.views.generic import CreateView, UpdateView
from django_tables2 import SingleTableView
@ -30,7 +29,6 @@ class TransactionCreateView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTabl
model = Transaction
# Transaction history table
table_class = HistoryTable
extra_context = {"title": _("Transfer money")}
def get_queryset(self, **kwargs):
return super().get_queryset(**kwargs).order_by("-created_at").all()[:20]
@ -40,6 +38,7 @@ class TransactionCreateView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTabl
Add some context variables in template such as page title
"""
context = super().get_context_data(**kwargs)
context['title'] = _('Transfer money')
context['amount_widget'] = AmountInput(attrs={"id": "amount"})
context['polymorphic_ctype'] = ContentType.objects.get_for_model(Transaction).pk
context['special_polymorphic_ctype'] = ContentType.objects.get_for_model(SpecialTransaction).pk
@ -64,7 +63,6 @@ class TransactionTemplateCreateView(ProtectQuerysetMixin, LoginRequiredMixin, Cr
model = TransactionTemplate
form_class = TransactionTemplateForm
success_url = reverse_lazy('note:template_list')
extra_context = {"title": _("Create new button")}
class TransactionTemplateListView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTableView):
@ -73,20 +71,6 @@ class TransactionTemplateListView(ProtectQuerysetMixin, LoginRequiredMixin, Sing
"""
model = TransactionTemplate
table_class = ButtonTable
extra_context = {"title": _("Search button")}
def get_queryset(self, **kwargs):
"""
Filter the user list with the given pattern.
"""
qs = super().get_queryset().distinct()
if "search" in self.request.GET:
pattern = self.request.GET["search"]
qs = qs.filter(Q(name__iregex="^" + pattern) | Q(destination__club__name__iregex="^" + pattern))
qs = qs.order_by('-display', 'category__name', 'destination__club__name', 'name')
return qs
class TransactionTemplateUpdateView(ProtectQuerysetMixin, LoginRequiredMixin, UpdateView):
@ -96,7 +80,6 @@ class TransactionTemplateUpdateView(ProtectQuerysetMixin, LoginRequiredMixin, Up
model = TransactionTemplate
form_class = TransactionTemplateForm
success_url = reverse_lazy('note:template_list')
extra_context = {"title": _("Update button")}
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
@ -133,7 +116,6 @@ class ConsoView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTableView):
"""
model = Transaction
template_name = "note/conso_form.html"
extra_context = {"title": _("Consumptions")}
# Transaction history table
table_class = HistoryTable
@ -155,6 +137,7 @@ class ConsoView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTableView):
context['highlighted'] = TransactionTemplate.objects.filter(highlighted=True).filter(
PermissionBackend().filter_queryset(self.request.user, TransactionTemplate, "view")
).order_by('name').all()
context['title'] = _("Consumptions")
context['polymorphic_ctype'] = ContentType.objects.get_for_model(RecurrentTransaction).pk
# select2 compatibility

View File

@ -2,8 +2,8 @@
# SPDX-License-Identifier: GPL-3.0-or-lateré
from django.contrib import admin
from note_kfet.admin import admin_site
from note_kfet.admin import admin_site
from .models import Permission, PermissionMask, Role

View File

@ -1,6 +1,7 @@
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later
from django.conf import settings
from django.contrib.auth.backends import ModelBackend
from django.contrib.auth.models import User, AnonymousUser
from django.contrib.contenttypes.models import ContentType
@ -49,6 +50,7 @@ class PermissionBackend(ModelBackend):
perms.append(perm)
return perms
@staticmethod
def permissions(user, model, type):
"""
@ -135,7 +137,7 @@ class PermissionBackend(ModelBackend):
if sess is not None and sess.session_key is None:
return False
if user_obj.is_superuser and sess.get("permission_mask", -1) >= 42:
if user_obj.is_superuser and get_current_session().get("permission_mask", -1) >= 42:
return True
if obj is None:

View File

@ -4,7 +4,6 @@
from functools import lru_cache
from time import time
from django.conf import settings
from django.contrib.sessions.models import Session
from note_kfet.middlewares import get_current_session
@ -33,10 +32,6 @@ def memoize(f):
sess_funs = new_sess_funs
def func(*args, **kwargs):
if settings.DEBUG:
# Don't memoize in DEBUG mode
return f(*args, **kwargs)
nonlocal last_collect
if time() - last_collect > 60:

View File

@ -111,7 +111,7 @@
"note",
"alias"
],
"query": "[\"AND\", [\"OR\", {\"note__noteuser__user__memberships__club__name\": \"Kfet\", \"note__noteuser__user__memberships__date_start__lte\": [\"today\"], \"note__noteuser__user__memberships__date_end__gte\": [\"today\"]}, {\"note__noteclub__isnull\": false}], {\"note__is_active\": true}]",
"query": "[\"AND\", [\"OR\", {\"note__in\": [\"NoteUser\", \"objects\", [\"filter\", {\"user__memberships__club__name\": \"Kfet\"}], [\"all\"]]}, {\"note__in\": [\"NoteClub\", \"objects\", [\"all\"]]}], {\"note__is_active\": true}]",
"type": "view",
"mask": 1,
"field": "",
@ -319,7 +319,7 @@
"note",
"note"
],
"query": "[\"OR\", {\"pk\": [\"club\", \"note\", \"pk\"]}, {\"noteuser__user__memberships__club\": [\"club\"], \"noteuser__user__memberships__date_start__lte\": [\"today\"], \"noteuser__user__memberships__date_end__gte\": [\"today\"]}]",
"query": "[\"OR\", {\"pk\": [\"club\", \"note\", \"pk\"]}, {\"pk__in\": [\"NoteUser\", \"objects\", [\"filter\", {\"user__memberships__club\": [\"club\"]}], [\"all\"]]}]",
"type": "view",
"mask": 2,
"field": "",
@ -801,7 +801,7 @@
],
"query": "{\"club\": [\"club\"]}",
"type": "view",
"mask": 3,
"mask": 1,
"field": "",
"permanent": false,
"description": "View club's memberships"
@ -833,7 +833,7 @@
],
"query": "{\"club\": [\"club\"]}",
"type": "change",
"mask": 3,
"mask": 2,
"field": "roles",
"permanent": false,
"description": "Update user roles"
@ -2234,22 +2234,6 @@
{
"model": "permission.permission",
"pk": 139,
"fields": {
"model": [
"note",
"noteclub"
],
"query": "{}",
"type": "add",
"mask": 3,
"field": "",
"permanent": false,
"description": "Create any noteclub"
}
},
{
"model": "permission.permission",
"pk": 140,
"fields": {
"model": [
"member",
@ -2263,38 +2247,6 @@
"description": "Create any club"
}
},
{
"model": "permission.permission",
"pk": 141,
"fields": {
"model": [
"auth",
"user"
],
"query": "{\"memberships__club\": [\"club\"], \"memberships__date__start__lte\": [\"today\"], \"memberships__date__end__gte\": [\"today\"]}",
"type": "view",
"mask": 3,
"field": "",
"permanent": false,
"description": "View members of our club"
}
},
{
"model": "permission.permission",
"pk": 142,
"fields": {
"model": [
"note",
"noteclub"
],
"query": "{\"club\": [\"club\"]}",
"type": "view",
"mask": 2,
"field": "",
"permanent": false,
"description": "View club note"
}
},
{
"model": "permission.role",
"pk": 1,
@ -2371,8 +2323,7 @@
"permissions": [
22,
47,
49,
140
49
]
}
},
@ -2384,9 +2335,8 @@
"name": "Pr\u00e9sident\u00b7e de club",
"permissions": [
50,
62,
141,
142
51,
62
]
}
},
@ -2406,9 +2356,7 @@
61,
62,
127,
133,
141,
142
133
]
}
},
@ -2616,10 +2564,7 @@
136,
137,
138,
139,
140,
141,
142
139
]
}
},

View File

@ -44,9 +44,7 @@ class InstancedPermission:
else:
oldpk = obj.pk
# Ensure previous models are deleted
for o in self.model.model_class().objects.filter(pk=obj.pk).all():
o._force_delete = True
Model.delete(o)
self.model.model_class().objects.filter(pk=obj.pk).annotate(_force_delete=F("pk")).delete()
# Force insertion, no data verification, no trigger
obj._force_save = True
Model.save(obj, force_insert=True)

View File

@ -50,7 +50,6 @@ def pre_save_object(sender, instance, **kwargs):
# In the other case, we check if he/she has the right to change one field
previous = qs.get()
for field in instance._meta.fields:
field_name = field.name
old_value = getattr(previous, field.name)
@ -82,8 +81,7 @@ def pre_delete_object(instance, **kwargs):
if instance._meta.label_lower in EXCLUDED:
return
if hasattr(instance, "_force_delete") or hasattr(instance, "pk") and instance.pk == 0:
# Don't check permissions on force-deleted objects
if hasattr(instance, "_force_delete"):
return
user = get_current_authenticated_user()

View File

@ -41,7 +41,6 @@ class ProtectQuerysetMixin:
class RightsView(TemplateView):
template_name = "permission/all_rights.html"
extra_context = {"title": _("Rights")}
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)

View File

@ -35,7 +35,6 @@ class UserCreateView(CreateView):
form_class = SignUpForm
template_name = 'registration/signup.html'
second_form = ProfileForm
extra_context = {"title": _("Register new user")}
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
@ -79,7 +78,6 @@ class UserValidateView(TemplateView):
"""
title = _("Email validation")
template_name = 'registration/email_validation_complete.html'
extra_context = {"title": _("Validate a registration")}
def get(self, *args, **kwargs):
"""
@ -135,7 +133,7 @@ class UserValidationEmailSentView(TemplateView):
Display the information that the validation link has been sent.
"""
template_name = 'registration/email_validation_email_sent.html'
extra_context = {"title": _('Email validation email sent')}
title = _('Email validation email sent')
class UserResendValidationEmailView(LoginRequiredMixin, ProtectQuerysetMixin, DetailView):
@ -143,7 +141,6 @@ class UserResendValidationEmailView(LoginRequiredMixin, ProtectQuerysetMixin, De
Rensend the email validation link.
"""
model = User
extra_context = {"title": _("Resend email validation link")}
def get(self, request, *args, **kwargs):
user = self.get_object()
@ -161,7 +158,6 @@ class FutureUserListView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTableVi
model = User
table_class = FutureUserTable
template_name = 'registration/future_user_list.html'
extra_context = {"title": _("Pre-registered users list")}
def get_queryset(self, **kwargs):
"""
@ -203,7 +199,6 @@ class FutureUserDetailView(ProtectQuerysetMixin, LoginRequiredMixin, FormMixin,
form_class = ValidationForm
context_object_name = "user_object"
template_name = "registration/future_profile_detail.html"
extra_context = {"title": _("Registration detail")}
def post(self, request, *args, **kwargs):
form = self.get_form()
@ -360,7 +355,6 @@ class FutureUserInvalidateView(ProtectQuerysetMixin, LoginRequiredMixin, View):
"""
Delete a pre-registered user.
"""
extra_context = {"title": _("Invalidate pre-registration")}
def get(self, request, *args, **kwargs):
"""

View File

@ -2,8 +2,8 @@
# SPDX-License-Identifier: GPL-3.0-or-lateré
from django.contrib import admin
from note_kfet.admin import admin_site
from note_kfet.admin import admin_site
from .models import RemittanceType, Remittance, SogeCredit

View File

@ -15,7 +15,6 @@ from django.http import HttpResponse
from django.shortcuts import redirect
from django.template.loader import render_to_string
from django.urls import reverse_lazy
from django.utils.translation import gettext_lazy as _
from django.views.generic import CreateView, UpdateView, DetailView
from django.views.generic.base import View, TemplateView
from django.views.generic.edit import BaseFormView
@ -36,7 +35,6 @@ class InvoiceCreateView(ProtectQuerysetMixin, LoginRequiredMixin, CreateView):
"""
model = Invoice
form_class = InvoiceForm
extra_context = {"title": _("Create new invoice")}
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
@ -79,7 +77,6 @@ class InvoiceListView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTableView)
"""
model = Invoice
table_class = InvoiceTable
extra_context = {"title": _("Invoices list")}
class InvoiceUpdateView(ProtectQuerysetMixin, LoginRequiredMixin, UpdateView):
@ -88,7 +85,6 @@ class InvoiceUpdateView(ProtectQuerysetMixin, LoginRequiredMixin, UpdateView):
"""
model = Invoice
form_class = InvoiceForm
extra_context = {"title": _("Update an invoice")}
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
@ -171,7 +167,7 @@ class InvoiceRenderView(LoginRequiredMixin, View):
del tex
# The file has to be rendered twice
for ignored in range(2):
for _ in range(2):
error = subprocess.Popen(
["pdflatex", "invoice-{}.tex".format(pk)],
cwd=tmp_dir,
@ -202,7 +198,6 @@ class RemittanceCreateView(ProtectQuerysetMixin, LoginRequiredMixin, CreateView)
"""
model = Remittance
form_class = RemittanceForm
extra_context = {"title": _("Create a new remittance")}
def get_success_url(self):
return reverse_lazy('treasury:remittance_list')
@ -223,7 +218,6 @@ class RemittanceListView(LoginRequiredMixin, TemplateView):
List existing Remittances
"""
template_name = "treasury/remittance_list.html"
extra_context = {"title": _("Remittances list")}
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
@ -273,7 +267,6 @@ class RemittanceUpdateView(ProtectQuerysetMixin, LoginRequiredMixin, UpdateView)
"""
model = Remittance
form_class = RemittanceForm
extra_context = {"title": _("Update a remittance")}
def get_success_url(self):
return reverse_lazy('treasury:remittance_list')
@ -296,9 +289,9 @@ class LinkTransactionToRemittanceView(ProtectQuerysetMixin, LoginRequiredMixin,
"""
Attach a special transaction to a remittance
"""
model = SpecialTransactionProxy
form_class = LinkTransactionToRemittanceForm
extra_context = {"title": _("Attach a transaction to a remittance")}
def get_success_url(self):
return reverse_lazy('treasury:remittance_list')
@ -342,7 +335,6 @@ class SogeCreditListView(LoginRequiredMixin, ProtectQuerysetMixin, SingleTableVi
"""
model = SogeCredit
table_class = SogeCreditTable
extra_context = {"title": _("List of credits from the Société générale")}
def get_queryset(self, **kwargs):
"""
@ -381,7 +373,6 @@ class SogeCreditManageView(LoginRequiredMixin, ProtectQuerysetMixin, BaseFormVie
"""
model = SogeCredit
form_class = Form
extra_context = {"title": _("Manage credits from the Société générale")}
def form_valid(self, form):
if "validate" in form.data:

View File

@ -2,7 +2,6 @@
# SPDX-License-Identifier: GPL-3.0-or-later
from note_kfet.admin import admin_site
from .models import WEIClub, WEIRegistration, WEIMembership, WEIRole, Bus, BusTeam
admin_site.register(WEIClub)

View File

@ -202,7 +202,7 @@ class WEIRegistration(models.Model):
clothing_size = models.CharField(
max_length=4,
choices=(
('XS', "XS"),
('XS',"XS"),
('S', "S"),
('M', "M"),
('L', "L"),

View File

@ -52,7 +52,6 @@ class WEIListView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTableView):
model = WEIClub
table_class = WEITable
ordering = '-year'
extra_context = {"title": _("Search WEI")}
class WEICreateView(ProtectQuerysetMixin, LoginRequiredMixin, CreateView):
@ -61,7 +60,6 @@ class WEICreateView(ProtectQuerysetMixin, LoginRequiredMixin, CreateView):
"""
model = WEIClub
form_class = WEIForm
extra_context = {"title": _("Create WEI")}
def form_valid(self, form):
form.instance.requires_membership = True
@ -81,7 +79,6 @@ class WEIDetailView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView):
"""
model = WEIClub
context_object_name = "club"
extra_context = {"title": _("WEI Detail")}
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
@ -176,7 +173,6 @@ class WEIMembershipsView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTableVi
"""
model = WEIMembership
table_class = WEIMembershipTable
extra_context = {"title": _("View members of the WEI")}
def dispatch(self, request, *args, **kwargs):
self.club = WEIClub.objects.get(pk=self.kwargs["pk"])
@ -214,7 +210,6 @@ class WEIRegistrationsView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTable
"""
model = WEIRegistration
table_class = WEIRegistrationTable
extra_context = {"title": _("View registrations to the WEI")}
def dispatch(self, request, *args, **kwargs):
self.club = WEIClub.objects.get(pk=self.kwargs["pk"])
@ -251,7 +246,6 @@ class WEIUpdateView(ProtectQuerysetMixin, LoginRequiredMixin, UpdateView):
model = WEIClub
context_object_name = "club"
form_class = WEIForm
extra_context = {"title": _("Update the WEI")}
def dispatch(self, request, *args, **kwargs):
wei = self.get_object()
@ -272,7 +266,6 @@ class BusCreateView(ProtectQuerysetMixin, LoginRequiredMixin, CreateView):
"""
model = Bus
form_class = BusForm
extra_context = {"title": _("Create new bus")}
def dispatch(self, request, *args, **kwargs):
wei = WEIClub.objects.get(pk=self.kwargs["pk"])
@ -303,7 +296,6 @@ class BusUpdateView(ProtectQuerysetMixin, LoginRequiredMixin, UpdateView):
"""
model = Bus
form_class = BusForm
extra_context = {"title": _("Update bus")}
def dispatch(self, request, *args, **kwargs):
wei = self.get_object().wei
@ -333,7 +325,6 @@ class BusManageView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView):
Manage Bus
"""
model = Bus
extra_context = {"title": _("Manage bus")}
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
@ -360,7 +351,6 @@ class BusTeamCreateView(ProtectQuerysetMixin, LoginRequiredMixin, CreateView):
"""
model = BusTeam
form_class = BusTeamForm
extra_context = {"title": _("Create new team")}
def dispatch(self, request, *args, **kwargs):
wei = WEIClub.objects.get(buses__pk=self.kwargs["pk"])
@ -392,7 +382,6 @@ class BusTeamUpdateView(ProtectQuerysetMixin, LoginRequiredMixin, UpdateView):
"""
model = BusTeam
form_class = BusTeamForm
extra_context = {"title": _("Update team")}
def dispatch(self, request, *args, **kwargs):
wei = self.get_object().bus.wei
@ -423,7 +412,6 @@ class BusTeamManageView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView):
Manage Bus team
"""
model = BusTeam
extra_context = {"title": _("Manage WEI team")}
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
@ -445,7 +433,6 @@ class WEIRegister1AView(ProtectQuerysetMixin, LoginRequiredMixin, CreateView):
"""
model = WEIRegistration
form_class = WEIRegistrationForm
extra_context = {"title": _("Register first year student to the WEI")}
def dispatch(self, request, *args, **kwargs):
wei = WEIClub.objects.get(pk=self.kwargs["wei_pk"])
@ -500,7 +487,6 @@ class WEIRegister2AView(ProtectQuerysetMixin, LoginRequiredMixin, CreateView):
"""
model = WEIRegistration
form_class = WEIRegistrationForm
extra_context = {"title": _("Register old student to the WEI")}
def dispatch(self, request, *args, **kwargs):
wei = WEIClub.objects.get(pk=self.kwargs["wei_pk"])
@ -578,7 +564,6 @@ class WEIUpdateRegistrationView(ProtectQuerysetMixin, LoginRequiredMixin, Update
"""
model = WEIRegistration
form_class = WEIRegistrationForm
extra_context = {"title": _("Update WEI Registration")}
def get_queryset(self, **kwargs):
return WEIRegistration.objects
@ -668,7 +653,6 @@ class WEIDeleteRegistrationView(ProtectQuerysetMixin, LoginRequiredMixin, Delete
Delete a non-validated WEI registration
"""
model = WEIRegistration
extra_context = {"title": _("Delete WEI registration")}
def dispatch(self, request, *args, **kwargs):
object = self.get_object()
@ -698,7 +682,6 @@ class WEIValidateRegistrationView(ProtectQuerysetMixin, LoginRequiredMixin, Crea
"""
model = WEIMembership
form_class = WEIMembershipForm
extra_context = {"title": _("Validate WEI registration")}
def dispatch(self, request, *args, **kwargs):
wei = WEIRegistration.objects.get(pk=self.kwargs["pk"]).wei
@ -816,7 +799,6 @@ class WEISurveyView(LoginRequiredMixin, BaseFormView, DetailView):
model = WEIRegistration
template_name = "wei/survey.html"
survey = None
extra_context = {"title": _("Survey WEI")}
def dispatch(self, request, *args, **kwargs):
obj = self.get_object()
@ -854,6 +836,7 @@ class WEISurveyView(LoginRequiredMixin, BaseFormView, DetailView):
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["club"] = self.object.wei
context["title"] = _("Survey WEI")
return context
def form_valid(self, form):
@ -869,21 +852,21 @@ class WEISurveyView(LoginRequiredMixin, BaseFormView, DetailView):
class WEISurveyEndView(LoginRequiredMixin, TemplateView):
template_name = "wei/survey_end.html"
extra_context = {"title": _("Survey WEI")}
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["club"] = WEIRegistration.objects.get(pk=self.kwargs["pk"]).wei
context["title"] = _("Survey WEI")
return context
class WEIClosedView(LoginRequiredMixin, TemplateView):
template_name = "wei/survey_closed.html"
extra_context = {"title": _("Survey WEI")}
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["club"] = WEIClub.objects.get(pk=self.kwargs["pk"])
context["title"] = _("Survey WEI")
return context

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-07-30 17:22+0200\n"
"POT-Creation-Date: 2020-07-29 22:54+0200\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"
@ -46,7 +46,7 @@ msgstr ""
#: apps/activity/models.py:23 apps/activity/models.py:48
#: apps/member/models.py:151 apps/note/models/notes.py:188
#: apps/note/models/transactions.py:25 apps/note/models/transactions.py:45
#: apps/note/models/transactions.py:261 apps/permission/models.py:323
#: apps/note/models/transactions.py:261 apps/permission/models.py:321
#: apps/wei/models.py:65 apps/wei/models.py:117
#: templates/member/club_info.html:13 templates/member/profile_info.html:14
#: templates/registration/future_profile_detail.html:16
@ -71,14 +71,14 @@ msgid "activity types"
msgstr ""
#: apps/activity/models.py:53 apps/note/models/transactions.py:81
#: apps/permission/models.py:104 apps/permission/models.py:183
#: apps/permission/models.py:102 apps/permission/models.py:181
#: apps/wei/models.py:71 apps/wei/models.py:128
#: templates/activity/activity_detail.html:16
msgid "description"
msgstr ""
#: apps/activity/models.py:60 apps/note/models/notes.py:164
#: apps/note/models/transactions.py:66 apps/permission/models.py:158
#: apps/note/models/transactions.py:66 apps/permission/models.py:156
#: templates/activity/activity_detail.html:19
msgid "type"
msgstr ""
@ -186,12 +186,12 @@ msgstr ""
msgid "Type"
msgstr ""
#: apps/activity/tables.py:77 apps/member/forms.py:104
#: apps/activity/tables.py:77 apps/member/forms.py:105
#: apps/registration/forms.py:64 apps/treasury/forms.py:120
msgid "Last name"
msgstr ""
#: apps/activity/tables.py:79 apps/member/forms.py:109
#: apps/activity/tables.py:79 apps/member/forms.py:110
#: apps/registration/forms.py:69 apps/treasury/forms.py:122
#: templates/note/transaction_form.html:126
msgid "First name"
@ -205,27 +205,11 @@ msgstr ""
msgid "Balance"
msgstr ""
#: apps/activity/views.py:26
msgid "Create new activity"
msgstr ""
#: apps/activity/views.py:41 templates/base.html:121
#: apps/activity/views.py:47 templates/base.html:121
msgid "Activities"
msgstr ""
#: apps/activity/views.py:61
msgid "Activity detail"
msgstr ""
#: apps/activity/views.py:78
msgid "Update activity"
msgstr ""
#: apps/activity/views.py:92
msgid "Invite guest to the activity \"{}\""
msgstr ""
#: apps/activity/views.py:171
#: apps/activity/views.py:163
msgid "Entry for activity \"{}\""
msgstr ""
@ -241,7 +225,7 @@ msgstr ""
msgid "IP Address"
msgstr ""
#: apps/logs/models.py:35 apps/permission/models.py:128
#: apps/logs/models.py:35 apps/permission/models.py:126
msgid "model"
msgstr ""
@ -261,12 +245,12 @@ msgstr ""
msgid "create"
msgstr ""
#: apps/logs/models.py:61 apps/note/tables.py:143
#: apps/logs/models.py:61 apps/note/tables.py:145
#: templates/activity/activity_detail.html:67
msgid "edit"
msgstr ""
#: apps/logs/models.py:62 apps/note/tables.py:120 apps/note/tables.py:148
#: apps/logs/models.py:62 apps/note/tables.py:120 apps/note/tables.py:150
#: apps/wei/tables.py:65
msgid "delete"
msgstr ""
@ -295,35 +279,35 @@ msgstr ""
msgid "member"
msgstr ""
#: apps/member/forms.py:58 apps/member/views.py:81
#: apps/member/forms.py:59 apps/member/views.py:78
msgid "An alias with a similar name already exists."
msgstr ""
#: apps/member/forms.py:83 apps/registration/forms.py:44
#: apps/member/forms.py:84 apps/registration/forms.py:44
msgid "Inscription paid by Société Générale"
msgstr ""
#: apps/member/forms.py:85 apps/registration/forms.py:46
#: apps/member/forms.py:86 apps/registration/forms.py:46
msgid "Check this case is the Société Générale paid the inscription."
msgstr ""
#: apps/member/forms.py:90 apps/registration/forms.py:51
#: apps/member/forms.py:91 apps/registration/forms.py:51
msgid "Credit type"
msgstr ""
#: apps/member/forms.py:91 apps/registration/forms.py:52
#: apps/member/forms.py:92 apps/registration/forms.py:52
msgid "No credit"
msgstr ""
#: apps/member/forms.py:93
#: apps/member/forms.py:94
msgid "You can credit the note of the user."
msgstr ""
#: apps/member/forms.py:97 apps/registration/forms.py:57
#: apps/member/forms.py:98 apps/registration/forms.py:57
msgid "Credit amount"
msgstr ""
#: apps/member/forms.py:114 apps/registration/forms.py:74
#: apps/member/forms.py:115 apps/registration/forms.py:74
#: apps/treasury/forms.py:124 templates/note/transaction_form.html:132
msgid "Bank"
msgstr ""
@ -525,7 +509,7 @@ msgstr ""
msgid "fee"
msgstr ""
#: apps/member/models.py:303 apps/member/views.py:535 apps/wei/views.py:787
#: apps/member/models.py:303 apps/member/views.py:528 apps/wei/views.py:770
msgid "User is not a member of the parent club"
msgstr ""
@ -534,7 +518,7 @@ msgstr ""
msgid "The role {role} does not apply to the club {club}."
msgstr ""
#: apps/member/models.py:321 apps/member/views.py:544
#: apps/member/models.py:321 apps/member/views.py:537
msgid "User is already a member of the club"
msgstr ""
@ -555,85 +539,45 @@ msgstr ""
msgid "Renew"
msgstr ""
#: apps/member/views.py:56 templates/member/profile_info.html:47
#: apps/member/views.py:65 apps/registration/forms.py:23
msgid "This address must be valid."
msgstr ""
#: apps/member/views.py:68 templates/member/profile_info.html:47
#: templates/registration/future_profile_detail.html:48
#: templates/wei/weimembership_form.html:130
msgid "Update Profile"
msgstr ""
#: apps/member/views.py:69 apps/registration/forms.py:23
msgid "This address must be valid."
msgstr ""
#: apps/member/views.py:126
msgid "Profile detail"
msgstr ""
#: apps/member/views.py:160
#: apps/member/views.py:184
msgid "Search user"
msgstr ""
#: apps/member/views.py:194 apps/member/views.py:376
msgid "Note aliases"
msgstr ""
#: apps/member/views.py:208
msgid "Update note picture"
msgstr ""
#: apps/member/views.py:266 templates/member/profile_info.html:43
msgid "Manage auth token"
msgstr ""
#: apps/member/views.py:294
msgid "Create new club"
msgstr ""
#: apps/member/views.py:306
msgid "Search club"
msgstr ""
#: apps/member/views.py:331
msgid "Club detail"
msgstr ""
#: apps/member/views.py:393
msgid "Update club"
msgstr ""
#: apps/member/views.py:427
msgid "Add new member to the club"
msgstr ""
#: apps/member/views.py:530 apps/wei/views.py:778
#: apps/member/views.py:523 apps/wei/views.py:761
msgid ""
"This user don't have enough money to join this club, and can't have a "
"negative balance."
msgstr ""
#: apps/member/views.py:548
#: apps/member/views.py:541
msgid "The membership must start after {:%m-%d-%Y}."
msgstr ""
#: apps/member/views.py:553
#: apps/member/views.py:546
msgid "The membership must begin before {:%m-%d-%Y}."
msgstr ""
#: apps/member/views.py:570 apps/member/views.py:572 apps/member/views.py:574
#: apps/registration/views.py:295 apps/registration/views.py:297
#: apps/registration/views.py:299
#: apps/member/views.py:563 apps/member/views.py:565 apps/member/views.py:567
#: apps/registration/views.py:290 apps/registration/views.py:292
#: apps/registration/views.py:294
msgid "This field is required."
msgstr ""
#: apps/member/views.py:634
msgid "Manage roles of an user in the club"
msgstr ""
#: apps/note/admin.py:121 apps/note/models/transactions.py:106
#: apps/note/admin.py:122 apps/note/models/transactions.py:106
msgid "source"
msgstr ""
#: apps/note/admin.py:129 apps/note/admin.py:171
#: apps/note/admin.py:130 apps/note/admin.py:172
#: apps/note/models/transactions.py:55 apps/note/models/transactions.py:119
msgid "destination"
msgstr ""
@ -870,129 +814,113 @@ msgstr ""
msgid "No reason specified"
msgstr ""
#: apps/note/tables.py:122 apps/note/tables.py:150 apps/wei/tables.py:66
#: apps/note/tables.py:122 apps/note/tables.py:152 apps/wei/tables.py:66
#: templates/treasury/sogecredit_detail.html:59
#: templates/wei/weiregistration_confirm_delete.html:32
msgid "Delete"
msgstr ""
#: apps/note/tables.py:145 apps/wei/tables.py:42 apps/wei/tables.py:43
#: apps/note/tables.py:147 apps/wei/tables.py:42 apps/wei/tables.py:43
#: templates/member/club_info.html:67 templates/note/conso_form.html:128
#: templates/wei/bus_tables.html:15 templates/wei/busteam_tables.html:15
#: templates/wei/busteam_tables.html:33 templates/wei/weiclub_info.html:68
msgid "Edit"
msgstr ""
#: apps/note/views.py:33
#: apps/note/views.py:41
msgid "Transfer money"
msgstr ""
#: apps/note/views.py:67
msgid "Create new button"
msgstr ""
#: apps/note/views.py:76
msgid "Search button"
msgstr ""
#: apps/note/views.py:99
msgid "Update button"
msgstr ""
#: apps/note/views.py:136 templates/base.html:94
#: apps/note/views.py:140 templates/base.html:94
msgid "Consumptions"
msgstr ""
#: apps/permission/models.py:83
#: apps/permission/models.py:81
#, python-brace-format
msgid "Can {type} {model}.{field} in {query}"
msgstr ""
#: apps/permission/models.py:85
#: apps/permission/models.py:83
#, python-brace-format
msgid "Can {type} {model} in {query}"
msgstr ""
#: apps/permission/models.py:98
#: apps/permission/models.py:96
msgid "rank"
msgstr ""
#: apps/permission/models.py:111
#: apps/permission/models.py:109
msgid "permission mask"
msgstr ""
#: apps/permission/models.py:112
#: apps/permission/models.py:110
msgid "permission masks"
msgstr ""
#: apps/permission/models.py:152
#: apps/permission/models.py:150
msgid "query"
msgstr ""
#: apps/permission/models.py:165
#: apps/permission/models.py:163
msgid "mask"
msgstr ""
#: apps/permission/models.py:171
#: apps/permission/models.py:169
msgid "field"
msgstr ""
#: apps/permission/models.py:176
#: apps/permission/models.py:174
msgid ""
"Tells if the permission should be granted even if the membership of the user "
"is expired."
msgstr ""
#: apps/permission/models.py:177 templates/permission/all_rights.html:26
#: apps/permission/models.py:175 templates/permission/all_rights.html:26
msgid "permanent"
msgstr ""
#: apps/permission/models.py:188
#: apps/permission/models.py:186
msgid "permission"
msgstr ""
#: apps/permission/models.py:189 apps/permission/models.py:328
#: apps/permission/models.py:187 apps/permission/models.py:326
msgid "permissions"
msgstr ""
#: apps/permission/models.py:194
#: apps/permission/models.py:192
msgid "Specifying field applies only to view and change permission types."
msgstr ""
#: apps/permission/models.py:333
#: apps/permission/models.py:331
msgid "for club"
msgstr ""
#: apps/permission/models.py:343 apps/permission/models.py:344
#: apps/permission/models.py:341 apps/permission/models.py:342
msgid "role permissions"
msgstr ""
#: apps/permission/signals.py:63
#: apps/permission/signals.py:62
#, python-brace-format
msgid ""
"You don't have the permission to change the field {field} on this instance "
"of model {app_label}.{model_name}."
msgstr ""
#: apps/permission/signals.py:73
#: apps/permission/signals.py:72
#, python-brace-format
msgid ""
"You don't have the permission to add this instance of model {app_label}."
"{model_name}."
msgstr ""
#: apps/permission/signals.py:101
#: apps/permission/signals.py:99
#, python-brace-format
msgid ""
"You don't have the permission to delete this instance of model {app_label}."
"{model_name}."
msgstr ""
#: apps/permission/views.py:44 templates/base.html:135
msgid "Rights"
msgstr ""
#: apps/permission/views.py:49
#: apps/permission/views.py:48
msgid "All rights"
msgstr ""
@ -1018,59 +946,35 @@ msgstr ""
msgid "Join Kfet Club"
msgstr ""
#: apps/registration/views.py:38
msgid "Register new user"
msgstr ""
#: apps/registration/views.py:80
#: apps/registration/views.py:79
msgid "Email validation"
msgstr ""
#: apps/registration/views.py:82
msgid "Validate a registration"
msgstr ""
#: apps/registration/views.py:127
#: apps/registration/views.py:125
msgid "Email validation unsuccessful"
msgstr ""
#: apps/registration/views.py:138
#: apps/registration/views.py:136
msgid "Email validation email sent"
msgstr ""
#: apps/registration/views.py:146
msgid "Resend email validation link"
msgstr ""
#: apps/registration/views.py:164
msgid "Pre-registered users list"
msgstr ""
#: apps/registration/views.py:193
#: apps/registration/views.py:189
msgid "Unregistered users"
msgstr ""
#: apps/registration/views.py:206
msgid "Registration detail"
msgstr ""
#: apps/registration/views.py:261
#: apps/registration/views.py:256
msgid "You must join the BDE."
msgstr ""
#: apps/registration/views.py:283
#: apps/registration/views.py:278
msgid "You must join BDE club before joining Kfet club."
msgstr ""
#: apps/registration/views.py:288
#: apps/registration/views.py:283
msgid ""
"The entered amount is not enough for the memberships, should be at least {}"
msgstr ""
#: apps/registration/views.py:363
msgid "Invalidate pre-registration"
msgstr ""
#: apps/treasury/apps.py:12 templates/base.html:126
msgid "Treasury"
msgstr ""
@ -1268,43 +1172,6 @@ msgstr ""
msgid "No"
msgstr ""
#: apps/treasury/views.py:39
msgid "Create new invoice"
msgstr ""
#: apps/treasury/views.py:82 templates/treasury/invoice_form.html:6
msgid "Invoices list"
msgstr ""
#: apps/treasury/views.py:91
msgid "Update an invoice"
msgstr ""
#: apps/treasury/views.py:205
msgid "Create a new remittance"
msgstr ""
#: apps/treasury/views.py:226 templates/treasury/remittance_form.html:9
#: templates/treasury/specialtransactionproxy_form.html:7
msgid "Remittances list"
msgstr ""
#: apps/treasury/views.py:276
msgid "Update a remittance"
msgstr ""
#: apps/treasury/views.py:301
msgid "Attach a transaction to a remittance"
msgstr ""
#: apps/treasury/views.py:345
msgid "List of credits from the Société générale"
msgstr ""
#: apps/treasury/views.py:384
msgid "Manage credits from the Société générale"
msgstr ""
#: apps/wei/apps.py:10 apps/wei/models.py:48 apps/wei/models.py:49
#: apps/wei/models.py:60 apps/wei/models.py:166 templates/base.html:131
msgid "WEI"
@ -1522,113 +1389,45 @@ msgstr ""
msgid "members"
msgstr ""
#: apps/wei/views.py:55
msgid "Search WEI"
msgstr ""
#: apps/wei/views.py:64 templates/wei/weiclub_list.html:9
msgid "Create WEI"
msgstr ""
#: apps/wei/views.py:84
msgid "WEI Detail"
msgstr ""
#: apps/wei/views.py:179
msgid "View members of the WEI"
msgstr ""
#: apps/wei/views.py:207
#: apps/wei/views.py:203
msgid "Find WEI Membership"
msgstr ""
#: apps/wei/views.py:217
msgid "View registrations to the WEI"
msgstr ""
#: apps/wei/views.py:243
#: apps/wei/views.py:238
msgid "Find WEI Registration"
msgstr ""
#: apps/wei/views.py:254
msgid "Update the WEI"
msgstr ""
#: apps/wei/views.py:275
msgid "Create new bus"
msgstr ""
#: apps/wei/views.py:306
msgid "Update bus"
msgstr ""
#: apps/wei/views.py:336
msgid "Manage bus"
msgstr ""
#: apps/wei/views.py:363
msgid "Create new team"
msgstr ""
#: apps/wei/views.py:395
msgid "Update team"
msgstr ""
#: apps/wei/views.py:426
msgid "Manage WEI team"
msgstr ""
#: apps/wei/views.py:448
msgid "Register first year student to the WEI"
msgstr ""
#: apps/wei/views.py:460 templates/wei/weiclub_info.html:62
#: apps/wei/views.py:447 templates/wei/weiclub_info.html:62
msgid "Register 1A"
msgstr ""
#: apps/wei/views.py:481 apps/wei/views.py:551
#: apps/wei/views.py:468 apps/wei/views.py:537
msgid "This user is already registered to this WEI."
msgstr ""
#: apps/wei/views.py:486
#: apps/wei/views.py:473
msgid ""
"This user can't be in her/his first year since he/she has already participed "
"to a WEI."
msgstr ""
#: apps/wei/views.py:503
msgid "Register old student to the WEI"
msgstr ""
#: apps/wei/views.py:515 templates/wei/weiclub_info.html:65
#: apps/wei/views.py:501 templates/wei/weiclub_info.html:65
msgid "Register 2A+"
msgstr ""
#: apps/wei/views.py:533 apps/wei/views.py:621
#: apps/wei/views.py:519 apps/wei/views.py:606
msgid "You already opened an account in the Société générale."
msgstr ""
#: apps/wei/views.py:581
msgid "Update WEI Registration"
msgstr ""
#: apps/wei/views.py:671
msgid "Delete WEI registration"
msgstr ""
#: apps/wei/views.py:682
#: apps/wei/views.py:666
msgid "You don't have the right to delete this WEI registration."
msgstr ""
#: apps/wei/views.py:701
msgid "Validate WEI registration"
msgstr ""
#: apps/wei/views.py:782
#: apps/wei/views.py:765
msgid "This user didn't give her/his caution check."
msgstr ""
#: apps/wei/views.py:819 apps/wei/views.py:872 apps/wei/views.py:882
#: apps/wei/views.py:839 apps/wei/views.py:859 apps/wei/views.py:869
#: templates/wei/survey.html:12 templates/wei/survey_closed.html:12
#: templates/wei/survey_end.html:12
msgid "Survey WEI"
@ -1763,6 +1562,10 @@ msgstr ""
msgid "Registrations"
msgstr ""
#: templates/base.html:135
msgid "Rights"
msgstr ""
#: templates/base.html:139
msgid "Administration"
msgstr ""
@ -1820,11 +1623,15 @@ msgstr ""
msgid "View Profile"
msgstr ""
#: templates/member/club_list.html:9
#: templates/member/club_list.html:8
msgid "search clubs"
msgstr ""
#: templates/member/club_list.html:12
msgid "Create club"
msgstr ""
#: templates/member/club_list.html:16
#: templates/member/club_list.html:19
msgid "Club listing"
msgstr ""
@ -1868,6 +1675,10 @@ msgstr ""
msgid "Change password"
msgstr ""
#: templates/member/profile_info.html:43
msgid "Manage auth token"
msgstr ""
#: templates/member/profile_tables.html:7
#: templates/registration/future_profile_detail.html:28
#: templates/wei/weimembership_form.html:30
@ -1965,23 +1776,31 @@ msgstr ""
msgid "Current price"
msgstr ""
#: templates/note/transactiontemplate_list.html:8
#: templates/note/transactiontemplate_list.html:9
msgid "Search button"
msgstr ""
#: templates/note/transactiontemplate_list.html:11
msgid "Name of the button..."
msgstr ""
#: templates/note/transactiontemplate_list.html:10
#: templates/note/transactiontemplate_list.html:16
msgid "Display visible buttons only"
msgstr ""
#: templates/note/transactiontemplate_list.html:21
msgid "New button"
msgstr ""
#: templates/note/transactiontemplate_list.html:17
#: templates/note/transactiontemplate_list.html:28
msgid "buttons listing "
msgstr ""
#: templates/note/transactiontemplate_list.html:55
#: templates/note/transactiontemplate_list.html:86
msgid "button successfully deleted "
msgstr ""
#: templates/note/transactiontemplate_list.html:59
#: templates/note/transactiontemplate_list.html:90
msgid "Unable to delete button "
msgstr ""
@ -2166,6 +1985,10 @@ msgid ""
"by following the link you received."
msgstr ""
#: templates/treasury/invoice_form.html:6
msgid "Invoices list"
msgstr ""
#: templates/treasury/invoice_form.html:41
msgid "Add product"
msgstr ""
@ -2188,6 +2011,11 @@ msgstr ""
msgid "Remittance #"
msgstr ""
#: templates/treasury/remittance_form.html:9
#: templates/treasury/specialtransactionproxy_form.html:7
msgid "Remittances list"
msgstr ""
#: templates/treasury/remittance_form.html:12
msgid "Count"
msgstr ""
@ -2337,7 +2165,15 @@ msgstr ""
msgid "View WEI"
msgstr ""
#: templates/wei/weiclub_list.html:16
#: templates/wei/weiclub_list.html:8
msgid "search WEI"
msgstr ""
#: templates/wei/weiclub_list.html:12
msgid "Create WEI"
msgstr ""
#: templates/wei/weiclub_list.html:19
msgid "WEI listing"
msgstr ""

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-07-30 17:22+0200\n"
"POT-Creation-Date: 2020-07-29 22:54+0200\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"
@ -47,7 +47,7 @@ msgstr "Vous ne pouvez pas inviter plus de 3 personnes à cette activité."
#: apps/activity/models.py:23 apps/activity/models.py:48
#: apps/member/models.py:151 apps/note/models/notes.py:188
#: apps/note/models/transactions.py:25 apps/note/models/transactions.py:45
#: apps/note/models/transactions.py:261 apps/permission/models.py:323
#: apps/note/models/transactions.py:261 apps/permission/models.py:321
#: apps/wei/models.py:65 apps/wei/models.py:117
#: templates/member/club_info.html:13 templates/member/profile_info.html:14
#: templates/registration/future_profile_detail.html:16
@ -72,14 +72,14 @@ msgid "activity types"
msgstr "types d'activité"
#: apps/activity/models.py:53 apps/note/models/transactions.py:81
#: apps/permission/models.py:104 apps/permission/models.py:183
#: apps/permission/models.py:102 apps/permission/models.py:181
#: apps/wei/models.py:71 apps/wei/models.py:128
#: templates/activity/activity_detail.html:16
msgid "description"
msgstr "description"
#: apps/activity/models.py:60 apps/note/models/notes.py:164
#: apps/note/models/transactions.py:66 apps/permission/models.py:158
#: apps/note/models/transactions.py:66 apps/permission/models.py:156
#: templates/activity/activity_detail.html:19
msgid "type"
msgstr "type"
@ -187,12 +187,12 @@ msgstr "supprimer"
msgid "Type"
msgstr "Type"
#: apps/activity/tables.py:77 apps/member/forms.py:104
#: apps/activity/tables.py:77 apps/member/forms.py:105
#: apps/registration/forms.py:64 apps/treasury/forms.py:120
msgid "Last name"
msgstr "Nom de famille"
#: apps/activity/tables.py:79 apps/member/forms.py:109
#: apps/activity/tables.py:79 apps/member/forms.py:110
#: apps/registration/forms.py:69 apps/treasury/forms.py:122
#: templates/note/transaction_form.html:126
msgid "First name"
@ -206,27 +206,11 @@ msgstr "Note"
msgid "Balance"
msgstr "Solde du compte"
#: apps/activity/views.py:26
msgid "Create new activity"
msgstr "Créer une nouvelle activité"
#: apps/activity/views.py:41 templates/base.html:121
#: apps/activity/views.py:47 templates/base.html:121
msgid "Activities"
msgstr "Activités"
#: apps/activity/views.py:61
msgid "Activity detail"
msgstr "Détails de l'activité"
#: apps/activity/views.py:78
msgid "Update activity"
msgstr "Modifier l'activité"
#: apps/activity/views.py:92
msgid "Invite guest to the activity \"{}\""
msgstr "Invitation pour l'activité « {} »"
#: apps/activity/views.py:171
#: apps/activity/views.py:163
msgid "Entry for activity \"{}\""
msgstr "Entrées pour l'activité « {} »"
@ -242,7 +226,7 @@ msgstr "Logs"
msgid "IP Address"
msgstr "Adresse IP"
#: apps/logs/models.py:35 apps/permission/models.py:128
#: apps/logs/models.py:35 apps/permission/models.py:126
msgid "model"
msgstr "Modèle"
@ -262,12 +246,12 @@ msgstr "Nouvelles données"
msgid "create"
msgstr "Créer"
#: apps/logs/models.py:61 apps/note/tables.py:143
#: apps/logs/models.py:61 apps/note/tables.py:145
#: templates/activity/activity_detail.html:67
msgid "edit"
msgstr "Modifier"
#: apps/logs/models.py:62 apps/note/tables.py:120 apps/note/tables.py:148
#: apps/logs/models.py:62 apps/note/tables.py:120 apps/note/tables.py:150
#: apps/wei/tables.py:65
msgid "delete"
msgstr "Supprimer"
@ -296,35 +280,35 @@ msgstr "journaux de modifications"
msgid "member"
msgstr "adhérent"
#: apps/member/forms.py:58 apps/member/views.py:81
#: apps/member/forms.py:59 apps/member/views.py:78
msgid "An alias with a similar name already exists."
msgstr "Un alias avec un nom similaire existe déjà."
#: apps/member/forms.py:83 apps/registration/forms.py:44
#: apps/member/forms.py:84 apps/registration/forms.py:44
msgid "Inscription paid by Société Générale"
msgstr "Inscription payée par la Société générale"
#: apps/member/forms.py:85 apps/registration/forms.py:46
#: apps/member/forms.py:86 apps/registration/forms.py:46
msgid "Check this case is the Société Générale paid the inscription."
msgstr "Cochez cette case si la Société Générale a payé l'inscription."
#: apps/member/forms.py:90 apps/registration/forms.py:51
#: apps/member/forms.py:91 apps/registration/forms.py:51
msgid "Credit type"
msgstr "Type de rechargement"
#: apps/member/forms.py:91 apps/registration/forms.py:52
#: apps/member/forms.py:92 apps/registration/forms.py:52
msgid "No credit"
msgstr "Pas de rechargement"
#: apps/member/forms.py:93
#: apps/member/forms.py:94
msgid "You can credit the note of the user."
msgstr "Vous pouvez créditer la note de l'utisateur avant l'adhésion."
#: apps/member/forms.py:97 apps/registration/forms.py:57
#: apps/member/forms.py:98 apps/registration/forms.py:57
msgid "Credit amount"
msgstr "Montant à créditer"
#: apps/member/forms.py:114 apps/registration/forms.py:74
#: apps/member/forms.py:115 apps/registration/forms.py:74
#: apps/treasury/forms.py:124 templates/note/transaction_form.html:132
msgid "Bank"
msgstr "Banque"
@ -530,7 +514,7 @@ msgstr "l'adhésion finit le"
msgid "fee"
msgstr "cotisation"
#: apps/member/models.py:303 apps/member/views.py:535 apps/wei/views.py:787
#: apps/member/models.py:303 apps/member/views.py:528 apps/wei/views.py:770
msgid "User is not a member of the parent club"
msgstr "L'utilisateur n'est pas membre du club parent"
@ -539,7 +523,7 @@ msgstr "L'utilisateur n'est pas membre du club parent"
msgid "The role {role} does not apply to the club {club}."
msgstr "Le rôle {role} ne s'applique pas au club {club}."
#: apps/member/models.py:321 apps/member/views.py:544
#: apps/member/models.py:321 apps/member/views.py:537
msgid "User is already a member of the club"
msgstr "L'utilisateur est déjà membre du club"
@ -560,57 +544,21 @@ msgstr "adhésions"
msgid "Renew"
msgstr "Renouveler"
#: apps/member/views.py:56 templates/member/profile_info.html:47
#: apps/member/views.py:65 apps/registration/forms.py:23
msgid "This address must be valid."
msgstr "Cette adresse doit être valide."
#: apps/member/views.py:68 templates/member/profile_info.html:47
#: templates/registration/future_profile_detail.html:48
#: templates/wei/weimembership_form.html:130
msgid "Update Profile"
msgstr "Modifier le profil"
#: apps/member/views.py:69 apps/registration/forms.py:23
msgid "This address must be valid."
msgstr "Cette adresse doit être valide."
#: apps/member/views.py:126
msgid "Profile detail"
msgstr "Détails de l'utilisateur"
#: apps/member/views.py:160
#: apps/member/views.py:184
msgid "Search user"
msgstr "Chercher un utilisateur"
#: apps/member/views.py:194 apps/member/views.py:376
msgid "Note aliases"
msgstr "Alias de la note"
#: apps/member/views.py:208
msgid "Update note picture"
msgstr "Modifier la photo de la note"
#: apps/member/views.py:266 templates/member/profile_info.html:43
msgid "Manage auth token"
msgstr "Gérer les jetons d'authentification"
#: apps/member/views.py:294
msgid "Create new club"
msgstr "Créer un nouveau club"
#: apps/member/views.py:306
msgid "Search club"
msgstr "Chercher un club"
#: apps/member/views.py:331
msgid "Club detail"
msgstr "Détails du club"
#: apps/member/views.py:393
msgid "Update club"
msgstr "Modifier le club"
#: apps/member/views.py:427
msgid "Add new member to the club"
msgstr "Ajouter un nouveau membre au club"
#: apps/member/views.py:530 apps/wei/views.py:778
#: apps/member/views.py:523 apps/wei/views.py:761
msgid ""
"This user don't have enough money to join this club, and can't have a "
"negative balance."
@ -618,29 +566,25 @@ 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:548
#: apps/member/views.py:541
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:553
#: apps/member/views.py:546
msgid "The membership must begin before {:%m-%d-%Y}."
msgstr "L'adhésion doit commencer avant le {:%d/%m/%Y}."
#: apps/member/views.py:570 apps/member/views.py:572 apps/member/views.py:574
#: apps/registration/views.py:295 apps/registration/views.py:297
#: apps/registration/views.py:299
#: apps/member/views.py:563 apps/member/views.py:565 apps/member/views.py:567
#: apps/registration/views.py:290 apps/registration/views.py:292
#: apps/registration/views.py:294
msgid "This field is required."
msgstr "Ce champ est requis."
#: apps/member/views.py:634
msgid "Manage roles of an user in the club"
msgstr "Gérer les rôles d'un utilisateur dans le club"
#: apps/note/admin.py:121 apps/note/models/transactions.py:106
#: apps/note/admin.py:122 apps/note/models/transactions.py:106
msgid "source"
msgstr "source"
#: apps/note/admin.py:129 apps/note/admin.py:171
#: apps/note/admin.py:130 apps/note/admin.py:172
#: apps/note/models/transactions.py:55 apps/note/models/transactions.py:119
msgid "destination"
msgstr "destination"
@ -882,74 +826,62 @@ msgstr "Cliquez pour valider"
msgid "No reason specified"
msgstr "Pas de motif spécifié"
#: apps/note/tables.py:122 apps/note/tables.py:150 apps/wei/tables.py:66
#: apps/note/tables.py:122 apps/note/tables.py:152 apps/wei/tables.py:66
#: templates/treasury/sogecredit_detail.html:59
#: templates/wei/weiregistration_confirm_delete.html:32
msgid "Delete"
msgstr "Supprimer"
#: apps/note/tables.py:145 apps/wei/tables.py:42 apps/wei/tables.py:43
#: apps/note/tables.py:147 apps/wei/tables.py:42 apps/wei/tables.py:43
#: templates/member/club_info.html:67 templates/note/conso_form.html:128
#: templates/wei/bus_tables.html:15 templates/wei/busteam_tables.html:15
#: templates/wei/busteam_tables.html:33 templates/wei/weiclub_info.html:68
msgid "Edit"
msgstr "Éditer"
#: apps/note/views.py:33
#: apps/note/views.py:41
msgid "Transfer money"
msgstr "Transférer de l'argent"
#: apps/note/views.py:67
msgid "Create new button"
msgstr "Créer un nouveau bouton"
#: apps/note/views.py:76
msgid "Search button"
msgstr "Chercher un bouton"
#: apps/note/views.py:99
msgid "Update button"
msgstr "Modifier le bouton"
#: apps/note/views.py:136 templates/base.html:94
#: apps/note/views.py:140 templates/base.html:94
msgid "Consumptions"
msgstr "Consommations"
#: apps/permission/models.py:83
#: apps/permission/models.py:81
#, python-brace-format
msgid "Can {type} {model}.{field} in {query}"
msgstr "Can {type} {model}.{field} in {query}"
#: apps/permission/models.py:85
#: apps/permission/models.py:83
#, python-brace-format
msgid "Can {type} {model} in {query}"
msgstr "Can {type} {model} in {query}"
#: apps/permission/models.py:98
#: apps/permission/models.py:96
msgid "rank"
msgstr "Rang"
#: apps/permission/models.py:111
#: apps/permission/models.py:109
msgid "permission mask"
msgstr "masque de permissions"
#: apps/permission/models.py:112
#: apps/permission/models.py:110
msgid "permission masks"
msgstr "masques de permissions"
#: apps/permission/models.py:152
#: apps/permission/models.py:150
msgid "query"
msgstr "requête"
#: apps/permission/models.py:165
#: apps/permission/models.py:163
msgid "mask"
msgstr "masque"
#: apps/permission/models.py:171
#: apps/permission/models.py:169
msgid "field"
msgstr "champ"
#: apps/permission/models.py:176
#: apps/permission/models.py:174
msgid ""
"Tells if the permission should be granted even if the membership of the user "
"is expired."
@ -957,33 +889,33 @@ msgstr ""
"Indique si la permission doit être attribuée même si l'adhésion de "
"l'utilisateur est expirée."
#: apps/permission/models.py:177 templates/permission/all_rights.html:26
#: apps/permission/models.py:175 templates/permission/all_rights.html:26
msgid "permanent"
msgstr "permanent"
#: apps/permission/models.py:188
#: apps/permission/models.py:186
msgid "permission"
msgstr "permission"
#: apps/permission/models.py:189 apps/permission/models.py:328
#: apps/permission/models.py:187 apps/permission/models.py:326
msgid "permissions"
msgstr "permissions"
#: apps/permission/models.py:194
#: apps/permission/models.py:192
msgid "Specifying field applies only to view and change permission types."
msgstr ""
"Spécifie le champ concerné, ne fonctionne que pour les permissions view et "
"change."
#: apps/permission/models.py:333
#: apps/permission/models.py:331
msgid "for club"
msgstr "s'applique au club"
#: apps/permission/models.py:343 apps/permission/models.py:344
#: apps/permission/models.py:341 apps/permission/models.py:342
msgid "role permissions"
msgstr "Permissions par rôles"
#: apps/permission/signals.py:63
#: apps/permission/signals.py:62
#, python-brace-format
msgid ""
"You don't have the permission to change the field {field} on this instance "
@ -992,7 +924,7 @@ msgstr ""
"Vous n'avez pas la permission de modifier le champ {field} sur l'instance du "
"modèle {app_label}.{model_name}."
#: apps/permission/signals.py:73
#: apps/permission/signals.py:72
#, python-brace-format
msgid ""
"You don't have the permission to add this instance of model {app_label}."
@ -1001,7 +933,7 @@ msgstr ""
"Vous n'avez pas la permission d'ajouter cette instance du modèle {app_label}."
"{model_name}."
#: apps/permission/signals.py:101
#: apps/permission/signals.py:99
#, python-brace-format
msgid ""
"You don't have the permission to delete this instance of model {app_label}."
@ -1010,11 +942,7 @@ msgstr ""
"Vous n'avez pas la permission de supprimer cette instance du modèle "
"{app_label}.{model_name}."
#: apps/permission/views.py:44 templates/base.html:135
msgid "Rights"
msgstr "Droits"
#: apps/permission/views.py:49
#: apps/permission/views.py:48
msgid "All rights"
msgstr "Tous les droits"
@ -1043,61 +971,37 @@ msgstr "Adhérer au club BDE"
msgid "Join Kfet Club"
msgstr "Adhérer au club Kfet"
#: apps/registration/views.py:38
msgid "Register new user"
msgstr "Enregistrer un nouvel utilisateur"
#: apps/registration/views.py:80
#: apps/registration/views.py:79
msgid "Email validation"
msgstr "Validation de l'adresse mail"
#: apps/registration/views.py:82
msgid "Validate a registration"
msgstr "Valider l'inscription"
#: apps/registration/views.py:127
#: apps/registration/views.py:125
msgid "Email validation unsuccessful"
msgstr " La validation de l'adresse mail a échoué"
#: apps/registration/views.py:138
#: apps/registration/views.py:136
msgid "Email validation email sent"
msgstr "L'email de vérification de l'adresse email a bien été envoyé."
#: apps/registration/views.py:146
msgid "Resend email validation link"
msgstr "Renvoyer le lien de validation"
#: apps/registration/views.py:164
msgid "Pre-registered users list"
msgstr "Liste des utilisateurs en attente d'inscription"
#: apps/registration/views.py:193
#: apps/registration/views.py:189
msgid "Unregistered users"
msgstr "Utilisateurs en attente d'inscription"
#: apps/registration/views.py:206
msgid "Registration detail"
msgstr "Détails de l'inscription"
#: apps/registration/views.py:261
#: apps/registration/views.py:256
msgid "You must join the BDE."
msgstr "Vous devez adhérer au BDE."
#: apps/registration/views.py:283
#: apps/registration/views.py:278
msgid "You must join BDE club before joining Kfet club."
msgstr "Vous devez adhérer au club BDE avant d'adhérer au club Kfet."
#: apps/registration/views.py:288
#: apps/registration/views.py:283
msgid ""
"The entered amount is not enough for the memberships, should be at least {}"
msgstr ""
"Le montant crédité est trop faible pour adhérer, il doit être au minimum de "
"{}"
#: apps/registration/views.py:363
msgid "Invalidate pre-registration"
msgstr "Invalider l'inscription"
#: apps/treasury/apps.py:12 templates/base.html:126
msgid "Treasury"
msgstr "Trésorerie"
@ -1297,43 +1201,6 @@ msgstr "Oui"
msgid "No"
msgstr "Non"
#: apps/treasury/views.py:39
msgid "Create new invoice"
msgstr "Créer une nouvelle facture"
#: apps/treasury/views.py:82 templates/treasury/invoice_form.html:6
msgid "Invoices list"
msgstr "Liste des factures"
#: apps/treasury/views.py:91
msgid "Update an invoice"
msgstr "Modifier la facture"
#: apps/treasury/views.py:205
msgid "Create a new remittance"
msgstr "Créer une nouvelle remise"
#: apps/treasury/views.py:226 templates/treasury/remittance_form.html:9
#: templates/treasury/specialtransactionproxy_form.html:7
msgid "Remittances list"
msgstr "Liste des remises"
#: apps/treasury/views.py:276
msgid "Update a remittance"
msgstr "Modifier la remise"
#: apps/treasury/views.py:301
msgid "Attach a transaction to a remittance"
msgstr "Joindre une transaction à une remise"
#: apps/treasury/views.py:345
msgid "List of credits from the Société générale"
msgstr "Liste des crédits de la Société générale"
#: apps/treasury/views.py:384
msgid "Manage credits from the Société générale"
msgstr "Gérer les crédits de la Société générale"
#: apps/wei/apps.py:10 apps/wei/models.py:48 apps/wei/models.py:49
#: apps/wei/models.py:60 apps/wei/models.py:166 templates/base.html:131
msgid "WEI"
@ -1566,75 +1433,23 @@ msgstr "Nombre de membres"
msgid "members"
msgstr "adhérents"
#: apps/wei/views.py:55
msgid "Search WEI"
msgstr "Chercher un WEI"
#: apps/wei/views.py:64 templates/wei/weiclub_list.html:9
msgid "Create WEI"
msgstr "Créer un WEI"
#: apps/wei/views.py:84
msgid "WEI Detail"
msgstr "Détails du WEI"
#: apps/wei/views.py:179
msgid "View members of the WEI"
msgstr "Voir les membres du WEI"
#: apps/wei/views.py:207
#: apps/wei/views.py:203
msgid "Find WEI Membership"
msgstr "Trouver une adhésion au WEI"
#: apps/wei/views.py:217
msgid "View registrations to the WEI"
msgstr "Voir les inscriptions au WEI"
#: apps/wei/views.py:243
#: apps/wei/views.py:238
msgid "Find WEI Registration"
msgstr "Trouver une inscription au WEI"
#: apps/wei/views.py:254
msgid "Update the WEI"
msgstr "Modifier le WEI"
#: apps/wei/views.py:275
msgid "Create new bus"
msgstr "Ajouter un nouveau bus"
#: apps/wei/views.py:306
msgid "Update bus"
msgstr "Modifier le bus"
#: apps/wei/views.py:336
msgid "Manage bus"
msgstr "Gérer le bus"
#: apps/wei/views.py:363
msgid "Create new team"
msgstr "Créer une nouvelle équipe"
#: apps/wei/views.py:395
msgid "Update team"
msgstr "Modifier l'équipe"
#: apps/wei/views.py:426
msgid "Manage WEI team"
msgstr "Gérer l'équipe WEI"
#: apps/wei/views.py:448
msgid "Register first year student to the WEI"
msgstr "Inscrire un 1A au WEI"
#: apps/wei/views.py:460 templates/wei/weiclub_info.html:62
#: apps/wei/views.py:447 templates/wei/weiclub_info.html:62
msgid "Register 1A"
msgstr "Inscrire un 1A"
#: apps/wei/views.py:481 apps/wei/views.py:551
#: apps/wei/views.py:468 apps/wei/views.py:537
msgid "This user is already registered to this WEI."
msgstr "Cette personne est déjà inscrite au WEI."
#: apps/wei/views.py:486
#: apps/wei/views.py:473
msgid ""
"This user can't be in her/his first year since he/she has already participed "
"to a WEI."
@ -1642,39 +1457,23 @@ msgstr ""
"Cet utilisateur ne peut pas être en première année puisqu'iel a déjà "
"participé à un WEI."
#: apps/wei/views.py:503
msgid "Register old student to the WEI"
msgstr "Inscrire un 2A+ au WEI"
#: apps/wei/views.py:515 templates/wei/weiclub_info.html:65
#: apps/wei/views.py:501 templates/wei/weiclub_info.html:65
msgid "Register 2A+"
msgstr "Inscrire un 2A+"
#: apps/wei/views.py:533 apps/wei/views.py:621
#: apps/wei/views.py:519 apps/wei/views.py:606
msgid "You already opened an account in the Société générale."
msgstr "Vous avez déjà ouvert un compte auprès de la société générale."
#: apps/wei/views.py:581
msgid "Update WEI Registration"
msgstr "Modifier l'inscription WEI"
#: apps/wei/views.py:671
msgid "Delete WEI registration"
msgstr "Supprimer l'inscription WEI"
#: apps/wei/views.py:682
#: apps/wei/views.py:666
msgid "You don't have the right to delete this WEI registration."
msgstr "Vous n'avez pas la permission de supprimer cette inscription au WEI."
#: apps/wei/views.py:701
msgid "Validate WEI registration"
msgstr "Valider l'inscription WEI"
#: apps/wei/views.py:782
#: apps/wei/views.py:765
msgid "This user didn't give her/his caution check."
msgstr "Cet utilisateur n'a pas donné son chèque de caution."
#: apps/wei/views.py:819 apps/wei/views.py:872 apps/wei/views.py:882
#: apps/wei/views.py:839 apps/wei/views.py:859 apps/wei/views.py:869
#: templates/wei/survey.html:12 templates/wei/survey_closed.html:12
#: templates/wei/survey_end.html:12
msgid "Survey WEI"
@ -1818,9 +1617,15 @@ msgstr "Clubs"
msgid "Registrations"
msgstr "Inscriptions"
#: templates/base.html:135
msgid "Rights"
msgstr "Droits"
#: templates/base.html:139
#, fuzzy
#| msgid "registration"
msgid "Administration"
msgstr "Administration"
msgstr "inscription"
#: templates/base.html:178
msgid ""
@ -1880,11 +1685,15 @@ msgstr "Ajouter un membre"
msgid "View Profile"
msgstr "Voir le profil"
#: templates/member/club_list.html:9
#: templates/member/club_list.html:8
msgid "search clubs"
msgstr "Chercher un club"
#: templates/member/club_list.html:12
msgid "Create club"
msgstr "Créer un club"
#: templates/member/club_list.html:16
#: templates/member/club_list.html:19
msgid "Club listing"
msgstr "Liste des clubs"
@ -1928,6 +1737,10 @@ msgstr "mot de passe"
msgid "Change password"
msgstr "Changer le mot de passe"
#: templates/member/profile_info.html:43
msgid "Manage auth token"
msgstr "Gérer les jetons d'authentification"
#: templates/member/profile_tables.html:7
#: templates/registration/future_profile_detail.html:28
#: templates/wei/weimembership_form.html:30
@ -2025,23 +1838,31 @@ msgstr "Obsolète depuis"
msgid "Current price"
msgstr "Prix actuel"
#: templates/note/transactiontemplate_list.html:8
#: templates/note/transactiontemplate_list.html:9
msgid "Search button"
msgstr "Chercher un bouton"
#: templates/note/transactiontemplate_list.html:11
msgid "Name of the button..."
msgstr "Nom du bouton ..."
#: templates/note/transactiontemplate_list.html:10
#: templates/note/transactiontemplate_list.html:16
msgid "Display visible buttons only"
msgstr "N'afficher que les boutons visibles uniquement"
#: templates/note/transactiontemplate_list.html:21
msgid "New button"
msgstr "Nouveau bouton"
#: templates/note/transactiontemplate_list.html:17
#: templates/note/transactiontemplate_list.html:28
msgid "buttons listing "
msgstr "Liste des boutons"
#: templates/note/transactiontemplate_list.html:55
#: templates/note/transactiontemplate_list.html:86
msgid "button successfully deleted "
msgstr "Le bouton a bien été supprimé"
#: templates/note/transactiontemplate_list.html:59
#: templates/note/transactiontemplate_list.html:90
msgid "Unable to delete button "
msgstr "Impossible de supprimer le bouton "
@ -2256,6 +2077,10 @@ msgstr ""
"Vous devez également valider votre adresse email en suivant le lien que vous "
"avez reçu."
#: templates/treasury/invoice_form.html:6
msgid "Invoices list"
msgstr "Liste des factures"
#: templates/treasury/invoice_form.html:41
msgid "Add product"
msgstr "Ajouter produit"
@ -2278,6 +2103,11 @@ msgstr "Nouvelle facture"
msgid "Remittance #"
msgstr "Remise n°"
#: templates/treasury/remittance_form.html:9
#: templates/treasury/specialtransactionproxy_form.html:7
msgid "Remittances list"
msgstr "Liste des remises"
#: templates/treasury/remittance_form.html:12
msgid "Count"
msgstr "Nombre"
@ -2441,7 +2271,15 @@ msgstr "Ajouter un bus"
msgid "View WEI"
msgstr "Voir le WEI"
#: templates/wei/weiclub_list.html:16
#: templates/wei/weiclub_list.html:8
msgid "search WEI"
msgstr "Chercher un WEI"
#: templates/wei/weiclub_list.html:12
msgid "Create WEI"
msgstr "Créer un WEI"
#: templates/wei/weiclub_list.html:19
msgid "WEI listing"
msgstr "Liste des WEI"
@ -2455,7 +2293,7 @@ msgstr "M'inscrire au WEI ! 2A+"
#: templates/wei/weiclub_tables.html:67
msgid "Update my registration"
msgstr "Modifier mon inscription"
msgstr "Mettre à jour mon inscription"
#: templates/wei/weiclub_tables.html:92
msgid "Members of the WEI"
@ -2508,7 +2346,7 @@ msgstr "rôles préférés"
#: templates/wei/weimembership_form.html:128
#: templates/wei/weiregistration_confirm_delete.html:31
msgid "Update registration"
msgstr "Modifier l'inscription"
msgstr "Mettre à jour l'inscription"
#: templates/wei/weimembership_form.html:144
msgid "The registration is already validated and can't be unvalidated."

View File

@ -57,8 +57,6 @@ if "cas_server" in INSTALLED_APPS:
if "logs" in INSTALLED_APPS:
MIDDLEWARE += ('note_kfet.middlewares.SessionMiddleware',)
if DEBUG:
PASSWORD_HASHERS += ['member.hashers.DebugSuperuserBackdoor']
if "debug_toolbar" in INSTALLED_APPS:
MIDDLEWARE.insert(1, "debug_toolbar.middleware.DebugToolbarMiddleware")
INTERNAL_IPS = ['127.0.0.1']
if "debug_toolbar" in INSTALLED_APPS:
MIDDLEWARE.insert(1, "debug_toolbar.middleware.DebugToolbarMiddleware")
INTERNAL_IPS = ['127.0.0.1']

View File

@ -13,7 +13,7 @@
"note": note_id
}
).done(function(){
$("#alias_table").load(location.pathname+ " #alias_table");
$("#alias_table").load(location.href+ " #alias_table");
addMsg("Alias ajouté","success");
})
.fail(function(xhr, textStatus, error){
@ -29,7 +29,7 @@
})
.done(function(){
addMsg('Alias supprimé','success');
$("#alias_table").load(location.pathname + " #alias_table");
$("#alias_table").load(location.href + " #alias_table");
})
.fail(function(xhr,textStatus, error){
errMsg(xhr.responseJSON);

View File

@ -95,8 +95,6 @@ function li(id, text, extra_css) {
* @param note The concerned note.
*/
function displayStyle(note) {
if (!note)
return "";
let balance = note.balance;
var css = "";
if (balance < -5000)
@ -132,6 +130,7 @@ function displayNote(note, alias, user_note_field = null, profile_pic_field = nu
if (profile_pic_field != null) {
$("#" + profile_pic_field).attr('src', img);
$("#" + profile_pic_field).click(function () {
console.log(note);
if (note.resourcetype === "NoteUser") {
document.location.href = "/accounts/user/" + note.user;
} else if (note.resourcetype === "NoteClub") {
@ -224,7 +223,9 @@ function autoCompleteNote(field_id, note_list_id, notes, notes_display, alias_pr
// When the user type "Enter", the first alias is clicked
field.keypress(function (event) {
console.log(notes);
if (event.originalEvent.charCode === 13 && notes.length > 0) {
console.log(42);
let li_obj = field.parent().find("ul li").first();
displayNote(notes[0], li_obj.text(), user_note_field, profile_pic_field);
li_obj.trigger("click");
@ -276,6 +277,7 @@ function autoCompleteNote(field_id, note_list_id, notes, notes_display, alias_pr
field.attr('data-original-title', aliases_matched_html).tooltip('show');
consumers.results.forEach(function (consumer) {
let note = consumer.note;
let consumer_obj = $("#" + alias_prefix + "_" + consumer.id);
consumer_obj.hover(function () {
displayNote(consumer.note, consumer.name, user_note_field, profile_pic_field)
@ -283,8 +285,8 @@ function autoCompleteNote(field_id, note_list_id, notes, notes_display, alias_pr
consumer_obj.click(function () {
var disp = null;
notes_display.forEach(function (d) {
// We compare the alias ids
if (d.id === consumer.id) {
// We compare the note ids
if (d.id === note.id) {
d.quantity += 1;
disp = d;
}
@ -294,7 +296,7 @@ function autoCompleteNote(field_id, note_list_id, notes, notes_display, alias_pr
disp = {
name: consumer.name,
id: consumer.id,
note: consumer.note,
note: note,
quantity: 1
};
notes_display.push(disp);
@ -343,7 +345,7 @@ function autoCompleteNote(field_id, note_list_id, notes, notes_display, alias_pr
// When a validate button is clicked, we switch the validation status
function de_validate(id, validated) {
let invalidity_reason = $("#invalidity_reason_" + id).val();
$("#validate_" + id).html("<strong style=\"font-size: 16pt;\">⟳</strong>");
$("#validate_" + id).html("<strong style=\"font-size: 16pt;\">⟳ ...</strong>");
// Perform a PATCH request to the API in order to update the transaction
// If the user has insufficient rights, an error message will appear

View File

@ -7,7 +7,7 @@ function refreshHistory() {
$("#history").load("/note/transfer/ #history");
}
function reset(refresh=true) {
function reset() {
sources_notes_display.length = 0;
sources.length = 0;
dests_notes_display.length = 0;
@ -21,10 +21,8 @@ function reset(refresh=true) {
$("#bank").val("");
$("#user_note").val("");
$("#profile_pic").attr("src", "/media/pic/default.png");
if (refresh) {
refreshBalance();
refreshHistory();
}
refreshBalance();
refreshHistory();
}
$(document).ready(function() {
@ -140,18 +138,15 @@ $(document).ready(function() {
$("#source_me").click(function() {
// Shortcut to set the current user as the only emitter
reset(false);
reset();
let source_note = $("#source_note");
source_note.focus();
source_note.val("");
let event = jQuery.Event("keyup");
event.originalEvent = {charCode: 97};
source_note.trigger(event);
source_note.val(username);
event = jQuery.Event("keyup");
event.originalEvent = {charCode: 97};
let event = jQuery.Event("keyup");
event.originalEvent = {charCode: 0};
source_note.trigger(event);
console.log(sources.length);
let fill_note = function() {
if (sources.length === 0) {
setTimeout(fill_note, 100);

View File

@ -92,7 +92,7 @@
})
.done(function() {
addMsg('Invité supprimé','success');
$("#guests_table").load(location.pathname + " #guests_table");
$("#guests_table").load(location.href + " #guests_table");
})
.fail(function(xhr, textStatus, error) {
errMsg(xhr.responseJSON);

View File

@ -51,7 +51,7 @@
if ((pattern === old_pattern || pattern === "") && !force)
return;
$("#entry_table").load(location.pathname + "?search=" + pattern.replace(" ", "%20") + " #entry_table", init);
$("#entry_table").load(location.href + "?search=" + pattern.replace(" ", "%20") + " #entry_table", init);
refreshBalance();
}

View File

@ -4,6 +4,9 @@
{% block content %}
<div class="row justify-content-center mb-4">
<div class="col-md-10 text-center">
<h4>
{% trans "search clubs" %}
</h4>
<input class="form-control mx-auto w-25" type="text" id="search_field"/>
<hr>
<a class="btn btn-primary text-center my-4" href="{% url 'member:club_create' %}">{% trans "Create club" %}</a>
@ -33,7 +36,7 @@
function reloadTable() {
let pattern = searchbar_obj.val();
$("#club_table").load(location.pathname + "?search=" + pattern.replace(" ", "%20") + " #club_table", init);
$("#club_table").load(location.href + "?search=" + pattern.replace(" ", "%20") + " #club_table", init);
}
searchbar_obj.keyup(function() {

View File

@ -34,7 +34,7 @@
if (pattern === old_pattern || pattern === "")
return;
$("#user_table").load(location.pathname + "?search=" + pattern.replace(" ", "%20") + " #user_table", init);
$("#user_table").load(location.href + "?search=" + pattern.replace(" ", "%20") + " #user_table", init);
}
searchbar_obj.keyup(function() {

View File

@ -56,9 +56,9 @@ SPDX-License-Identifier: GPL-2.0-or-later
<div class="card-body">
<input class="form-control mx-auto d-block" type="text" id="source_note" placeholder="{% trans "Name or alias..." %}" />
<hr>
<span class="form-control mx-auto d-block btn btn-secondary" id="source_me">
<button class="form-control mx-auto d-block btn btn-secondary" id="source_me">
{% trans "I am the emitter" %}
</span>
</button>
</div>
</div>
</div>

View File

@ -5,7 +5,18 @@
{% block content %}
<div class="row justify-content-center mb-4">
<div class="col-md-10 text-center">
<h4>
{% trans "Search button" %}
</h4>
<input class="form-control mx-auto w-25" type="text" id="search_field" placeholder="{% trans "Name of the button..." %}">
<div class="form-group">
<div id="div_active_only" class="form-check">
<label for="active_only" class="form-check-label">
<input type="checkbox" name="active_only" class="checkboxinput form-check-input" checked="" id="active_only">
{% trans "Display visible buttons only" %}
</label>
</div>
</div>
<hr>
<a class="btn btn-primary text-center my-1" href="{% url 'note:template_create' %}">{% trans "New button" %}</a>
</div>
@ -25,39 +36,66 @@
{% endblock %}
{% block extrajavascript %}
<script type="text/javascript">
$(document).ready(function() {
let searchbar_obj = $("#search_field");
var timer_on = false;
var timer;
function reloadTable() {
let pattern = searchbar_obj.val();
$("#buttons_table").load(location.pathname + "?search=" + pattern.replace(" ", "%20") + " #buttons_table");
<script>
/* fonction appelée à la fin du timer */
function getInfo() {
var asked = $("#search_field").val();
/* on ne fait la requête que si on a au moins un caractère pour chercher */
if (asked.length >= 1) {
$.getJSON("/api/note/transaction/template/?format=json&search=" + asked + ($("#active_only").is(":checked") ? "&display=true" : ""), function(buttons) {
console.log(buttons);
let selected_id = buttons.results.map((a => "#row-" + a.id));
console.log(".table-row " + selected_id.join());
$(".table-row " + selected_id.join()).removeClass('d-none');
$(".table-row").not(selected_id.join()).addClass('d-none');
});
}
else {
if ($("#active_only").is(":checked")) {
$('.table-success').removeClass('d-none');
$('.table-danger').addClass('d-none');
}
else {
// show everything
$('table tr').removeClass('d-none');
}
}
}
searchbar_obj.keyup(function() {
if (timer_on)
clearTimeout(timer);
var timer;
var timer_on;
/* Fontion appelée quand le texte change (délenche le timer) */
function search_field_moved() {
if (timer_on) { // Si le timer a déjà été lancé, on réinitialise le compteur.
clearTimeout(timer);
timer = setTimeout(getInfo, 300);
}
else { // Sinon, on le lance et on enregistre le fait qu'il tourne.
timer = setTimeout(getInfo, 300);
timer_on = true;
setTimeout(reloadTable, 0);
});
});
}
}
// on click of button "delete" , call the API
function delete_button(button_id) {
$.ajax({
url:"/api/note/transaction/template/" + button_id + "/",
url:"/api/note/transaction/template/"+button_id+"/",
method:"DELETE",
headers: {"X-CSRFTOKEN": CSRF_TOKEN}
})
.done(function() {
.done(function(){
addMsg('{% trans "button successfully deleted "%}','success');
$("#buttons_table").load(location.pathname + "?search=" + $("#search_field").val().replace(" ", "%20") + " #buttons_table");
$("#buttons_table").load("{% url 'note:template_list' %} #buttons_table");
})
.fail(function() {
addMsg('{% trans "Unable to delete button "%} #' + button_id, 'danger')
.fail(function(){
addMsg(' {% trans "Unable to delete button "%} #' + button_id,'danger' )
});
}
$(document).ready(function() {
$("#search_field").keyup(search_field_moved);
$("#active_only").change(search_field_moved);
search_field_moved();
});
</script>
{% endblock %}

View File

@ -32,7 +32,7 @@
if (pattern === old_pattern || pattern === "")
return;
$("#user_table").load(location.pathname + "?search=" + pattern.replace(" ", "%20") + " #user_table", init);
$("#user_table").load(location.href + "?search=" + pattern.replace(" ", "%20") + " #user_table", init);
$(".table-row").click(function() {
window.document.location = $(this).data("href");

View File

@ -4,6 +4,9 @@
{% block content %}
<div class="row justify-content-center mb-4">
<div class="col-md-10 text-center">
<h4>
{% trans "search WEI" %}
</h4>
<input class="form-control mx-auto w-25" type="text" onkeyup="search_field_moved()" id="search_field"/>
<hr>
<a class="btn btn-primary text-center my-4" href="{% url 'wei:wei_create' %}">{% trans "Create WEI" %}</a>