mirror of
https://github.com/ae-utbm/sith.git
synced 2026-04-22 03:03:13 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e57c29a7b5 | |||
| ca37996d6a | |||
| 173311c1d5 | |||
| 2995823d6e |
+4
-2
@@ -6,7 +6,7 @@ from ninja_extra.pagination import PageNumberPaginationExtra
|
||||
from ninja_extra.schemas import PaginatedResponseSchema
|
||||
|
||||
from api.auth import ApiKeyAuth
|
||||
from api.permissions import CanView, HasPerm
|
||||
from api.permissions import CanAccessLookup, CanView, HasPerm
|
||||
from club.models import Club, Membership
|
||||
from club.schemas import (
|
||||
ClubSchema,
|
||||
@@ -22,11 +22,13 @@ class ClubController(ControllerBase):
|
||||
@route.get(
|
||||
"/search",
|
||||
response=PaginatedResponseSchema[SimpleClubSchema],
|
||||
auth=[ApiKeyAuth(), SessionAuth()],
|
||||
permissions=[CanAccessLookup],
|
||||
url_name="search_club",
|
||||
)
|
||||
@paginate(PageNumberPaginationExtra, page_size=50)
|
||||
def search_club(self, filters: Query[ClubSearchFilterSchema]):
|
||||
return filters.filter(Club.objects.order_by("name")).values()
|
||||
return filters.filter(Club.objects.all())
|
||||
|
||||
@route.get(
|
||||
"/{int:club_id}",
|
||||
|
||||
@@ -315,27 +315,3 @@ class JoinClubForm(ClubMemberForm):
|
||||
_("You are already a member of this club"), code="invalid"
|
||||
)
|
||||
return super().clean()
|
||||
|
||||
|
||||
class ClubSearchForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = Club
|
||||
fields = ["name"]
|
||||
widgets = {"name": forms.SearchInput(attrs={"autocomplete": "off"})}
|
||||
|
||||
club_status = forms.NullBooleanField(
|
||||
label=_("Club status"),
|
||||
widget=forms.RadioSelect(
|
||||
choices=[(True, _("Active")), (False, _("Inactive")), ("", _("All clubs"))],
|
||||
),
|
||||
initial=True,
|
||||
)
|
||||
|
||||
def __init__(self, *args, data: dict | None = None, **kwargs):
|
||||
super().__init__(*args, data=data, **kwargs)
|
||||
if data is not None and "club_status" not in data:
|
||||
# if the key is missing, it is considered as None,
|
||||
# even though we want the default True value to be applied in such a case
|
||||
# so we enforce it.
|
||||
self.fields["club_status"].value = True
|
||||
self.fields["name"].required = False
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ class ClubProfileSchema(ModelSchema):
|
||||
|
||||
class Meta:
|
||||
model = Club
|
||||
fields = ["id", "name", "logo", "is_active", "short_description"]
|
||||
fields = ["id", "name", "logo"]
|
||||
|
||||
url: str
|
||||
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
#club-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2em;
|
||||
padding: 2em;
|
||||
|
||||
.card {
|
||||
display: block;
|
||||
background-color: unset;
|
||||
|
||||
.club-image {
|
||||
float: left;
|
||||
margin-right: 2rem;
|
||||
margin-bottom: .5rem;
|
||||
width: 150px;
|
||||
height: 150px;
|
||||
border-radius: 10%;
|
||||
background-color: rgba(173, 173, 173, 0.2);
|
||||
|
||||
@media screen and (max-width: 500px) {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
}
|
||||
}
|
||||
|
||||
i.club-image {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
color: black;
|
||||
}
|
||||
|
||||
.content {
|
||||
display: block;
|
||||
text-align: justify;
|
||||
|
||||
h4 {
|
||||
margin-top: 0;
|
||||
margin-right: .5rem;
|
||||
}
|
||||
|
||||
p {
|
||||
font-size: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,76 +1,52 @@
|
||||
{% if is_fragment %}
|
||||
{% extends "core/base_fragment.jinja" %}
|
||||
|
||||
{# Don't display tabs and errors #}
|
||||
{% block tabs %}
|
||||
{% endblock %}
|
||||
{% block errors %}
|
||||
{% endblock %}
|
||||
{% else %}
|
||||
{% extends "core/base.jinja" %}
|
||||
{% block additional_css %}
|
||||
<link rel="stylesheet" href="{{ static("club/list.scss") }}">
|
||||
{% endblock %}
|
||||
{% block description -%}
|
||||
{% trans %}The list of all clubs existing at UTBM.{% endtrans %}
|
||||
{%- endblock %}
|
||||
|
||||
{% block title -%}
|
||||
{% trans %}Club list{% endtrans %}
|
||||
{%- endblock %}
|
||||
|
||||
{% block description -%}
|
||||
{% trans %}The list of all clubs existing at UTBM.{% endtrans %}
|
||||
{%- endblock %}
|
||||
|
||||
{% macro display_club(club) -%}
|
||||
|
||||
{% if club.is_active or user.is_root %}
|
||||
|
||||
<li><a href="{{ url('club:club_view', club_id=club.id) }}">{{ club.name }}</a>
|
||||
|
||||
{% if not club.is_active %}
|
||||
({% trans %}inactive{% endtrans %})
|
||||
{% endif %}
|
||||
|
||||
{% from "core/macros.jinja" import paginate_htmx %}
|
||||
{% if club.president %} - <a href="{{ url('core:user_profile', user_id=club.president.user.id) }}">{{ club.president.user }}</a>{% endif %}
|
||||
{% if club.short_description %}<p>{{ club.short_description|markdown }}</p>{% endif %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
{%- if club.children.all()|length != 0 %}
|
||||
<ul>
|
||||
{%- for c in club.children.order_by('name').prefetch_related("children") %}
|
||||
{{ display_club(c) }}
|
||||
{%- endfor %}
|
||||
</ul>
|
||||
{%- endif -%}
|
||||
</li>
|
||||
{%- endmacro %}
|
||||
|
||||
{% block content %}
|
||||
<main>
|
||||
<h3>{% trans %}Filters{% endtrans %}</h3>
|
||||
<form
|
||||
id="club-list-filters"
|
||||
hx-get="{{ url("club:club_list") }}"
|
||||
hx-target="#content"
|
||||
hx-swap="outerHtml"
|
||||
hx-push-url="true"
|
||||
>
|
||||
<div class="row gap-4x">
|
||||
{{ form }}
|
||||
</div>
|
||||
<button type="submit" class="btn btn-blue margin-bottom">
|
||||
<i class="fa fa-magnifying-glass"></i>{% trans %}Search{% endtrans %}
|
||||
</button>
|
||||
</form>
|
||||
{% if user.is_root %}
|
||||
<p><a href="{{ url('club:club_new') }}">{% trans %}New club{% endtrans %}</a></p>
|
||||
{% endif %}
|
||||
{% if club_list %}
|
||||
<h3>{% trans %}Club list{% endtrans %}</h3>
|
||||
{% if user.has_perm("club.add_club") %}
|
||||
<br>
|
||||
<a href="{{ url('club:club_new') }}" class="btn btn-blue">
|
||||
<i class="fa fa-plus"></i> {% trans %}New club{% endtrans %}
|
||||
</a>
|
||||
{% endif %}
|
||||
<section class="aria-busy-grow" id="club-list">
|
||||
{% for club in object_list %}
|
||||
<div class="card">
|
||||
{% set club_url = club.get_absolute_url() %}
|
||||
<a href="{{ club_url }}">
|
||||
{% if club.logo %}
|
||||
<img class="club-image" src="{{ club.logo.url }}" alt="logo {{ club.name }}">
|
||||
<ul>
|
||||
{%- for club in club_list %}
|
||||
{{ display_club(club) }}
|
||||
{%- endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
<i class="fa-regular fa-image fa-4x club-image"></i>
|
||||
{% trans %}There is no club in this website.{% endtrans %}
|
||||
{% endif %}
|
||||
</a>
|
||||
<div class="content">
|
||||
<a href="{{ club_url }}">
|
||||
<h4>
|
||||
{{ club.name }} {% if not club.is_active %}({% trans %}inactive{% endtrans %}){% endif %}
|
||||
</h4>
|
||||
</a>
|
||||
{{ club.short_description|markdown }}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</section>
|
||||
{% if is_paginated %}
|
||||
{{ paginate_htmx(request, page_obj, paginator) }}
|
||||
{% endif %}
|
||||
</main>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
{% extends "core/base.jinja" %}
|
||||
{% from 'core/macros.jinja' import user_profile_link, select_all_checkbox %}
|
||||
|
||||
{% block additional_js %}
|
||||
<script type="module" src="{{ static("bundled/core/components/ajax-select-index.ts") }}"></script>
|
||||
{% endblock %}
|
||||
{% block additional_css %}
|
||||
<link rel="stylesheet" href="{{ static("bundled/core/components/ajax-select-index.css") }}">
|
||||
<link rel="stylesheet" href="{{ static("club/members.scss") }}">
|
||||
{% endblock %}
|
||||
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
from datetime import timedelta
|
||||
|
||||
import pytest
|
||||
from django.test import Client
|
||||
from django.urls import reverse
|
||||
from django.utils.timezone import localdate
|
||||
from model_bakery import baker
|
||||
from model_bakery.recipe import Recipe
|
||||
|
||||
from club.models import Club, Membership
|
||||
from core.baker_recipes import subscriber_user
|
||||
from core.models import User
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
@@ -28,14 +25,3 @@ def test_club_queryset_having_board_member():
|
||||
|
||||
club_ids = Club.objects.having_board_member(user).values_list("id", flat=True)
|
||||
assert set(club_ids) == {clubs[1].id, clubs[2].id}
|
||||
|
||||
|
||||
@pytest.mark.parametrize("nb_additional_clubs", [10, 30])
|
||||
@pytest.mark.parametrize("is_fragment", [True, False])
|
||||
@pytest.mark.django_db
|
||||
def test_club_list(client: Client, nb_additional_clubs: int, is_fragment):
|
||||
client.force_login(baker.make(User))
|
||||
baker.make(Club, _quantity=nb_additional_clubs)
|
||||
headers = {"HX-Request": True} if is_fragment else {}
|
||||
res = client.get(reverse("club:club_list"), headers=headers)
|
||||
assert res.status_code == 200
|
||||
|
||||
+9
-46
@@ -44,19 +44,13 @@ from django.utils.translation import gettext
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.views.generic import DetailView, ListView, View
|
||||
from django.views.generic.detail import SingleObjectMixin
|
||||
from django.views.generic.edit import (
|
||||
CreateView,
|
||||
DeleteView,
|
||||
FormMixin,
|
||||
UpdateView,
|
||||
)
|
||||
from django.views.generic.edit import CreateView, DeleteView, UpdateView
|
||||
|
||||
from club.forms import (
|
||||
ClubAddMemberForm,
|
||||
ClubAdminEditForm,
|
||||
ClubEditForm,
|
||||
ClubOldMemberForm,
|
||||
ClubSearchForm,
|
||||
JoinClubForm,
|
||||
MailingForm,
|
||||
SellingsForm,
|
||||
@@ -72,12 +66,7 @@ from com.views import (
|
||||
from core.auth.mixins import CanEditMixin, PermissionOrClubBoardRequiredMixin
|
||||
from core.models import Page, PageRev
|
||||
from core.views import BasePageEditView, DetailFormView, UseFragmentsMixin
|
||||
from core.views.mixins import (
|
||||
AllowFragment,
|
||||
FragmentMixin,
|
||||
FragmentRenderer,
|
||||
TabedViewMixin,
|
||||
)
|
||||
from core.views.mixins import FragmentMixin, FragmentRenderer, TabedViewMixin
|
||||
from counter.models import Selling
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@@ -191,41 +180,15 @@ class ClubTabsMixin(TabedViewMixin):
|
||||
return tab_list
|
||||
|
||||
|
||||
class ClubListView(AllowFragment, FormMixin, ListView):
|
||||
"""List the clubs of the AE, with a form to perform basic search.
|
||||
|
||||
Notes:
|
||||
This view is fully public, because we want to advertise as much as possible
|
||||
the cultural life of the AE.
|
||||
In accordance with that matter, searching and listing the clubs is done
|
||||
entirely server-side (no AlpineJS involved) ;
|
||||
this is done this way in order to be sure the page is the most accessible
|
||||
and SEO-friendly possible, even if it makes the UX slightly less smooth.
|
||||
"""
|
||||
class ClubListView(ListView):
|
||||
"""List the Clubs."""
|
||||
|
||||
model = Club
|
||||
template_name = "club/club_list.jinja"
|
||||
form_class = ClubSearchForm
|
||||
queryset = Club.objects.order_by("name")
|
||||
paginate_by = 20
|
||||
|
||||
def get_form_kwargs(self):
|
||||
res = super().get_form_kwargs()
|
||||
if self.request.method == "GET":
|
||||
res |= {"data": self.request.GET, "initial": self.request.GET}
|
||||
return res
|
||||
|
||||
def get_queryset(self):
|
||||
form: ClubSearchForm = self.get_form()
|
||||
qs = self.queryset
|
||||
if not form.is_bound:
|
||||
return qs.filter(is_active=True)
|
||||
if not form.is_valid():
|
||||
return qs.none()
|
||||
if name := form.cleaned_data.get("name"):
|
||||
qs = qs.filter(name__icontains=name)
|
||||
if (is_active := form.cleaned_data.get("club_status")) is not None:
|
||||
qs = qs.filter(is_active=is_active)
|
||||
return qs
|
||||
queryset = (
|
||||
Club.objects.filter(parent=None).order_by("name").prefetch_related("children")
|
||||
)
|
||||
context_object_name = "club_list"
|
||||
|
||||
|
||||
class ClubView(ClubTabsMixin, DetailView):
|
||||
|
||||
+1
-1
@@ -123,7 +123,7 @@ class GroupController(ControllerBase):
|
||||
)
|
||||
@paginate(PageNumberPaginationExtra, page_size=50)
|
||||
def search_group(self, search: Annotated[str, MinLen(1)]):
|
||||
return Group.objects.filter(name__icontains=search).order_by("name").values()
|
||||
return Group.objects.filter(name__icontains=search).values()
|
||||
|
||||
|
||||
DepthValue = Annotated[int, Ge(0), Le(10)]
|
||||
|
||||
@@ -39,16 +39,12 @@ class Command(BaseCommand):
|
||||
return None
|
||||
return xapian.version_string()
|
||||
|
||||
def _desired_version(self) -> tuple[str, str, str]:
|
||||
def _desired_version(self) -> str:
|
||||
with open(
|
||||
Path(__file__).parent.parent.parent.parent / "pyproject.toml", "rb"
|
||||
) as f:
|
||||
pyproject = tomli.load(f)
|
||||
return (
|
||||
pyproject["tool"]["xapian"]["version"],
|
||||
pyproject["tool"]["xapian"]["core-sha256"],
|
||||
pyproject["tool"]["xapian"]["bindings-sha256"],
|
||||
)
|
||||
return pyproject["tool"]["xapian"]["version"]
|
||||
|
||||
def handle(self, *args, force: bool, **options):
|
||||
if not os.environ.get("VIRTUAL_ENV", None):
|
||||
@@ -57,7 +53,7 @@ class Command(BaseCommand):
|
||||
)
|
||||
return
|
||||
|
||||
desired, core_checksum, bindings_checksum = self._desired_version()
|
||||
desired = self._desired_version()
|
||||
if desired == self._current_version():
|
||||
if not force:
|
||||
self.stdout.write(
|
||||
@@ -69,12 +65,7 @@ class Command(BaseCommand):
|
||||
f"Installing xapian version {desired} at {os.environ['VIRTUAL_ENV']}"
|
||||
)
|
||||
subprocess.run(
|
||||
[
|
||||
str(Path(__file__).parent / "install_xapian.sh"),
|
||||
desired,
|
||||
core_checksum,
|
||||
bindings_checksum,
|
||||
],
|
||||
[str(Path(__file__).parent / "install_xapian.sh"), desired],
|
||||
env=dict(os.environ),
|
||||
check=True,
|
||||
)
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
# Originates from https://gist.github.com/jorgecarleitao/ab6246c86c936b9c55fd
|
||||
# first argument of the script is Xapian version (e.g. 1.2.19)
|
||||
# second argument of the script is core sha256
|
||||
# second argument of the script is binding sha256
|
||||
VERSION="$1"
|
||||
CORE_SHA256="$2"
|
||||
BINDINGS_SHA256="$3"
|
||||
|
||||
# Cleanup env vars for auto discovery mechanism
|
||||
unset CPATH
|
||||
@@ -25,15 +21,9 @@ BINDINGS=xapian-bindings-$VERSION
|
||||
|
||||
# download
|
||||
echo "Downloading source..."
|
||||
curl -O "https://oligarchy.co.uk/xapian/$VERSION/${CORE}.tar.xz" || exit 1
|
||||
|
||||
echo "${CORE_SHA256} ${CORE}.tar.xz" | sha256sum -c - || exit 1
|
||||
|
||||
curl -O "https://oligarchy.co.uk/xapian/$VERSION/${CORE}.tar.xz"
|
||||
curl -O "https://oligarchy.co.uk/xapian/$VERSION/${BINDINGS}.tar.xz"
|
||||
|
||||
echo "${BINDINGS_SHA256} ${BINDINGS}.tar.xz" | sha256sum -c - || exit 1
|
||||
|
||||
|
||||
# extract
|
||||
echo "Extracting source..."
|
||||
tar xf "${CORE}.tar.xz"
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
# details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along with
|
||||
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||
# this program; if not, write to the Free Sofware Foundation, Inc., 59 Temple
|
||||
# Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#
|
||||
@@ -41,14 +41,7 @@ from com.ics_calendar import IcsCalendar
|
||||
from com.models import News, NewsDate, Sith, Weekmail
|
||||
from core.models import BanGroup, Group, Page, PageRev, SithFile, User
|
||||
from core.utils import resize_image
|
||||
from counter.models import (
|
||||
Counter,
|
||||
Price,
|
||||
Product,
|
||||
ProductType,
|
||||
ReturnableProduct,
|
||||
StudentCard,
|
||||
)
|
||||
from counter.models import Counter, Product, ProductType, ReturnableProduct, StudentCard
|
||||
from election.models import Candidature, Election, ElectionList, Role
|
||||
from forum.models import Forum
|
||||
from pedagogy.models import UE
|
||||
@@ -117,7 +110,7 @@ class Command(BaseCommand):
|
||||
p.save(force_lock=True)
|
||||
|
||||
club_root = SithFile.objects.create(name="clubs", owner=root)
|
||||
sas = SithFile.objects.create(name="SAS", owner=root, is_in_sas=True)
|
||||
sas = SithFile.objects.create(name="SAS", owner=root)
|
||||
main_club = Club.objects.create(
|
||||
id=1, name="AE", address="6 Boulevard Anatole France, 90000 Belfort"
|
||||
)
|
||||
@@ -379,15 +372,125 @@ class Command(BaseCommand):
|
||||
end_date=localdate() - timedelta(days=100),
|
||||
)
|
||||
|
||||
self._create_products(groups, main_club, refound)
|
||||
p = ProductType.objects.create(name="Bières bouteilles")
|
||||
c = ProductType.objects.create(name="Cotisations")
|
||||
r = ProductType.objects.create(name="Rechargements")
|
||||
verre = ProductType.objects.create(name="Verre")
|
||||
cotis = Product.objects.create(
|
||||
name="Cotis 1 semestre",
|
||||
code="1SCOTIZ",
|
||||
product_type=c,
|
||||
purchase_price="15",
|
||||
selling_price="15",
|
||||
special_selling_price="15",
|
||||
club=main_club,
|
||||
)
|
||||
cotis2 = Product.objects.create(
|
||||
name="Cotis 2 semestres",
|
||||
code="2SCOTIZ",
|
||||
product_type=c,
|
||||
purchase_price="28",
|
||||
selling_price="28",
|
||||
special_selling_price="28",
|
||||
club=main_club,
|
||||
)
|
||||
refill = Product.objects.create(
|
||||
name="Rechargement 15 €",
|
||||
code="15REFILL",
|
||||
product_type=r,
|
||||
purchase_price="15",
|
||||
selling_price="15",
|
||||
special_selling_price="15",
|
||||
club=main_club,
|
||||
)
|
||||
barb = Product.objects.create(
|
||||
name="Barbar",
|
||||
code="BARB",
|
||||
product_type=p,
|
||||
purchase_price="1.50",
|
||||
selling_price="1.7",
|
||||
special_selling_price="1.6",
|
||||
club=main_club,
|
||||
limit_age=18,
|
||||
)
|
||||
cble = Product.objects.create(
|
||||
name="Chimay Bleue",
|
||||
code="CBLE",
|
||||
product_type=p,
|
||||
purchase_price="1.50",
|
||||
selling_price="1.7",
|
||||
special_selling_price="1.6",
|
||||
club=main_club,
|
||||
limit_age=18,
|
||||
)
|
||||
cons = Product.objects.create(
|
||||
name="Consigne Eco-cup",
|
||||
code="CONS",
|
||||
product_type=verre,
|
||||
purchase_price="1",
|
||||
selling_price="1",
|
||||
special_selling_price="1",
|
||||
club=main_club,
|
||||
)
|
||||
dcons = Product.objects.create(
|
||||
name="Déconsigne Eco-cup",
|
||||
code="DECO",
|
||||
product_type=verre,
|
||||
purchase_price="-1",
|
||||
selling_price="-1",
|
||||
special_selling_price="-1",
|
||||
club=main_club,
|
||||
)
|
||||
cors = Product.objects.create(
|
||||
name="Corsendonk",
|
||||
code="CORS",
|
||||
product_type=p,
|
||||
purchase_price="1.50",
|
||||
selling_price="1.7",
|
||||
special_selling_price="1.6",
|
||||
club=main_club,
|
||||
limit_age=18,
|
||||
)
|
||||
carolus = Product.objects.create(
|
||||
name="Carolus",
|
||||
code="CARO",
|
||||
product_type=p,
|
||||
purchase_price="1.50",
|
||||
selling_price="1.7",
|
||||
special_selling_price="1.6",
|
||||
club=main_club,
|
||||
limit_age=18,
|
||||
)
|
||||
Product.objects.create(
|
||||
name="remboursement",
|
||||
code="REMBOURS",
|
||||
purchase_price="0",
|
||||
selling_price="0",
|
||||
special_selling_price="0",
|
||||
club=refound,
|
||||
)
|
||||
groups.subscribers.products.add(
|
||||
cotis, cotis2, refill, barb, cble, cors, carolus
|
||||
)
|
||||
groups.old_subscribers.products.add(cotis, cotis2)
|
||||
|
||||
mde = Counter.objects.get(name="MDE")
|
||||
mde.products.add(barb, cble, cons, dcons)
|
||||
|
||||
eboutic = Counter.objects.get(name="Eboutic")
|
||||
eboutic.products.add(barb, cotis, cotis2, refill)
|
||||
|
||||
Counter.objects.create(name="Carte AE", club=refound, type="OFFICE")
|
||||
|
||||
ReturnableProduct.objects.create(
|
||||
product=cons, returned_product=dcons, max_return=3
|
||||
)
|
||||
|
||||
# Add barman to counter
|
||||
Counter.sellers.through.objects.bulk_create(
|
||||
[
|
||||
Counter.sellers.through(counter_id=1, user=skia), # MDE
|
||||
Counter.sellers.through(counter_id=2, user=krophil), # Foyer
|
||||
Counter.sellers.through(counter_id=2, user=krophil),
|
||||
Counter.sellers.through(counter=mde, user=skia),
|
||||
]
|
||||
)
|
||||
|
||||
@@ -643,131 +746,6 @@ class Command(BaseCommand):
|
||||
]
|
||||
)
|
||||
|
||||
def _create_products(
|
||||
self, groups: PopulatedGroups, main_club: Club, refound_club: Club
|
||||
):
|
||||
beers_type, cotis_type, refill_type, verre_type = (
|
||||
ProductType.objects.bulk_create(
|
||||
[
|
||||
ProductType(name="Bières bouteilles"),
|
||||
ProductType(name="Cotisations"),
|
||||
ProductType(name="Rechargements"),
|
||||
ProductType(name="Verre"),
|
||||
]
|
||||
)
|
||||
)
|
||||
cotis = Product.objects.create(
|
||||
name="Cotis 1 semestre",
|
||||
code="1SCOTIZ",
|
||||
product_type=cotis_type,
|
||||
purchase_price=15,
|
||||
club=main_club,
|
||||
)
|
||||
cotis2 = Product.objects.create(
|
||||
name="Cotis 2 semestres",
|
||||
code="2SCOTIZ",
|
||||
product_type=cotis_type,
|
||||
purchase_price="28",
|
||||
club=main_club,
|
||||
)
|
||||
refill = Product.objects.create(
|
||||
name="Rechargement 15 €",
|
||||
code="15REFILL",
|
||||
product_type=refill_type,
|
||||
purchase_price=15,
|
||||
club=main_club,
|
||||
)
|
||||
barb = Product.objects.create(
|
||||
name="Barbar",
|
||||
code="BARB",
|
||||
product_type=beers_type,
|
||||
purchase_price="1.50",
|
||||
club=main_club,
|
||||
limit_age=18,
|
||||
)
|
||||
cble = Product.objects.create(
|
||||
name="Chimay Bleue",
|
||||
code="CBLE",
|
||||
product_type=beers_type,
|
||||
purchase_price="1.50",
|
||||
club=main_club,
|
||||
limit_age=18,
|
||||
)
|
||||
cons = Product.objects.create(
|
||||
name="Consigne Eco-cup",
|
||||
code="CONS",
|
||||
product_type=verre_type,
|
||||
purchase_price="1",
|
||||
club=main_club,
|
||||
)
|
||||
dcons = Product.objects.create(
|
||||
name="Déconsigne Eco-cup",
|
||||
code="DECO",
|
||||
product_type=verre_type,
|
||||
purchase_price="-1",
|
||||
club=main_club,
|
||||
)
|
||||
cors = Product.objects.create(
|
||||
name="Corsendonk",
|
||||
code="CORS",
|
||||
product_type=beers_type,
|
||||
purchase_price="1.50",
|
||||
club=main_club,
|
||||
limit_age=18,
|
||||
)
|
||||
carolus = Product.objects.create(
|
||||
name="Carolus",
|
||||
code="CARO",
|
||||
product_type=beers_type,
|
||||
purchase_price="1.50",
|
||||
club=main_club,
|
||||
limit_age=18,
|
||||
)
|
||||
Product.objects.create(
|
||||
name="remboursement",
|
||||
code="REMBOURS",
|
||||
purchase_price=0,
|
||||
club=refound_club,
|
||||
)
|
||||
ReturnableProduct.objects.create(
|
||||
product=cons, returned_product=dcons, max_return=3
|
||||
)
|
||||
mde = Counter.objects.get(name="MDE")
|
||||
mde.products.add(barb, cble, cons, dcons)
|
||||
eboutic = Counter.objects.get(name="Eboutic")
|
||||
eboutic.products.add(barb, cotis, cotis2, refill)
|
||||
|
||||
cotis, cotis2, refill, barb, cble, cors, carolus, cons, dcons = (
|
||||
Price.objects.bulk_create(
|
||||
[
|
||||
Price(product=cotis, amount=15),
|
||||
Price(product=cotis2, amount=28),
|
||||
Price(product=refill, amount=15),
|
||||
Price(product=barb, amount=1.7),
|
||||
Price(product=cble, amount=1.7),
|
||||
Price(product=cors, amount=1.7),
|
||||
Price(product=carolus, amount=1.7),
|
||||
Price(product=cons, amount=1),
|
||||
Price(product=dcons, amount=-1),
|
||||
]
|
||||
)
|
||||
)
|
||||
Price.groups.through.objects.bulk_create(
|
||||
[
|
||||
Price.groups.through(price=cotis, group=groups.subscribers),
|
||||
Price.groups.through(price=cotis2, group=groups.subscribers),
|
||||
Price.groups.through(price=refill, group=groups.subscribers),
|
||||
Price.groups.through(price=barb, group=groups.subscribers),
|
||||
Price.groups.through(price=cble, group=groups.subscribers),
|
||||
Price.groups.through(price=cors, group=groups.subscribers),
|
||||
Price.groups.through(price=carolus, group=groups.subscribers),
|
||||
Price.groups.through(price=cotis, group=groups.old_subscribers),
|
||||
Price.groups.through(price=cotis2, group=groups.old_subscribers),
|
||||
Price.groups.through(price=cons, group=groups.old_subscribers),
|
||||
Price.groups.through(price=dcons, group=groups.old_subscribers),
|
||||
]
|
||||
)
|
||||
|
||||
def _create_profile_pict(self, user: User):
|
||||
path = self.SAS_FIXTURE_PATH / "Family" / f"{user.username}.jpg"
|
||||
file = resize_image(Image.open(path), 400, "WEBP")
|
||||
|
||||
@@ -17,7 +17,6 @@ from counter.models import (
|
||||
Counter,
|
||||
Customer,
|
||||
Permanency,
|
||||
Price,
|
||||
Product,
|
||||
ProductType,
|
||||
Refilling,
|
||||
@@ -279,7 +278,6 @@ class Command(BaseCommand):
|
||||
# 2/3 of the products are owned by AE
|
||||
clubs = [ae, ae, ae, ae, ae, ae, *other_clubs]
|
||||
products = []
|
||||
prices = []
|
||||
buying_groups = []
|
||||
selling_places = []
|
||||
for _ in range(200):
|
||||
@@ -290,28 +288,25 @@ class Command(BaseCommand):
|
||||
product_type=random.choice(categories),
|
||||
code="".join(self.faker.random_letters(length=random.randint(4, 8))),
|
||||
purchase_price=price,
|
||||
selling_price=price,
|
||||
special_selling_price=price - min(0.5, price),
|
||||
club=random.choice(clubs),
|
||||
limit_age=0 if random.random() > 0.2 else 18,
|
||||
archived=self.faker.boolean(60),
|
||||
archived=bool(random.random() > 0.7),
|
||||
)
|
||||
products.append(product)
|
||||
for i in range(random.randint(0, 3)):
|
||||
product_price = Price(
|
||||
amount=price, product=product, is_always_shown=self.faker.boolean()
|
||||
)
|
||||
# prices for non-subscribers will be higher than for subscribers
|
||||
price *= 1.2
|
||||
prices.append(product_price)
|
||||
buying_groups.append(
|
||||
Price.groups.through(price=product_price, group=groups[i])
|
||||
# there will be products without buying groups
|
||||
# but there are also such products in the real database
|
||||
buying_groups.extend(
|
||||
Product.buying_groups.through(product=product, group=group)
|
||||
for group in random.sample(groups, k=random.randint(0, 3))
|
||||
)
|
||||
selling_places.extend(
|
||||
Counter.products.through(counter=counter, product=product)
|
||||
for counter in random.sample(counters, random.randint(0, 4))
|
||||
)
|
||||
Product.objects.bulk_create(products)
|
||||
Price.objects.bulk_create(prices)
|
||||
Price.groups.through.objects.bulk_create(buying_groups)
|
||||
Product.buying_groups.through.objects.bulk_create(buying_groups)
|
||||
Counter.products.through.objects.bulk_create(selling_places)
|
||||
|
||||
def create_sales(self, sellers: list[User]):
|
||||
@@ -325,7 +320,7 @@ class Command(BaseCommand):
|
||||
)
|
||||
)
|
||||
)
|
||||
prices = list(Price.objects.select_related("product").all())
|
||||
products = list(Product.objects.all())
|
||||
counters = list(
|
||||
Counter.objects.filter(name__in=["Foyer", "MDE", "La Gommette"])
|
||||
)
|
||||
@@ -335,14 +330,14 @@ class Command(BaseCommand):
|
||||
# the longer the customer has existed, the higher the mean of nb_products
|
||||
mu = 5 + (now().year - customer.since.year) * 2
|
||||
nb_sales = max(0, int(random.normalvariate(mu=mu, sigma=mu * 5)))
|
||||
favoured_prices = random.sample(prices, k=(random.randint(1, 5)))
|
||||
favoured_products = random.sample(products, k=(random.randint(1, 5)))
|
||||
favoured_counter = random.choice(counters)
|
||||
this_customer_sales = []
|
||||
for _ in range(nb_sales):
|
||||
price = (
|
||||
random.choice(favoured_prices)
|
||||
product = (
|
||||
random.choice(favoured_products)
|
||||
if random.random() > 0.7
|
||||
else random.choice(prices)
|
||||
else random.choice(products)
|
||||
)
|
||||
counter = (
|
||||
favoured_counter
|
||||
@@ -351,11 +346,11 @@ class Command(BaseCommand):
|
||||
)
|
||||
this_customer_sales.append(
|
||||
Selling(
|
||||
product=price.product,
|
||||
product=product,
|
||||
counter=counter,
|
||||
club_id=price.product.club_id,
|
||||
club_id=product.club_id,
|
||||
quantity=random.randint(1, 5),
|
||||
unit_price=price.amount,
|
||||
unit_price=product.selling_price,
|
||||
seller=random.choice(sellers),
|
||||
customer=customer,
|
||||
date=make_aware(
|
||||
|
||||
@@ -1,136 +1,18 @@
|
||||
import {
|
||||
type InheritedHtmlElement,
|
||||
inheritHtmlElement,
|
||||
registerComponent,
|
||||
} from "#core:utils/web-components.ts";
|
||||
|
||||
/**
|
||||
* ElementOnce web components
|
||||
*
|
||||
* Those elements ensures that their content is always included only once on a document
|
||||
* They are compatible with elements that are not managed with our Web Components
|
||||
**/
|
||||
export interface ElementOnce<K extends keyof HTMLElementTagNameMap>
|
||||
extends InheritedHtmlElement<K> {
|
||||
getElementQuerySelector(): string;
|
||||
refresh(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an abstract class for ElementOnce types Web Components
|
||||
**/
|
||||
export function elementOnce<K extends keyof HTMLElementTagNameMap>(tagName: K) {
|
||||
abstract class ElementOnceImpl
|
||||
extends inheritHtmlElement(tagName)
|
||||
implements ElementOnce<K>
|
||||
{
|
||||
abstract getElementQuerySelector(): string;
|
||||
|
||||
clearNode() {
|
||||
while (this.firstChild) {
|
||||
this.removeChild(this.lastChild);
|
||||
}
|
||||
}
|
||||
|
||||
refresh() {
|
||||
this.clearNode();
|
||||
if (document.querySelectorAll(this.getElementQuerySelector()).length === 0) {
|
||||
this.appendChild(this.node);
|
||||
}
|
||||
}
|
||||
|
||||
connectedCallback() {
|
||||
super.connectedCallback(false);
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
disconnectedCallback() {
|
||||
// The MutationObserver can't see web components being removed
|
||||
// It also can't see if something is removed inside after the component gets deleted
|
||||
// We need to manually clear the containing node to trigger the observer
|
||||
this.clearNode();
|
||||
}
|
||||
}
|
||||
return ElementOnceImpl;
|
||||
}
|
||||
|
||||
// Set of ElementOnce type components to refresh with the observer
|
||||
const registeredComponents: Set<string> = new Set();
|
||||
|
||||
/**
|
||||
* Helper to register ElementOnce types Web Components
|
||||
* It's a wrapper around registerComponent that registers that component on
|
||||
* a MutationObserver that activates a refresh on them when elements are removed
|
||||
*
|
||||
* You are not supposed to unregister an element
|
||||
**/
|
||||
export function registerElementOnce(name: string, options?: ElementDefinitionOptions) {
|
||||
registeredComponents.add(name);
|
||||
return registerComponent(name, options);
|
||||
}
|
||||
|
||||
// Refresh all ElementOnce components on the document based on the tag name of the removed element
|
||||
const refreshElement = <
|
||||
T extends keyof HTMLElementTagNameMap,
|
||||
K extends keyof HTMLElementTagNameMap,
|
||||
>(
|
||||
components: HTMLCollectionOf<ElementOnce<T>>,
|
||||
removedTagName: K,
|
||||
) => {
|
||||
for (const element of components) {
|
||||
// We can't guess if an element is compatible before we get one
|
||||
// We exit the function completely if it's not compatible
|
||||
if (element.inheritedTagName.toUpperCase() !== removedTagName.toUpperCase()) {
|
||||
return;
|
||||
}
|
||||
|
||||
element.refresh();
|
||||
}
|
||||
};
|
||||
|
||||
// Since we need to pause the observer, we make an helper to start it with consistent arguments
|
||||
const startObserver = (observer: MutationObserver) => {
|
||||
observer.observe(document, {
|
||||
// We want to also listen for elements contained in the header (eg: link)
|
||||
subtree: true,
|
||||
childList: true,
|
||||
});
|
||||
};
|
||||
|
||||
// Refresh ElementOnce components when changes happens
|
||||
const observer = new MutationObserver((mutations: MutationRecord[]) => {
|
||||
// To avoid infinite recursion, we need to pause the observer while manipulation nodes
|
||||
observer.disconnect();
|
||||
for (const mutation of mutations) {
|
||||
for (const node of mutation.removedNodes) {
|
||||
if (node.nodeType !== node.ELEMENT_NODE) {
|
||||
continue;
|
||||
}
|
||||
for (const registered of registeredComponents) {
|
||||
refreshElement(
|
||||
document.getElementsByTagName(registered) as HTMLCollectionOf<
|
||||
ElementOnce<"html"> // The specific tag doesn't really matter
|
||||
>,
|
||||
(node as HTMLElement).tagName as keyof HTMLElementTagNameMap,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
// We then resume the observer
|
||||
startObserver(observer);
|
||||
});
|
||||
|
||||
startObserver(observer);
|
||||
import { inheritHtmlElement, registerComponent } from "#core:utils/web-components.ts";
|
||||
|
||||
/**
|
||||
* Web component used to import css files only once
|
||||
* If called multiple times or the file was already imported, it does nothing
|
||||
**/
|
||||
@registerElementOnce("link-once")
|
||||
export class LinkOnce extends elementOnce("link") {
|
||||
getElementQuerySelector(): string {
|
||||
@registerComponent("link-once")
|
||||
export class LinkOnce extends inheritHtmlElement("link") {
|
||||
connectedCallback() {
|
||||
super.connectedCallback(false);
|
||||
// We get href from node.attributes instead of node.href to avoid getting the domain part
|
||||
return `link[href='${this.node.attributes.getNamedItem("href").nodeValue}']`;
|
||||
const href = this.node.attributes.getNamedItem("href").nodeValue;
|
||||
if (document.querySelectorAll(`link[href='${href}']`).length === 0) {
|
||||
this.appendChild(this.node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,10 +20,14 @@ export class LinkOnce extends elementOnce("link") {
|
||||
* Web component used to import javascript files only once
|
||||
* If called multiple times or the file was already imported, it does nothing
|
||||
**/
|
||||
@registerElementOnce("script-once")
|
||||
@registerComponent("script-once")
|
||||
export class ScriptOnce extends inheritHtmlElement("script") {
|
||||
getElementQuerySelector(): string {
|
||||
// We get href from node.attributes instead of node.src to avoid getting the domain part
|
||||
return `script[src='${this.node.attributes.getNamedItem("src").nodeValue}']`;
|
||||
connectedCallback() {
|
||||
super.connectedCallback(false);
|
||||
// We get src from node.attributes instead of node.src to avoid getting the domain part
|
||||
const src = this.node.attributes.getNamedItem("src").nodeValue;
|
||||
if (document.querySelectorAll(`script[src='${src}']`).length === 0) {
|
||||
this.appendChild(this.node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,17 +23,10 @@ export function registerComponent(name: string, options?: ElementDefinitionOptio
|
||||
* The technique is to:
|
||||
* create a new web component
|
||||
* create the desired type inside
|
||||
* move all attributes to the child component
|
||||
* pass all attributes to the child component
|
||||
* store is at as `node` inside the parent
|
||||
**/
|
||||
export interface InheritedHtmlElement<K extends keyof HTMLElementTagNameMap>
|
||||
extends HTMLElement {
|
||||
readonly inheritedTagName: K;
|
||||
node: HTMLElementTagNameMap[K];
|
||||
}
|
||||
|
||||
/**
|
||||
* Generator function that creates an InheritedHtmlElement compatible class
|
||||
*
|
||||
* Since we can't use the generic type to instantiate the node, we create a generator function
|
||||
*
|
||||
* ```js
|
||||
* class MyClass extends inheritHtmlElement("select") {
|
||||
@@ -42,15 +35,11 @@ export interface InheritedHtmlElement<K extends keyof HTMLElementTagNameMap>
|
||||
* ```
|
||||
**/
|
||||
export function inheritHtmlElement<K extends keyof HTMLElementTagNameMap>(tagName: K) {
|
||||
return class InheritedHtmlElementImpl
|
||||
extends HTMLElement
|
||||
implements InheritedHtmlElement<K>
|
||||
{
|
||||
readonly inheritedTagName = tagName;
|
||||
node: HTMLElementTagNameMap[K];
|
||||
return class Inherited extends HTMLElement {
|
||||
protected node: HTMLElementTagNameMap[K];
|
||||
|
||||
connectedCallback(autoAddNode?: boolean) {
|
||||
this.node = document.createElement(this.inheritedTagName);
|
||||
this.node = document.createElement(tagName);
|
||||
const attributes: Attr[] = []; // We need to make a copy to delete while iterating
|
||||
for (const attr of this.attributes) {
|
||||
if (attr.name in this.node) {
|
||||
@@ -58,10 +47,6 @@ export function inheritHtmlElement<K extends keyof HTMLElementTagNameMap>(tagNam
|
||||
}
|
||||
}
|
||||
|
||||
// We move compatible attributes to the child element
|
||||
// This avoids weird inconsistencies between attributes
|
||||
// when we manipulate the dom in the future
|
||||
// This is especially important when using attribute based reactivity
|
||||
for (const attr of attributes) {
|
||||
this.removeAttributeNode(attr);
|
||||
this.node.setAttributeNode(attr);
|
||||
|
||||
@@ -5,8 +5,9 @@
|
||||
<details name="navbar" class="menu">
|
||||
<summary class="head">{% trans %}Associations & Clubs{% endtrans %}</summary>
|
||||
<ul class="content">
|
||||
<li><a href="{{ url("core:page", page_name="ae") }}">{% trans %}AE{% endtrans %}</a></li>
|
||||
<li><a href="{{ url("club:club_list") }}">{% trans %}AE's clubs{% endtrans %}</a></li>
|
||||
<li><a href="{{ url('core:page', page_name='ae') }}">{% trans %}AE{% endtrans %}</a></li>
|
||||
<li><a href="{{ url('core:page', page_name='clubs') }}">{% trans %}AE's clubs{% endtrans %}</a></li>
|
||||
<li><a href="{{ url('core:page', page_name='utbm-associations') }}">{% trans %}Others UTBM's Associations{% endtrans %}</a></li>
|
||||
</ul>
|
||||
</details>
|
||||
<details name="navbar" class="menu">
|
||||
|
||||
@@ -129,10 +129,10 @@
|
||||
current_page (django.core.paginator.Page): the current page object
|
||||
paginator (django.core.paginator.Paginator): the paginator object
|
||||
#}
|
||||
{{ paginate_server_side(request, current_page, paginator, "") }}
|
||||
{{ paginate_server_side(request, current_page, paginator, False) }}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro paginate_htmx(request, current_page, paginator, htmx_target="#content") %}
|
||||
{% macro paginate_htmx(request, current_page, paginator) %}
|
||||
{# Add pagination buttons for pages without Alpine but supporting fragments.
|
||||
|
||||
This must be coupled with a view that handles pagination
|
||||
@@ -144,19 +144,18 @@
|
||||
request (django.http.request.HttpRequest): the current django request
|
||||
current_page (django.core.paginator.Page): the current page object
|
||||
paginator (django.core.paginator.Paginator): the paginator object
|
||||
htmx_target (string): htmx target selector (default '#content')
|
||||
#}
|
||||
{{ paginate_server_side(request, current_page, paginator, htmx_target) }}
|
||||
{{ paginate_server_side(request, current_page, paginator, True) }}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro paginate_server_side(request, current_page, paginator, htmx_target) %}
|
||||
{% macro paginate_server_side(request, current_page, paginator, use_htmx) %}
|
||||
<nav class="pagination">
|
||||
{% if current_page.has_previous() %}
|
||||
<a
|
||||
{% if htmx_target -%}
|
||||
{% if use_htmx -%}
|
||||
hx-get="?{{ querystring(request, page=current_page.previous_page_number()) }}"
|
||||
hx-swap="innerHTML"
|
||||
hx-target="{{ htmx_target }}"
|
||||
hx-target="#content"
|
||||
hx-push-url="true"
|
||||
hx-trigger="click, keyup[key=='ArrowLeft'] from:body"
|
||||
{%- else -%}
|
||||
@@ -177,10 +176,10 @@
|
||||
<strong>{{ paginator.ELLIPSIS }}</strong>
|
||||
{% else %}
|
||||
<a
|
||||
{% if htmx_target -%}
|
||||
{% if use_htmx -%}
|
||||
hx-get="?{{ querystring(request, page=i) }}"
|
||||
hx-swap="innerHTML"
|
||||
hx-target="{{ htmx_target }}"
|
||||
hx-target="#content"
|
||||
hx-push-url="true"
|
||||
{%- else -%}
|
||||
href="?{{ querystring(request, page=i) }}"
|
||||
@@ -192,10 +191,10 @@
|
||||
{% endfor %}
|
||||
{% if current_page.has_next() %}
|
||||
<a
|
||||
{% if htmx_target -%}
|
||||
{% if use_htmx -%}
|
||||
hx-get="?{{querystring(request, page=current_page.next_page_number())}}"
|
||||
hx-swap="innerHTML"
|
||||
hx-target="{{ htmx_target }}"
|
||||
hx-target="#content"
|
||||
hx-push-url="true"
|
||||
hx-trigger="click, keyup[key=='ArrowRight'] from:body"
|
||||
{%- else -%}
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{%- block additional_js -%}
|
||||
<script type="module" src="{{ static("bundled/core/components/ajax-select-index.ts") }}"></script>
|
||||
{%- endblock -%}
|
||||
|
||||
{%- block additional_css -%}
|
||||
<link rel="stylesheet" href="{{ static('user/user_preferences.scss') }}">
|
||||
{# importing ajax-select-index is necessary for it to be applied after HTMX reload #}
|
||||
<link rel="stylesheet" href="{{ static("bundled/core/components/ajax-select-index.css") }}">
|
||||
<link rel="stylesheet" href="{{ static("core/components/ajax-select.scss") }}">
|
||||
{%- endblock -%}
|
||||
|
||||
{% block title %}
|
||||
|
||||
@@ -213,9 +213,9 @@ def test_user_invoice_with_multiple_items():
|
||||
"""Test that annotate_total() works when invoices contain multiple items."""
|
||||
user: User = subscriber_user.make()
|
||||
item_recipe = Recipe(InvoiceItem, invoice=foreign_key(Recipe(Invoice, user=user)))
|
||||
item_recipe.make(_quantity=3, quantity=1, unit_price=5)
|
||||
item_recipe.make(_quantity=1, quantity=1, unit_price=5)
|
||||
item_recipe.make(_quantity=2, quantity=1, unit_price=iter([5, 8]))
|
||||
item_recipe.make(_quantity=3, quantity=1, product_unit_price=5)
|
||||
item_recipe.make(_quantity=1, quantity=1, product_unit_price=5)
|
||||
item_recipe.make(_quantity=2, quantity=1, product_unit_price=iter([5, 8]))
|
||||
res = list(
|
||||
Invoice.objects.filter(user=user)
|
||||
.annotate_total()
|
||||
|
||||
+1
-7
@@ -24,7 +24,6 @@ from counter.models import (
|
||||
Eticket,
|
||||
InvoiceCall,
|
||||
Permanency,
|
||||
Price,
|
||||
Product,
|
||||
ProductType,
|
||||
Refilling,
|
||||
@@ -33,24 +32,19 @@ from counter.models import (
|
||||
)
|
||||
|
||||
|
||||
class PriceInline(admin.TabularInline):
|
||||
model = Price
|
||||
autocomplete_fields = ("groups",)
|
||||
|
||||
|
||||
@admin.register(Product)
|
||||
class ProductAdmin(SearchModelAdmin):
|
||||
list_display = (
|
||||
"name",
|
||||
"code",
|
||||
"product_type",
|
||||
"selling_price",
|
||||
"archived",
|
||||
"created_at",
|
||||
"updated_at",
|
||||
)
|
||||
list_select_related = ("product_type",)
|
||||
search_fields = ("name", "code")
|
||||
inlines = [PriceInline]
|
||||
|
||||
|
||||
@admin.register(ReturnableProduct)
|
||||
|
||||
+6
-2
@@ -101,9 +101,13 @@ class ProductController(ControllerBase):
|
||||
"""Get the detailed information about the products."""
|
||||
return filters.filter(
|
||||
Product.objects.select_related("club")
|
||||
.prefetch_related("prices", "prices__groups")
|
||||
.prefetch_related("buying_groups")
|
||||
.select_related("product_type")
|
||||
.order_by(F("product_type__order").asc(nulls_last=True), "name")
|
||||
.order_by(
|
||||
F("product_type__order").asc(nulls_last=True),
|
||||
"product_type",
|
||||
"name",
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -2,11 +2,10 @@ from model_bakery.recipe import Recipe, foreign_key
|
||||
|
||||
from club.models import Club
|
||||
from core.models import User
|
||||
from counter.models import Counter, Price, Product, Refilling, Selling
|
||||
from counter.models import Counter, Product, Refilling, Selling
|
||||
|
||||
counter_recipe = Recipe(Counter)
|
||||
product_recipe = Recipe(Product, club=foreign_key(Recipe(Club)))
|
||||
price_recipe = Recipe(Price, product=foreign_key(product_recipe))
|
||||
sale_recipe = Recipe(
|
||||
Selling,
|
||||
product=foreign_key(product_recipe),
|
||||
|
||||
+62
-50
@@ -1,12 +1,12 @@
|
||||
import json
|
||||
import math
|
||||
import uuid
|
||||
from collections import defaultdict
|
||||
from datetime import date, datetime, timezone
|
||||
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from django import forms
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.core.validators import MaxValueValidator
|
||||
from django.db.models import Exists, OuterRef, Q
|
||||
from django.forms import BaseModelFormSet
|
||||
from django.utils.timezone import now
|
||||
@@ -37,7 +37,6 @@ from counter.models import (
|
||||
Customer,
|
||||
Eticket,
|
||||
InvoiceCall,
|
||||
Price,
|
||||
Product,
|
||||
ProductFormula,
|
||||
Refilling,
|
||||
@@ -375,21 +374,7 @@ ScheduledProductActionFormSet = forms.modelformset_factory(
|
||||
can_delete=True,
|
||||
can_delete_extra=False,
|
||||
extra=0,
|
||||
)
|
||||
|
||||
|
||||
ProductPriceFormSet = forms.inlineformset_factory(
|
||||
parent_model=Product,
|
||||
model=Price,
|
||||
fields=["amount", "label", "groups", "is_always_shown"],
|
||||
widgets={
|
||||
"groups": AutoCompleteSelectMultipleGroup,
|
||||
"is_always_shown": forms.CheckboxInput(attrs={"class": "switch"}),
|
||||
},
|
||||
absolute_max=None,
|
||||
can_delete_extra=False,
|
||||
min_num=1,
|
||||
extra=0,
|
||||
)
|
||||
|
||||
|
||||
@@ -404,7 +389,10 @@ class ProductForm(forms.ModelForm):
|
||||
"description",
|
||||
"product_type",
|
||||
"code",
|
||||
"buying_groups",
|
||||
"purchase_price",
|
||||
"selling_price",
|
||||
"special_selling_price",
|
||||
"icon",
|
||||
"club",
|
||||
"limit_age",
|
||||
@@ -419,8 +407,8 @@ class ProductForm(forms.ModelForm):
|
||||
}
|
||||
widgets = {
|
||||
"product_type": AutoCompleteSelect,
|
||||
"buying_groups": AutoCompleteSelectMultipleGroup,
|
||||
"club": AutoCompleteSelectClub,
|
||||
"tray": forms.CheckboxInput(attrs={"class": "switch"}),
|
||||
}
|
||||
|
||||
counters = forms.ModelMultipleChoiceField(
|
||||
@@ -430,40 +418,50 @@ class ProductForm(forms.ModelForm):
|
||||
queryset=Counter.objects.all(),
|
||||
)
|
||||
|
||||
def __init__(self, *args, prefix: str | None = None, instance=None, **kwargs):
|
||||
super().__init__(*args, prefix=prefix, instance=instance, **kwargs)
|
||||
self.fields["name"].widget.attrs["autofocus"] = "autofocus"
|
||||
def __init__(self, *args, instance=None, **kwargs):
|
||||
super().__init__(*args, instance=instance, **kwargs)
|
||||
if self.instance.id:
|
||||
self.fields["counters"].initial = self.instance.counters.all()
|
||||
if hasattr(self.instance, "formula"):
|
||||
self.formula_init(self.instance.formula)
|
||||
self.price_formset = ProductPriceFormSet(
|
||||
*args, instance=self.instance, prefix="price", **kwargs
|
||||
)
|
||||
self.action_formset = ScheduledProductActionFormSet(
|
||||
*args, product=self.instance, prefix="action", **kwargs
|
||||
*args, product=self.instance, **kwargs
|
||||
)
|
||||
|
||||
def formula_init(self, formula: ProductFormula):
|
||||
"""Part of the form initialisation specific to formula products."""
|
||||
self.fields["selling_price"].help_text = _(
|
||||
"This product is a formula. "
|
||||
"Its price cannot be greater than the price "
|
||||
"of the products constituting it, which is %(price)s €"
|
||||
) % {"price": formula.max_selling_price}
|
||||
self.fields["special_selling_price"].help_text = _(
|
||||
"This product is a formula. "
|
||||
"Its special price cannot be greater than the price "
|
||||
"of the products constituting it, which is %(price)s €"
|
||||
) % {"price": formula.max_special_selling_price}
|
||||
for key, price in (
|
||||
("selling_price", formula.max_selling_price),
|
||||
("special_selling_price", formula.max_special_selling_price),
|
||||
):
|
||||
self.fields[key].widget.attrs["max"] = price
|
||||
self.fields[key].validators.append(MaxValueValidator(price))
|
||||
|
||||
def is_valid(self):
|
||||
return (
|
||||
super().is_valid()
|
||||
and self.price_formset.is_valid()
|
||||
and self.action_formset.is_valid()
|
||||
)
|
||||
return super().is_valid() and self.action_formset.is_valid()
|
||||
|
||||
def save(self, *args, **kwargs) -> Product:
|
||||
product = super().save(*args, **kwargs)
|
||||
product.counters.set(self.cleaned_data["counters"])
|
||||
for form in self.action_formset:
|
||||
# if it's a creation, the product given in the formset
|
||||
# wasn't a persisted instance.
|
||||
# So if we tried to persist the related objects in the current state,
|
||||
# So if we tried to persist the scheduled actions in the current state,
|
||||
# they would be linked to no product, thus be completely useless
|
||||
# To make it work, we have to replace
|
||||
# the initial product with a persisted one
|
||||
for form in self.action_formset:
|
||||
form.set_product(product)
|
||||
self.action_formset.save()
|
||||
self.price_formset.save()
|
||||
return product
|
||||
|
||||
|
||||
@@ -486,6 +484,18 @@ class ProductFormulaForm(forms.ModelForm):
|
||||
"the result and a part of the formula."
|
||||
),
|
||||
)
|
||||
prices = [p.selling_price for p in cleaned_data["products"]]
|
||||
special_prices = [p.special_selling_price for p in cleaned_data["products"]]
|
||||
selling_price = cleaned_data["result"].selling_price
|
||||
special_selling_price = cleaned_data["result"].special_selling_price
|
||||
if selling_price > sum(prices) or special_selling_price > sum(special_prices):
|
||||
self.add_error(
|
||||
"result",
|
||||
_(
|
||||
"The result cannot be more expensive "
|
||||
"than the total of the other products."
|
||||
),
|
||||
)
|
||||
return cleaned_data
|
||||
|
||||
|
||||
@@ -536,47 +546,48 @@ class CloseCustomerAccountForm(forms.Form):
|
||||
)
|
||||
|
||||
|
||||
class BasketItemForm(forms.Form):
|
||||
class BasketProductForm(forms.Form):
|
||||
quantity = forms.IntegerField(min_value=1, required=True)
|
||||
price_id = forms.IntegerField(min_value=0, required=True)
|
||||
id = forms.IntegerField(min_value=0, required=True)
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
customer: Customer,
|
||||
counter: Counter,
|
||||
allowed_prices: dict[int, Price],
|
||||
allowed_products: dict[int, Product],
|
||||
*args,
|
||||
**kwargs,
|
||||
):
|
||||
self.customer = customer # Used by formset
|
||||
self.counter = counter # Used by formset
|
||||
self.allowed_prices = allowed_prices
|
||||
self.allowed_products = allowed_products
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
def clean_price_id(self):
|
||||
data = self.cleaned_data["price_id"]
|
||||
def clean_id(self):
|
||||
data = self.cleaned_data["id"]
|
||||
|
||||
# We store self.price so we can use it later on the formset validation
|
||||
# We store self.product so we can use it later on the formset validation
|
||||
# And also in the global clean
|
||||
self.price = self.allowed_prices.get(data, None)
|
||||
if self.price is None:
|
||||
self.product = self.allowed_products.get(data, None)
|
||||
if self.product is None:
|
||||
raise forms.ValidationError(
|
||||
_("The selected product isn't available for this user")
|
||||
)
|
||||
|
||||
return data
|
||||
|
||||
def clean(self):
|
||||
cleaned_data = super().clean()
|
||||
if len(self.errors) > 0:
|
||||
return cleaned_data
|
||||
return
|
||||
|
||||
# Compute prices
|
||||
cleaned_data["bonus_quantity"] = 0
|
||||
if self.price.product.tray:
|
||||
if self.product.tray:
|
||||
cleaned_data["bonus_quantity"] = math.floor(
|
||||
cleaned_data["quantity"] / Product.QUANTITY_FOR_TRAY_PRICE
|
||||
)
|
||||
cleaned_data["total_price"] = self.price.amount * (
|
||||
cleaned_data["total_price"] = self.product.price * (
|
||||
cleaned_data["quantity"] - cleaned_data["bonus_quantity"]
|
||||
)
|
||||
|
||||
@@ -600,8 +611,8 @@ class BaseBasketForm(forms.BaseFormSet):
|
||||
raise forms.ValidationError(_("Submitted basket is invalid"))
|
||||
|
||||
def _check_product_are_unique(self):
|
||||
price_ids = {form.cleaned_data["price_id"] for form in self.forms}
|
||||
if len(price_ids) != len(self.forms):
|
||||
product_ids = {form.cleaned_data["id"] for form in self.forms}
|
||||
if len(product_ids) != len(self.forms):
|
||||
raise forms.ValidationError(_("Duplicated product entries."))
|
||||
|
||||
def _check_enough_money(self, counter: Counter, customer: Customer):
|
||||
@@ -611,9 +622,10 @@ class BaseBasketForm(forms.BaseFormSet):
|
||||
|
||||
def _check_recorded_products(self, customer: Customer):
|
||||
"""Check for, among other things, ecocups and pitchers"""
|
||||
items = defaultdict(int)
|
||||
for form in self.forms:
|
||||
items[form.price.product_id] += form.cleaned_data["quantity"]
|
||||
items = {
|
||||
form.cleaned_data["id"]: form.cleaned_data["quantity"]
|
||||
for form in self.forms
|
||||
}
|
||||
ids = list(items.keys())
|
||||
returnables = list(
|
||||
ReturnableProduct.objects.filter(
|
||||
@@ -639,7 +651,7 @@ class BaseBasketForm(forms.BaseFormSet):
|
||||
|
||||
|
||||
BasketForm = forms.formset_factory(
|
||||
BasketItemForm, formset=BaseBasketForm, absolute_max=None, min_num=1
|
||||
BasketProductForm, formset=BaseBasketForm, absolute_max=None, min_num=1
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -1,149 +0,0 @@
|
||||
# Generated by Django 5.2.11 on 2026-02-18 13:30
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
from django.db.migrations.state import StateApps
|
||||
|
||||
import counter.fields
|
||||
|
||||
|
||||
def migrate_prices(apps: StateApps, schema_editor):
|
||||
Product = apps.get_model("counter", "Product")
|
||||
Price = apps.get_model("counter", "Price")
|
||||
prices = [
|
||||
Price(
|
||||
amount=p.selling_price,
|
||||
product=p,
|
||||
created_at=p.created_at,
|
||||
updated_at=p.updated_at,
|
||||
)
|
||||
for p in Product.objects.all()
|
||||
]
|
||||
Price.objects.bulk_create(prices)
|
||||
groups = [
|
||||
Price.groups.through(price=price, group=group)
|
||||
for price in Price.objects.select_related("product").prefetch_related(
|
||||
"product__buying_groups"
|
||||
)
|
||||
for group in price.product.buying_groups.all()
|
||||
]
|
||||
Price.groups.through.objects.bulk_create(groups)
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("core", "0048_alter_user_options"),
|
||||
("counter", "0038_countersellers"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name="Price",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.AutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
(
|
||||
"amount",
|
||||
counter.fields.CurrencyField(
|
||||
decimal_places=2, max_digits=12, verbose_name="amount"
|
||||
),
|
||||
),
|
||||
(
|
||||
"is_always_shown",
|
||||
models.BooleanField(
|
||||
default=False,
|
||||
help_text=(
|
||||
"If this option is enabled, "
|
||||
"people will see this price and be able to pay it, "
|
||||
"even if another cheaper price exists. "
|
||||
"Else it will visible only if it is the cheapest available price."
|
||||
),
|
||||
verbose_name="always show",
|
||||
),
|
||||
),
|
||||
(
|
||||
"label",
|
||||
models.CharField(
|
||||
default="",
|
||||
help_text=(
|
||||
"A short label for easier differentiation "
|
||||
"if a user can see multiple prices."
|
||||
),
|
||||
max_length=32,
|
||||
verbose_name="label",
|
||||
blank=True,
|
||||
),
|
||||
),
|
||||
(
|
||||
"created_at",
|
||||
models.DateTimeField(auto_now_add=True, verbose_name="created at"),
|
||||
),
|
||||
(
|
||||
"updated_at",
|
||||
models.DateTimeField(auto_now=True, verbose_name="updated at"),
|
||||
),
|
||||
(
|
||||
"groups",
|
||||
models.ManyToManyField(
|
||||
related_name="prices", to="core.group", verbose_name="groups"
|
||||
),
|
||||
),
|
||||
(
|
||||
"product",
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="prices",
|
||||
to="counter.product",
|
||||
verbose_name="product",
|
||||
),
|
||||
),
|
||||
],
|
||||
options={"verbose_name": "price"},
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="product",
|
||||
name="tray",
|
||||
field=models.BooleanField(
|
||||
default=False,
|
||||
help_text="Buy five, get the sixth free",
|
||||
verbose_name="tray price",
|
||||
),
|
||||
),
|
||||
migrations.RunPython(migrate_prices, reverse_code=migrations.RunPython.noop),
|
||||
migrations.RemoveField(model_name="product", name="selling_price"),
|
||||
migrations.RemoveField(model_name="product", name="special_selling_price"),
|
||||
migrations.AlterField(
|
||||
model_name="product",
|
||||
name="description",
|
||||
field=models.TextField(blank=True, default="", verbose_name="description"),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="product",
|
||||
name="product_type",
|
||||
field=models.ForeignKey(
|
||||
null=True,
|
||||
on_delete=django.db.models.deletion.SET_NULL,
|
||||
related_name="products",
|
||||
to="counter.producttype",
|
||||
verbose_name="product type",
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="productformula",
|
||||
name="result",
|
||||
field=models.OneToOneField(
|
||||
help_text="The product got with the formula.",
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="formula",
|
||||
to="counter.product",
|
||||
verbose_name="result product",
|
||||
),
|
||||
),
|
||||
]
|
||||
+87
-91
@@ -22,7 +22,7 @@ import string
|
||||
from datetime import date, datetime, timedelta
|
||||
from datetime import timezone as tz
|
||||
from decimal import Decimal
|
||||
from typing import TYPE_CHECKING, Literal, Self
|
||||
from typing import Literal, Self
|
||||
|
||||
from dict2xml import dict2xml
|
||||
from django.conf import settings
|
||||
@@ -47,9 +47,6 @@ from core.utils import get_start_of_semester
|
||||
from counter.fields import CurrencyField
|
||||
from subscription.models import Subscription
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from collections.abc import Sequence
|
||||
|
||||
|
||||
def get_eboutic() -> Counter:
|
||||
return Counter.objects.filter(type="EBOUTIC").order_by("id").first()
|
||||
@@ -160,7 +157,14 @@ class Customer(models.Model):
|
||||
|
||||
@property
|
||||
def can_buy(self) -> bool:
|
||||
"""Check if whether this customer has the right to purchase any item."""
|
||||
"""Check if whether this customer has the right to purchase any item.
|
||||
|
||||
This must be not confused with the Product.can_be_sold_to(user)
|
||||
method as the present method returns an information
|
||||
about a customer whereas the other tells something
|
||||
about the relation between a User (not a Customer,
|
||||
don't mix them) and a Product.
|
||||
"""
|
||||
subscription = self.user.subscriptions.order_by("subscription_end").last()
|
||||
if subscription is None:
|
||||
return False
|
||||
@@ -359,13 +363,13 @@ class Product(models.Model):
|
||||
QUANTITY_FOR_TRAY_PRICE = 6
|
||||
|
||||
name = models.CharField(_("name"), max_length=64)
|
||||
description = models.TextField(_("description"), blank=True, default="")
|
||||
description = models.TextField(_("description"), default="")
|
||||
product_type = models.ForeignKey(
|
||||
ProductType,
|
||||
related_name="products",
|
||||
verbose_name=_("product type"),
|
||||
null=True,
|
||||
blank=False,
|
||||
blank=True,
|
||||
on_delete=models.SET_NULL,
|
||||
)
|
||||
code = models.CharField(_("code"), max_length=16, blank=True)
|
||||
@@ -373,6 +377,11 @@ class Product(models.Model):
|
||||
_("purchase price"),
|
||||
help_text=_("Initial cost of purchasing the product"),
|
||||
)
|
||||
selling_price = CurrencyField(_("selling price"))
|
||||
special_selling_price = CurrencyField(
|
||||
_("special selling price"),
|
||||
help_text=_("Price for barmen during their permanence"),
|
||||
)
|
||||
icon = ResizedImageField(
|
||||
height=70,
|
||||
force_format="WEBP",
|
||||
@@ -385,9 +394,7 @@ class Product(models.Model):
|
||||
Club, related_name="products", verbose_name=_("club"), on_delete=models.CASCADE
|
||||
)
|
||||
limit_age = models.IntegerField(_("limit age"), default=0)
|
||||
tray = models.BooleanField(
|
||||
_("tray price"), help_text=_("Buy five, get the sixth free"), default=False
|
||||
)
|
||||
tray = models.BooleanField(_("tray price"), default=False)
|
||||
buying_groups = models.ManyToManyField(
|
||||
Group, related_name="products", verbose_name=_("buying groups"), blank=True
|
||||
)
|
||||
@@ -412,77 +419,41 @@ class Product(models.Model):
|
||||
pk=settings.SITH_GROUP_ACCOUNTING_ADMIN_ID
|
||||
) or user.is_in_group(pk=settings.SITH_GROUP_COUNTER_ADMIN_ID)
|
||||
|
||||
def can_be_sold_to(self, user: User) -> bool:
|
||||
"""Check if whether the user given in parameter has the right to buy
|
||||
this product or not.
|
||||
|
||||
class PriceQuerySet(models.QuerySet):
|
||||
def for_user(self, user: User) -> Self:
|
||||
age = user.age
|
||||
if user.is_banned_alcohol:
|
||||
age = min(age, 17)
|
||||
return self.filter(
|
||||
Q(is_always_shown=True, groups__in=user.all_groups)
|
||||
| Q(
|
||||
id=Subquery(
|
||||
Price.objects.filter(
|
||||
product_id=OuterRef("product_id"), groups__in=user.all_groups
|
||||
)
|
||||
.order_by("amount")
|
||||
.values("id")[:1]
|
||||
)
|
||||
),
|
||||
product__archived=False,
|
||||
product__limit_age__lte=age,
|
||||
)
|
||||
This must be not confused with the Customer.can_buy()
|
||||
method as the present method returns an information
|
||||
about the relation between a User and a Product,
|
||||
whereas the other tells something about a Customer
|
||||
(and not a user, they are not the same model).
|
||||
|
||||
Returns:
|
||||
True if the user can buy this product else False
|
||||
|
||||
class Price(models.Model):
|
||||
amount = CurrencyField(_("amount"))
|
||||
product = models.ForeignKey(
|
||||
Product,
|
||||
verbose_name=_("product"),
|
||||
related_name="prices",
|
||||
on_delete=models.CASCADE,
|
||||
)
|
||||
groups = models.ManyToManyField(
|
||||
Group, verbose_name=_("groups"), related_name="prices"
|
||||
)
|
||||
is_always_shown = models.BooleanField(
|
||||
_("always show"),
|
||||
help_text=_(
|
||||
"If this option is enabled, "
|
||||
"people will see this price and be able to pay it, "
|
||||
"even if another cheaper price exists. "
|
||||
"Else it will visible only if it is the cheapest available price."
|
||||
),
|
||||
default=False,
|
||||
)
|
||||
label = models.CharField(
|
||||
_("label"),
|
||||
help_text=_(
|
||||
"A short label for easier differentiation "
|
||||
"if a user can see multiple prices."
|
||||
),
|
||||
max_length=32,
|
||||
default="",
|
||||
blank=True,
|
||||
)
|
||||
created_at = models.DateTimeField(_("created at"), auto_now_add=True)
|
||||
updated_at = models.DateTimeField(_("updated at"), auto_now=True)
|
||||
Warning:
|
||||
This performs a db query, thus you can quickly have
|
||||
a N+1 queries problem if you call it in a loop.
|
||||
Hopefully, you can avoid that if you prefetch the buying_groups :
|
||||
|
||||
objects = PriceQuerySet.as_manager()
|
||||
|
||||
class Meta:
|
||||
verbose_name = _("price")
|
||||
|
||||
def __str__(self):
|
||||
if not self.label:
|
||||
return f"{self.product.name} ({self.amount}€)"
|
||||
return f"{self.product.name} {self.label} ({self.amount}€)"
|
||||
```python
|
||||
user = User.objects.get(username="foobar")
|
||||
products = [
|
||||
p
|
||||
for p in Product.objects.prefetch_related("buying_groups")
|
||||
if p.can_be_sold_to(user)
|
||||
]
|
||||
```
|
||||
"""
|
||||
buying_groups = list(self.buying_groups.all())
|
||||
if not buying_groups:
|
||||
return True
|
||||
return any(user.is_in_group(pk=group.id) for group in buying_groups)
|
||||
|
||||
@property
|
||||
def full_label(self):
|
||||
if not self.label:
|
||||
return self.product.name
|
||||
return f"{self.product.name} \u2013 {self.label}"
|
||||
def profit(self):
|
||||
return self.selling_price - self.purchase_price
|
||||
|
||||
|
||||
class ProductFormula(models.Model):
|
||||
@@ -503,6 +474,18 @@ class ProductFormula(models.Model):
|
||||
def __str__(self):
|
||||
return self.result.name
|
||||
|
||||
@cached_property
|
||||
def max_selling_price(self) -> float:
|
||||
# iterating over all products is less efficient than doing
|
||||
# a simple aggregation, but this method is likely to be used in
|
||||
# coordination with `max_special_selling_price`,
|
||||
# and Django caches the result of the `all` queryset.
|
||||
return sum(p.selling_price for p in self.products.all())
|
||||
|
||||
@cached_property
|
||||
def max_special_selling_price(self) -> float:
|
||||
return sum(p.special_selling_price for p in self.products.all())
|
||||
|
||||
|
||||
class CounterQuerySet(models.QuerySet):
|
||||
def annotate_has_barman(self, user: User) -> Self:
|
||||
@@ -733,20 +716,35 @@ class Counter(models.Model):
|
||||
# but they share the same primary key
|
||||
return self.type == "BAR" and any(b.pk == customer.pk for b in self.barmen_list)
|
||||
|
||||
def get_prices_for(
|
||||
self, customer: Customer, *, order_by: Sequence[str] | None = None
|
||||
) -> list[Price]:
|
||||
qs = (
|
||||
Price.objects.filter(
|
||||
product__counters=self, product__product_type__isnull=False
|
||||
def get_products_for(self, customer: Customer) -> list[Product]:
|
||||
"""
|
||||
Get all allowed products for the provided customer on this counter
|
||||
Prices will be annotated
|
||||
"""
|
||||
|
||||
products = (
|
||||
self.products.filter(archived=False)
|
||||
.select_related("product_type")
|
||||
.prefetch_related("buying_groups")
|
||||
)
|
||||
.for_user(customer.user)
|
||||
.select_related("product", "product__product_type")
|
||||
.prefetch_related("groups")
|
||||
)
|
||||
if order_by:
|
||||
qs = qs.order_by(*order_by)
|
||||
return list(qs)
|
||||
|
||||
# Only include age appropriate products
|
||||
age = customer.user.age
|
||||
if customer.user.is_banned_alcohol:
|
||||
age = min(age, 17)
|
||||
products = products.filter(limit_age__lte=age)
|
||||
|
||||
# Compute special price for customer if he is a barmen on that bar
|
||||
if self.customer_is_barman(customer):
|
||||
products = products.annotate(price=F("special_selling_price"))
|
||||
else:
|
||||
products = products.annotate(price=F("selling_price"))
|
||||
|
||||
return [
|
||||
product
|
||||
for product in products.all()
|
||||
if product.can_be_sold_to(customer.user)
|
||||
]
|
||||
|
||||
|
||||
class CounterSellers(models.Model):
|
||||
@@ -1027,9 +1025,7 @@ class Selling(models.Model):
|
||||
event = self.product.eticket.event_title or _("Unknown event")
|
||||
subject = _("Eticket bought for the event %(event)s") % {"event": event}
|
||||
message_html = _(
|
||||
"You bought an eticket for the event %(event)s.\n"
|
||||
"You can download it directly from this link %(eticket)s.\n"
|
||||
"You can also retrieve all your e-tickets on your account page %(url)s."
|
||||
"You bought an eticket for the event %(event)s.\nYou can download it directly from this link %(eticket)s.\nYou can also retrieve all your e-tickets on your account page %(url)s."
|
||||
) % {
|
||||
"event": event,
|
||||
"url": (
|
||||
|
||||
+4
-9
@@ -6,8 +6,8 @@ from ninja import FilterLookup, FilterSchema, ModelSchema, Schema
|
||||
from pydantic import model_validator
|
||||
|
||||
from club.schemas import SimpleClubSchema
|
||||
from core.schemas import NonEmptyStr, SimpleUserSchema
|
||||
from counter.models import Counter, Price, Product, ProductType
|
||||
from core.schemas import GroupSchema, NonEmptyStr, SimpleUserSchema
|
||||
from counter.models import Counter, Product, ProductType
|
||||
|
||||
|
||||
class CounterSchema(ModelSchema):
|
||||
@@ -66,12 +66,6 @@ class SimpleProductSchema(ModelSchema):
|
||||
fields = ["id", "name", "code"]
|
||||
|
||||
|
||||
class ProductPriceSchema(ModelSchema):
|
||||
class Meta:
|
||||
model = Price
|
||||
fields = ["amount", "groups"]
|
||||
|
||||
|
||||
class ProductSchema(ModelSchema):
|
||||
class Meta:
|
||||
model = Product
|
||||
@@ -81,12 +75,13 @@ class ProductSchema(ModelSchema):
|
||||
"code",
|
||||
"description",
|
||||
"purchase_price",
|
||||
"selling_price",
|
||||
"icon",
|
||||
"limit_age",
|
||||
"archived",
|
||||
]
|
||||
|
||||
prices: list[ProductPriceSchema]
|
||||
buying_groups: list[GroupSchema]
|
||||
club: SimpleClubSchema
|
||||
product_type: SimpleProductTypeSchema | None
|
||||
url: str
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import type { CounterItem } from "#counter:counter/types";
|
||||
import type { Product } from "#counter:counter/types.ts";
|
||||
|
||||
export class BasketItem {
|
||||
quantity: number;
|
||||
product: CounterItem;
|
||||
product: Product;
|
||||
quantityForTrayPrice: number;
|
||||
errors: string[];
|
||||
|
||||
constructor(product: CounterItem, quantity: number) {
|
||||
constructor(product: Product, quantity: number) {
|
||||
this.quantity = quantity;
|
||||
this.product = product;
|
||||
this.errors = [];
|
||||
@@ -19,6 +20,6 @@ export class BasketItem {
|
||||
}
|
||||
|
||||
sum(): number {
|
||||
return (this.quantity - this.getBonusQuantity()) * this.product.price.amount;
|
||||
return (this.quantity - this.getBonusQuantity()) * this.product.price;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import { AlertMessage } from "#core:utils/alert-message";
|
||||
import { BasketItem } from "#counter:counter/basket";
|
||||
import { AlertMessage } from "#core:utils/alert-message.ts";
|
||||
import { BasketItem } from "#counter:counter/basket.ts";
|
||||
import type {
|
||||
CounterConfig,
|
||||
CounterItem,
|
||||
ErrorMessage,
|
||||
ProductFormula,
|
||||
} from "#counter:counter/types";
|
||||
import type { CounterProductSelect } from "./components/counter-product-select-index";
|
||||
} from "#counter:counter/types.ts";
|
||||
import type { CounterProductSelect } from "./components/counter-product-select-index.ts";
|
||||
|
||||
document.addEventListener("alpine:init", () => {
|
||||
Alpine.data("counter", (config: CounterConfig) => ({
|
||||
@@ -64,10 +63,8 @@ document.addEventListener("alpine:init", () => {
|
||||
},
|
||||
|
||||
checkFormulas() {
|
||||
// Try to find a formula.
|
||||
// A formula is found if all its elements are already in the basket
|
||||
const products = new Set(
|
||||
Object.values(this.basket).map((item: BasketItem) => item.product.productId),
|
||||
Object.keys(this.basket).map((i: string) => Number.parseInt(i, 10)),
|
||||
);
|
||||
const formula: ProductFormula = config.formulas.find((f: ProductFormula) => {
|
||||
return f.products.every((p: number) => products.has(p));
|
||||
@@ -75,29 +72,22 @@ document.addEventListener("alpine:init", () => {
|
||||
if (formula === undefined) {
|
||||
return;
|
||||
}
|
||||
// Now that the formula is found, remove the items composing it from the basket
|
||||
for (const product of formula.products) {
|
||||
const key = Object.entries(this.basket).find(
|
||||
([_, i]: [string, BasketItem]) => i.product.productId === product,
|
||||
)[0];
|
||||
const key = product.toString();
|
||||
this.basket[key].quantity -= 1;
|
||||
if (this.basket[key].quantity <= 0) {
|
||||
this.removeFromBasket(key);
|
||||
}
|
||||
}
|
||||
// Then add the result product of the formula to the basket
|
||||
const result = Object.values(config.products)
|
||||
.filter((item: CounterItem) => item.productId === formula.result)
|
||||
.reduce((acc, curr) => (acc.price.amount < curr.price.amount ? acc : curr));
|
||||
this.addToBasket(result.price.id, 1);
|
||||
this.alertMessage.display(
|
||||
interpolate(
|
||||
gettext("Formula %(formula)s applied"),
|
||||
{ formula: result.name },
|
||||
{ formula: config.products[formula.result.toString()].name },
|
||||
true,
|
||||
),
|
||||
{ success: true },
|
||||
);
|
||||
this.addToBasket(formula.result.toString(), 1);
|
||||
},
|
||||
|
||||
getBasketSize() {
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
import { showSaveFilePicker } from "native-file-system-adapter";
|
||||
import type TomSelect from "tom-select";
|
||||
import { paginated } from "#core:utils/api";
|
||||
import { csv } from "#core:utils/csv";
|
||||
import { getCurrentUrlParams, History, updateQueryString } from "#core:utils/history";
|
||||
import type { NestedKeyOf } from "#core:utils/types";
|
||||
import { paginated } from "#core:utils/api.ts";
|
||||
import { csv } from "#core:utils/csv.ts";
|
||||
import {
|
||||
getCurrentUrlParams,
|
||||
History,
|
||||
updateQueryString,
|
||||
} from "#core:utils/history.ts";
|
||||
import type { NestedKeyOf } from "#core:utils/types.ts";
|
||||
import {
|
||||
type ProductSchema,
|
||||
type ProductSearchProductsDetailedData,
|
||||
@@ -16,9 +20,6 @@ type GroupedProducts = Record<ProductType, ProductSchema[]>;
|
||||
const defaultPageSize = 100;
|
||||
const defaultPage = 1;
|
||||
|
||||
// biome-ignore lint/style/useNamingConvention: api is snake case
|
||||
type ProductWithPriceSchema = ProductSchema & { selling_price: string };
|
||||
|
||||
/**
|
||||
* Keys of the properties to include in the CSV.
|
||||
*/
|
||||
@@ -33,7 +34,7 @@ const csvColumns = [
|
||||
"purchase_price",
|
||||
"selling_price",
|
||||
"archived",
|
||||
] as NestedKeyOf<ProductWithPriceSchema>[];
|
||||
] as NestedKeyOf<ProductSchema>[];
|
||||
|
||||
/**
|
||||
* Title of the csv columns.
|
||||
@@ -174,16 +175,7 @@ document.addEventListener("alpine:init", () => {
|
||||
this.nbPages > 1
|
||||
? await paginated(productSearchProductsDetailed, this.getQueryParams())
|
||||
: Object.values<ProductSchema[]>(this.products).flat();
|
||||
// CSV cannot represent nested data
|
||||
// so we create a row for each price of each product.
|
||||
const productsWithPrice: ProductWithPriceSchema[] = products.flatMap(
|
||||
(product: ProductSchema) =>
|
||||
product.prices.map((price) =>
|
||||
// biome-ignore lint/style/useNamingConvention: API is snake_case
|
||||
Object.assign(product, { selling_price: price.amount }),
|
||||
),
|
||||
);
|
||||
const content = csv.stringify(productsWithPrice, {
|
||||
const content = csv.stringify(products, {
|
||||
columns: csvColumns,
|
||||
titleRow: csvColumnTitles,
|
||||
});
|
||||
|
||||
+5
-10
@@ -2,7 +2,7 @@ export type ErrorMessage = string;
|
||||
|
||||
export interface InitialFormData {
|
||||
/* Used to refill the form when the backend raises an error */
|
||||
id?: keyof Record<string, CounterItem>;
|
||||
id?: keyof Record<string, Product>;
|
||||
quantity?: number;
|
||||
errors?: string[];
|
||||
}
|
||||
@@ -15,22 +15,17 @@ export interface ProductFormula {
|
||||
export interface CounterConfig {
|
||||
customerBalance: number;
|
||||
customerId: number;
|
||||
products: Record<string, CounterItem>;
|
||||
products: Record<string, Product>;
|
||||
formulas: ProductFormula[];
|
||||
formInitial: InitialFormData[];
|
||||
cancelUrl: string;
|
||||
}
|
||||
|
||||
interface Price {
|
||||
id: number;
|
||||
amount: number;
|
||||
}
|
||||
|
||||
export interface CounterItem {
|
||||
productId: number;
|
||||
price: Price;
|
||||
export interface Product {
|
||||
id: string;
|
||||
code: string;
|
||||
name: string;
|
||||
price: number;
|
||||
hasTrayPrice: boolean;
|
||||
quantityForTrayPrice: number;
|
||||
}
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block additional_css %}
|
||||
<link rel="stylesheet" href="{{ static('counter/css/counter-click.scss') }}">
|
||||
<link rel="stylesheet" href="{{ static('bundled/core/components/ajax-select-index.css') }}">
|
||||
<link rel="stylesheet" href="{{ static('core/components/ajax-select.scss') }}">
|
||||
<link rel="stylesheet" href="{{ static('core/components/tabs.scss') }}">
|
||||
<link rel="stylesheet" type="text/css" href="{{ static('counter/css/counter-click.scss') }}" defer></link>
|
||||
<link rel="stylesheet" type="text/css" href="{{ static('bundled/core/components/ajax-select-index.css') }}" defer></link>
|
||||
<link rel="stylesheet" type="text/css" href="{{ static('core/components/ajax-select.scss') }}" defer></link>
|
||||
<link rel="stylesheet" type="text/css" href="{{ static('core/components/tabs.scss') }}" defer></link>
|
||||
<link rel="stylesheet" href="{{ static("core/components/card.scss") }}">
|
||||
{% endblock %}
|
||||
|
||||
@@ -65,10 +65,10 @@
|
||||
<option value="FIN">{% trans %}Confirm (FIN){% endtrans %}</option>
|
||||
<option value="ANN">{% trans %}Cancel (ANN){% endtrans %}</option>
|
||||
</optgroup>
|
||||
{%- for category, prices in categories.items() -%}
|
||||
{%- for category in categories.keys() -%}
|
||||
<optgroup label="{{ category }}">
|
||||
{%- for price in prices -%}
|
||||
<option value="{{ price.id }}">{{ price.full_label }}</option>
|
||||
{%- for product in categories[category] -%}
|
||||
<option value="{{ product.id }}">{{ product }}</option>
|
||||
{%- endfor -%}
|
||||
</optgroup>
|
||||
{%- endfor -%}
|
||||
@@ -103,25 +103,24 @@
|
||||
</div>
|
||||
<ul>
|
||||
<li x-show="getBasketSize() === 0">{% trans %}This basket is empty{% endtrans %}</li>
|
||||
<template x-for="(item, index) in Object.values(basket)" :key="item.product.price.id">
|
||||
<template x-for="(item, index) in Object.values(basket)" :key="item.product.id">
|
||||
<li>
|
||||
<template x-for="error in item.errors">
|
||||
<div class="alert alert-red" x-text="error">
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<button @click.prevent="addToBasket(item.product.price.id, -1)">-</button>
|
||||
<button @click.prevent="addToBasket(item.product.id, -1)">-</button>
|
||||
<span class="quantity" x-text="item.quantity"></span>
|
||||
<button @click.prevent="addToBasket(item.product.price.id, 1)">+</button>
|
||||
<button @click.prevent="addToBasket(item.product.id, 1)">+</button>
|
||||
|
||||
<span x-text="item.product.name"></span> :
|
||||
<span x-text="item.sum().toLocaleString(undefined, { minimumFractionDigits: 2 })">€</span>
|
||||
<span x-show="item.getBonusQuantity() > 0"
|
||||
x-text="`${item.getBonusQuantity()} x P`"></span>
|
||||
<span x-show="item.getBonusQuantity() > 0" x-text="`${item.getBonusQuantity()} x P`"></span>
|
||||
|
||||
<button
|
||||
class="remove-item"
|
||||
@click.prevent="removeFromBasket(item.product.price.id)"
|
||||
@click.prevent="removeFromBasket(item.product.id)"
|
||||
><i class="fa fa-trash-can delete-action"></i></button>
|
||||
|
||||
<input
|
||||
@@ -134,9 +133,9 @@
|
||||
>
|
||||
<input
|
||||
type="hidden"
|
||||
:value="item.product.price.id"
|
||||
:id="`id_form-${index}-price_id`"
|
||||
:name="`form-${index}-price_id`"
|
||||
:value="item.product.id"
|
||||
:id="`id_form-${index}-id`"
|
||||
:name="`form-${index}-id`"
|
||||
required
|
||||
readonly
|
||||
>
|
||||
@@ -202,30 +201,30 @@
|
||||
</div>
|
||||
|
||||
<div id="products">
|
||||
{% if not prices %}
|
||||
{% if not products %}
|
||||
<div class="alert alert-red">
|
||||
{% trans %}No products available on this counter for this user{% endtrans %}
|
||||
</div>
|
||||
{% else %}
|
||||
<ui-tab-group>
|
||||
{% for category, prices in categories.items() -%}
|
||||
{% for category in categories.keys() -%}
|
||||
<ui-tab title="{{ category }}" {% if loop.index == 1 -%}active{%- endif -%}>
|
||||
<h5 class="margin-bottom">{{ category }}</h5>
|
||||
<div class="row gap-2x">
|
||||
{% for price in prices -%}
|
||||
<button class="card shadow" @click="addToBasket('{{ price.id }}', 1)">
|
||||
{% for product in categories[category] -%}
|
||||
<button class="card shadow" @click="addToBasket('{{ product.id }}', 1)">
|
||||
<img
|
||||
class="card-image"
|
||||
alt="image de {{ price.full_label }}"
|
||||
{% if price.product.icon %}
|
||||
src="{{ price.product.icon.url }}"
|
||||
alt="image de {{ product.name }}"
|
||||
{% if product.icon %}
|
||||
src="{{ product.icon.url }}"
|
||||
{% else %}
|
||||
src="{{ static('core/img/na.gif') }}"
|
||||
{% endif %}
|
||||
/>
|
||||
<span class="card-content">
|
||||
<strong class="card-title">{{ price.full_label }}</strong>
|
||||
<p>{{ price.amount }} €<br>{{ price.product.code }}</p>
|
||||
<strong class="card-title">{{ product.name }}</strong>
|
||||
<p>{{ product.price }} €<br>{{ product.code }}</p>
|
||||
</span>
|
||||
</button>
|
||||
{%- endfor %}
|
||||
@@ -242,14 +241,13 @@
|
||||
{{ super() }}
|
||||
<script>
|
||||
const products = {
|
||||
{%- for price in prices -%}
|
||||
{{ price.id }}: {
|
||||
productId: {{ price.product_id }},
|
||||
price: { id: "{{ price.id }}", amount: {{ price.amount }} },
|
||||
code: "{{ price.product.code }}",
|
||||
name: "{{ price.full_label }}",
|
||||
hasTrayPrice: {{ price.product.tray | tojson }},
|
||||
quantityForTrayPrice: {{ price.product.QUANTITY_FOR_TRAY_PRICE }},
|
||||
{%- for product in products -%}
|
||||
{{ product.id }}: {
|
||||
id: "{{ product.id }}",
|
||||
name: "{{ product.name }}",
|
||||
price: {{ product.price }},
|
||||
hasTrayPrice: {{ product.tray | tojson }},
|
||||
quantityForTrayPrice: {{ product.QUANTITY_FOR_TRAY_PRICE }},
|
||||
},
|
||||
{%- endfor -%}
|
||||
};
|
||||
|
||||
@@ -49,10 +49,14 @@
|
||||
<strong class="card-title">{{ formula.result.name }}</strong>
|
||||
<p>
|
||||
{% for p in formula.products.all() %}
|
||||
<i>{{ p.name }} ({{ p.code }})</i>
|
||||
<i>{{ p.code }} ({{ p.selling_price }} €)</i>
|
||||
{% if not loop.last %}+{% endif %}
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>
|
||||
{{ formula.result.selling_price }} €
|
||||
({% trans %}instead of{% endtrans %} {{ formula.max_selling_price}} €)
|
||||
</p>
|
||||
</div>
|
||||
{% if user.has_perm("counter.delete_productformula") %}
|
||||
<button
|
||||
|
||||
@@ -39,49 +39,6 @@
|
||||
{% endmacro %}
|
||||
|
||||
|
||||
{% macro price_form(form) %}
|
||||
<fieldset>
|
||||
{{ form.non_field_errors() }}
|
||||
<div class="form-group row gap-2x">
|
||||
<div>{{ form.amount.as_field_group() }}</div>
|
||||
<div>
|
||||
{{ form.label.errors }}
|
||||
<label for="{{ form.label.id_for_label }}">{{ form.label.label }}</label>
|
||||
{{ form.label }}
|
||||
<span class="helptext">{{ form.label.help_text }}</span>
|
||||
</div>
|
||||
<div class="grow">{{ form.groups.as_field_group() }}</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div>
|
||||
{{ form.is_always_shown.errors }}
|
||||
<div class="row gap">
|
||||
{{ form.is_always_shown }}
|
||||
<label for="{{ form.is_always_shown.id_for_label }}">{{ form.is_always_shown.label }}</label>
|
||||
</div>
|
||||
<span class="helptext">{{ form.is_always_shown.help_text }}</span>
|
||||
</div>
|
||||
</div>
|
||||
{%- if form.DELETE -%}
|
||||
<div class="form-group row gap">
|
||||
{{ form.DELETE.as_field_group() }}
|
||||
</div>
|
||||
{%- else -%}
|
||||
<br>
|
||||
<button
|
||||
class="btn btn-grey"
|
||||
@click.prevent="removeForm($event.target.closest('fieldset').parentElement)"
|
||||
>
|
||||
<i class="fa fa-minus"></i> {% trans %}Remove price{% endtrans %}
|
||||
</button>
|
||||
{%- endif -%}
|
||||
{%- for field in form.hidden_fields() -%}
|
||||
{{ field }}
|
||||
{%- endfor -%}
|
||||
</fieldset>
|
||||
<hr class="margin-bottom">
|
||||
{% endmacro %}
|
||||
|
||||
{% block content %}
|
||||
{% if object %}
|
||||
<h2>{% trans name=object %}Edit product {{ name }}{% endtrans %}</h2>
|
||||
@@ -92,54 +49,7 @@
|
||||
{% endif %}
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
{{ form.non_field_errors() }}
|
||||
<fieldset class="row gap">
|
||||
<div>{{ form.name.as_field_group() }}</div>
|
||||
<div>{{ form.code.as_field_group() }}</div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<div class="form-group">{{ form.description.as_field_group() }}</div>
|
||||
</fieldset>
|
||||
<fieldset class="row gap">
|
||||
<div>{{ form.club.as_field_group() }}</div>
|
||||
<div>{{ form.product_type.as_field_group() }}</div>
|
||||
</fieldset>
|
||||
<fieldset><div>{{ form.icon.as_field_group() }}</div></fieldset>
|
||||
<fieldset><div>{{ form.purchase_price.as_field_group() }}</div></fieldset>
|
||||
<fieldset>
|
||||
<div>{{ form.limit_age.as_field_group() }}</div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<div class="row gap">
|
||||
{{ form.tray }}
|
||||
<div>
|
||||
{{ form.tray.label_tag() }}
|
||||
<span class="helptext">{{ form.tray.help_text }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset><div>{{ form.counters.as_field_group() }}</div></fieldset>
|
||||
|
||||
<h3 class="margin-bottom">{% trans %}Prices{% endtrans %}</h3>
|
||||
|
||||
<div x-data="dynamicFormSet({ prefix: '{{ form.price_formset.prefix }}' })">
|
||||
{{ form.price_formset.management_form }}
|
||||
<div x-ref="formContainer">
|
||||
{%- for form in form.price_formset.forms -%}
|
||||
<div>
|
||||
{{ price_form(form) }}
|
||||
</div>
|
||||
{%- endfor -%}
|
||||
</div>
|
||||
<template x-ref="formTemplate">
|
||||
<div>
|
||||
{{ price_form(form.price_formset.empty_form) }}
|
||||
</div>
|
||||
</template>
|
||||
<button class="btn btn-grey" @click.prevent="addForm()">
|
||||
<i class="fa fa-plus"></i> {% trans %}Add a price{% endtrans %}
|
||||
</button>
|
||||
</div>
|
||||
{{ form.as_p() }}
|
||||
|
||||
<br />
|
||||
|
||||
@@ -154,7 +64,7 @@
|
||||
</em>
|
||||
</p>
|
||||
|
||||
<div x-data="dynamicFormSet({ prefix: '{{ form.action_formset.prefix }}' })" class="margin-bottom">
|
||||
<div x-data="dynamicFormSet" class="margin-bottom">
|
||||
{{ form.action_formset.management_form }}
|
||||
<div x-ref="formContainer">
|
||||
{%- for f in form.action_formset.forms -%}
|
||||
@@ -168,7 +78,6 @@
|
||||
<i class="fa fa-plus"></i>{% trans %}Add action{% endtrans %}
|
||||
</button>
|
||||
</div>
|
||||
<div class="row gap margin-bottom">{{ form.archived.as_field_group() }}</div>
|
||||
<p><input class="btn btn-blue" type="submit" value="{% trans %}Save{% endtrans %}" /></p>
|
||||
</form>
|
||||
{% endblock %}
|
||||
@@ -108,7 +108,7 @@
|
||||
</template>
|
||||
<span class="card-content">
|
||||
<strong class="card-title" x-text="`${p.name} (${p.code})`"></strong>
|
||||
<p x-text="`${p.prices.map((p) => p.amount).join(' – ')} €`"></p>
|
||||
<p x-text="`${p.selling_price} €`"></p>
|
||||
</span>
|
||||
</a>
|
||||
</template>
|
||||
|
||||
@@ -16,7 +16,7 @@ from counter.forms import (
|
||||
ScheduledProductActionForm,
|
||||
ScheduledProductActionFormSet,
|
||||
)
|
||||
from counter.models import Product, ProductType, ScheduledProductAction
|
||||
from counter.models import Product, ScheduledProductAction
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
@@ -47,22 +47,20 @@ def test_create_actions_alongside_product():
|
||||
form = ProductForm(
|
||||
data={
|
||||
"name": "foo",
|
||||
"product_type": ProductType.objects.first(),
|
||||
"description": "bar",
|
||||
"product_type": product.product_type_id,
|
||||
"club": product.club_id,
|
||||
"code": "FOO",
|
||||
"purchase_price": 1.0,
|
||||
"selling_price": 1.0,
|
||||
"special_selling_price": 1.0,
|
||||
"limit_age": 0,
|
||||
"price-TOTAL_FORMS": "0",
|
||||
"price-INITIAL_FORMS": "0",
|
||||
"action-TOTAL_FORMS": "1",
|
||||
"action-INITIAL_FORMS": "0",
|
||||
"action-0-task": "counter.tasks.archive_product",
|
||||
"action-0-trigger_at": trigger_at,
|
||||
"form-TOTAL_FORMS": "2",
|
||||
"form-INITIAL_FORMS": "0",
|
||||
"form-0-task": "counter.tasks.archive_product",
|
||||
"form-0-trigger_at": trigger_at,
|
||||
},
|
||||
)
|
||||
form.is_valid()
|
||||
assert form.is_valid()
|
||||
product = form.save()
|
||||
action = ScheduledProductAction.objects.last()
|
||||
|
||||
@@ -20,6 +20,7 @@ import pytest
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.models import Permission, make_password
|
||||
from django.core.cache import cache
|
||||
from django.http import HttpResponse
|
||||
from django.shortcuts import resolve_url
|
||||
from django.test import Client, TestCase
|
||||
@@ -33,13 +34,13 @@ from pytest_django.asserts import assertRedirects
|
||||
|
||||
from club.models import Membership
|
||||
from core.baker_recipes import board_user, subscriber_user, very_old_subscriber_user
|
||||
from core.models import BanGroup, Group, User
|
||||
from counter.baker_recipes import price_recipe, product_recipe, sale_recipe
|
||||
from core.models import BanGroup, User
|
||||
from counter.baker_recipes import product_recipe, sale_recipe
|
||||
from counter.models import (
|
||||
Counter,
|
||||
Customer,
|
||||
Permanency,
|
||||
ProductType,
|
||||
Product,
|
||||
Refilling,
|
||||
ReturnableProduct,
|
||||
Selling,
|
||||
@@ -203,7 +204,7 @@ class TestRefilling(TestFullClickBase):
|
||||
|
||||
@dataclass
|
||||
class BasketItem:
|
||||
price_id: int | None = None
|
||||
id: int | None = None
|
||||
quantity: int | None = None
|
||||
|
||||
def to_form(self, index: int) -> dict[str, str]:
|
||||
@@ -235,59 +236,38 @@ class TestCounterClick(TestFullClickBase):
|
||||
cls.banned_counter_customer.ban_groups.add(
|
||||
BanGroup.objects.get(pk=settings.SITH_GROUP_BANNED_COUNTER_ID)
|
||||
)
|
||||
subscriber_group = Group.objects.get(id=settings.SITH_GROUP_SUBSCRIBERS_ID)
|
||||
old_subscriber_group = Group.objects.get(
|
||||
id=settings.SITH_GROUP_OLD_SUBSCRIBERS_ID
|
||||
)
|
||||
_product_recipe = product_recipe.extend(product_type=baker.make(ProductType))
|
||||
|
||||
cls.gift = price_recipe.make(
|
||||
amount=-1.5, groups=[subscriber_group], product=_product_recipe.make()
|
||||
cls.gift = product_recipe.make(
|
||||
selling_price="-1.5",
|
||||
special_selling_price="-1.5",
|
||||
)
|
||||
cls.beer = price_recipe.make(
|
||||
groups=[subscriber_group],
|
||||
amount=1.5,
|
||||
product=_product_recipe.make(limit_age=18),
|
||||
cls.beer = product_recipe.make(
|
||||
limit_age=18, selling_price=1.5, special_selling_price=1
|
||||
)
|
||||
cls.beer_tap = price_recipe.make(
|
||||
groups=[subscriber_group],
|
||||
amount=1.5,
|
||||
product=_product_recipe.make(limit_age=18, tray=True),
|
||||
cls.beer_tap = product_recipe.make(
|
||||
limit_age=18, tray=True, selling_price=1.5, special_selling_price=1
|
||||
)
|
||||
cls.snack = price_recipe.make(
|
||||
groups=[subscriber_group, old_subscriber_group],
|
||||
amount=1.5,
|
||||
product=_product_recipe.make(limit_age=0),
|
||||
cls.snack = product_recipe.make(
|
||||
limit_age=0, selling_price=1.5, special_selling_price=1
|
||||
)
|
||||
cls.stamps = price_recipe.make(
|
||||
groups=[subscriber_group],
|
||||
amount=1.5,
|
||||
product=_product_recipe.make(limit_age=0),
|
||||
cls.stamps = product_recipe.make(
|
||||
limit_age=0, selling_price=1.5, special_selling_price=1
|
||||
)
|
||||
ReturnableProduct.objects.all().delete()
|
||||
cls.cons = price_recipe.make(
|
||||
amount=1, groups=[subscriber_group], product=_product_recipe.make()
|
||||
)
|
||||
cls.dcons = price_recipe.make(
|
||||
amount=-1, groups=[subscriber_group], product=_product_recipe.make()
|
||||
)
|
||||
cls.cons = baker.make(Product, selling_price=1)
|
||||
cls.dcons = baker.make(Product, selling_price=-1)
|
||||
baker.make(
|
||||
ReturnableProduct,
|
||||
product=cls.cons.product,
|
||||
returned_product=cls.dcons.product,
|
||||
product=cls.cons,
|
||||
returned_product=cls.dcons,
|
||||
max_return=3,
|
||||
)
|
||||
|
||||
cls.counter.products.add(
|
||||
cls.gift.product,
|
||||
cls.beer.product,
|
||||
cls.beer_tap.product,
|
||||
cls.snack.product,
|
||||
cls.cons.product,
|
||||
cls.dcons.product,
|
||||
cls.gift, cls.beer, cls.beer_tap, cls.snack, cls.cons, cls.dcons
|
||||
)
|
||||
cls.other_counter.products.add(cls.snack.product)
|
||||
cls.club_counter.products.add(cls.stamps.product)
|
||||
cls.other_counter.products.add(cls.snack)
|
||||
cls.club_counter.products.add(cls.stamps)
|
||||
|
||||
def login_in_bar(self, barmen: User | None = None):
|
||||
used_barman = barmen if barmen is not None else self.barmen
|
||||
@@ -305,7 +285,10 @@ class TestCounterClick(TestFullClickBase):
|
||||
) -> HttpResponse:
|
||||
used_counter = counter if counter is not None else self.counter
|
||||
used_client = client if client is not None else self.client
|
||||
data = {"form-TOTAL_FORMS": str(len(basket)), "form-INITIAL_FORMS": "0"}
|
||||
data = {
|
||||
"form-TOTAL_FORMS": str(len(basket)),
|
||||
"form-INITIAL_FORMS": "0",
|
||||
}
|
||||
for index, item in enumerate(basket):
|
||||
data.update(item.to_form(index))
|
||||
return used_client.post(
|
||||
@@ -348,22 +331,32 @@ class TestCounterClick(TestFullClickBase):
|
||||
res = self.submit_basket(
|
||||
self.customer, [BasketItem(self.beer.id, 2), BasketItem(self.snack.id, 1)]
|
||||
)
|
||||
self.assertRedirects(res, self.counter.get_absolute_url())
|
||||
assert res.status_code == 302
|
||||
|
||||
assert self.updated_amount(self.customer) == Decimal("5.5")
|
||||
|
||||
# Test barmen special price
|
||||
|
||||
force_refill_user(self.barmen, 10)
|
||||
|
||||
assert (
|
||||
self.submit_basket(self.barmen, [BasketItem(self.beer.id, 1)])
|
||||
).status_code == 302
|
||||
|
||||
assert self.updated_amount(self.barmen) == Decimal(9)
|
||||
|
||||
def test_click_tray_price(self):
|
||||
force_refill_user(self.customer, 20)
|
||||
self.login_in_bar(self.barmen)
|
||||
|
||||
# Not applying tray price
|
||||
res = self.submit_basket(self.customer, [BasketItem(self.beer_tap.id, 2)])
|
||||
self.assertRedirects(res, self.counter.get_absolute_url())
|
||||
assert res.status_code == 302
|
||||
assert self.updated_amount(self.customer) == Decimal(17)
|
||||
|
||||
# Applying tray price
|
||||
res = self.submit_basket(self.customer, [BasketItem(self.beer_tap.id, 7)])
|
||||
self.assertRedirects(res, self.counter.get_absolute_url())
|
||||
assert res.status_code == 302
|
||||
assert self.updated_amount(self.customer) == Decimal(8)
|
||||
|
||||
def test_click_alcool_unauthorized(self):
|
||||
@@ -484,8 +477,7 @@ class TestCounterClick(TestFullClickBase):
|
||||
BasketItem(None, 1),
|
||||
BasketItem(self.beer.id, None),
|
||||
]:
|
||||
res = self.submit_basket(self.customer, [item])
|
||||
assert res.status_code == 200
|
||||
assert self.submit_basket(self.customer, [item]).status_code == 200
|
||||
assert self.updated_amount(self.customer) == Decimal(10)
|
||||
|
||||
def test_click_not_enough_money(self):
|
||||
@@ -514,30 +506,29 @@ class TestCounterClick(TestFullClickBase):
|
||||
res = self.submit_basket(
|
||||
self.customer, [BasketItem(self.beer.id, 1), BasketItem(self.gift.id, 1)]
|
||||
)
|
||||
self.assertRedirects(res, self.counter.get_absolute_url())
|
||||
assert res.status_code == 302
|
||||
|
||||
assert self.updated_amount(self.customer) == 0
|
||||
|
||||
def test_recordings(self):
|
||||
force_refill_user(self.customer, self.cons.amount * 3)
|
||||
force_refill_user(self.customer, self.cons.selling_price * 3)
|
||||
self.login_in_bar(self.barmen)
|
||||
res = self.submit_basket(self.customer, [BasketItem(self.cons.id, 3)])
|
||||
assert res.status_code == 302
|
||||
assert self.updated_amount(self.customer) == 0
|
||||
assert list(
|
||||
self.customer.customer.return_balances.values("returnable", "balance")
|
||||
) == [{"returnable": self.cons.product.cons.id, "balance": 3}]
|
||||
) == [{"returnable": self.cons.cons.id, "balance": 3}]
|
||||
|
||||
res = self.submit_basket(self.customer, [BasketItem(self.dcons.id, 3)])
|
||||
assert res.status_code == 302
|
||||
assert self.updated_amount(self.customer) == self.dcons.amount * -3
|
||||
assert self.updated_amount(self.customer) == self.dcons.selling_price * -3
|
||||
|
||||
res = self.submit_basket(
|
||||
self.customer,
|
||||
[BasketItem(self.dcons.id, self.dcons.product.dcons.max_return)],
|
||||
self.customer, [BasketItem(self.dcons.id, self.dcons.dcons.max_return)]
|
||||
)
|
||||
# from now on, the user amount should not change
|
||||
expected_amount = self.dcons.amount * (-3 - self.dcons.product.dcons.max_return)
|
||||
expected_amount = self.dcons.selling_price * (-3 - self.dcons.dcons.max_return)
|
||||
assert res.status_code == 302
|
||||
assert self.updated_amount(self.customer) == expected_amount
|
||||
|
||||
@@ -554,57 +545,48 @@ class TestCounterClick(TestFullClickBase):
|
||||
def test_recordings_when_negative(self):
|
||||
sale_recipe.make(
|
||||
customer=self.customer.customer,
|
||||
product=self.dcons.product,
|
||||
unit_price=self.dcons.amount,
|
||||
product=self.dcons,
|
||||
unit_price=self.dcons.selling_price,
|
||||
quantity=10,
|
||||
)
|
||||
self.customer.customer.update_returnable_balance()
|
||||
self.login_in_bar(self.barmen)
|
||||
res = self.submit_basket(self.customer, [BasketItem(self.dcons.id, 1)])
|
||||
assert res.status_code == 200
|
||||
assert self.updated_amount(self.customer) == self.dcons.amount * -10
|
||||
assert self.updated_amount(self.customer) == self.dcons.selling_price * -10
|
||||
|
||||
res = self.submit_basket(self.customer, [BasketItem(self.cons.id, 3)])
|
||||
assert res.status_code == 302
|
||||
assert (
|
||||
self.updated_amount(self.customer)
|
||||
== self.dcons.amount * -10 - self.cons.amount * 3
|
||||
== self.dcons.selling_price * -10 - self.cons.selling_price * 3
|
||||
)
|
||||
|
||||
res = self.submit_basket(self.customer, [BasketItem(self.beer.id, 1)])
|
||||
assert res.status_code == 302
|
||||
assert (
|
||||
self.updated_amount(self.customer)
|
||||
== self.dcons.amount * -10 - self.cons.amount * 3 - self.beer.amount
|
||||
== self.dcons.selling_price * -10
|
||||
- self.cons.selling_price * 3
|
||||
- self.beer.selling_price
|
||||
)
|
||||
|
||||
def test_no_fetch_archived_product(self):
|
||||
counter = baker.make(Counter)
|
||||
group = baker.make(Group)
|
||||
customer = baker.make(Customer)
|
||||
group.users.add(customer.user)
|
||||
_product_recipe = product_recipe.extend(
|
||||
counters=[counter], product_type=baker.make(ProductType)
|
||||
product_recipe.make(archived=True, counters=[counter])
|
||||
unarchived_products = product_recipe.make(
|
||||
archived=False, counters=[counter], _quantity=3
|
||||
)
|
||||
price_recipe.make(
|
||||
_quantity=2,
|
||||
product=iter(_product_recipe.make(archived=True, _quantity=2)),
|
||||
groups=[group],
|
||||
)
|
||||
unarchived_prices = price_recipe.make(
|
||||
_quantity=2,
|
||||
product=iter(_product_recipe.make(archived=False, _quantity=2)),
|
||||
groups=[group],
|
||||
)
|
||||
customer_prices = counter.get_prices_for(customer)
|
||||
assert unarchived_prices == customer_prices
|
||||
customer_products = counter.get_products_for(customer)
|
||||
assert unarchived_products == customer_products
|
||||
|
||||
|
||||
class TestCounterStats(TestCase):
|
||||
@classmethod
|
||||
def setUpTestData(cls):
|
||||
cls.users = subscriber_user.make(_quantity=4)
|
||||
product = price_recipe.make(amount=1).product
|
||||
product = product_recipe.make(selling_price=1)
|
||||
cls.counter = baker.make(
|
||||
Counter, type=["BAR"], sellers=cls.users[:4], products=[product]
|
||||
)
|
||||
@@ -803,6 +785,9 @@ class TestClubCounterClickAccess(TestCase):
|
||||
|
||||
cls.user = subscriber_user.make()
|
||||
|
||||
def setUp(self):
|
||||
cache.clear()
|
||||
|
||||
def test_anonymous(self):
|
||||
res = self.client.get(self.click_url)
|
||||
assert res.status_code == 403
|
||||
|
||||
@@ -341,7 +341,7 @@ def test_update_balance():
|
||||
def test_update_returnable_balance():
|
||||
ReturnableProduct.objects.all().delete()
|
||||
customer = baker.make(Customer)
|
||||
products = product_recipe.make(_quantity=4, _bulk_create=True)
|
||||
products = product_recipe.make(selling_price=0, _quantity=4, _bulk_create=True)
|
||||
returnables = [
|
||||
baker.make(
|
||||
ReturnableProduct, product=products[0], returned_product=products[1]
|
||||
|
||||
@@ -7,7 +7,12 @@ from counter.forms import ProductFormulaForm
|
||||
class TestFormulaForm(TestCase):
|
||||
@classmethod
|
||||
def setUpTestData(cls):
|
||||
cls.products = product_recipe.make(_quantity=3, _bulk_create=True)
|
||||
cls.products = product_recipe.make(
|
||||
selling_price=iter([1.5, 1, 1]),
|
||||
special_selling_price=iter([1.4, 0.9, 0.9]),
|
||||
_quantity=3,
|
||||
_bulk_create=True,
|
||||
)
|
||||
|
||||
def test_ok(self):
|
||||
form = ProductFormulaForm(
|
||||
@@ -21,6 +26,23 @@ class TestFormulaForm(TestCase):
|
||||
assert formula.result == self.products[0]
|
||||
assert set(formula.products.all()) == set(self.products[1:])
|
||||
|
||||
def test_price_invalid(self):
|
||||
self.products[0].selling_price = 2.1
|
||||
self.products[0].save()
|
||||
form = ProductFormulaForm(
|
||||
data={
|
||||
"result": self.products[0].id,
|
||||
"products": [self.products[1].id, self.products[2].id],
|
||||
}
|
||||
)
|
||||
assert not form.is_valid()
|
||||
assert form.errors == {
|
||||
"result": [
|
||||
"Le résultat ne peut pas être plus cher "
|
||||
"que le total des autres produits."
|
||||
]
|
||||
}
|
||||
|
||||
def test_product_both_in_result_and_products(self):
|
||||
form = ProductFormulaForm(
|
||||
data={
|
||||
|
||||
+37
-100
@@ -9,7 +9,6 @@ from django.core.files.uploadedfile import SimpleUploadedFile
|
||||
from django.test import Client, TestCase
|
||||
from django.urls import reverse
|
||||
from model_bakery import baker
|
||||
from model_bakery.recipe import Recipe
|
||||
from PIL import Image
|
||||
from pytest_django.asserts import assertNumQueries, assertRedirects
|
||||
|
||||
@@ -17,8 +16,8 @@ from club.models import Club
|
||||
from core.baker_recipes import board_user, subscriber_user
|
||||
from core.models import Group, User
|
||||
from counter.baker_recipes import product_recipe
|
||||
from counter.forms import ProductForm, ProductPriceFormSet
|
||||
from counter.models import Price, Product, ProductType
|
||||
from counter.forms import ProductForm
|
||||
from counter.models import Product, ProductFormula, ProductType
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
@@ -82,11 +81,11 @@ def test_fetch_product_access(
|
||||
def test_fetch_product_nb_queries(client: Client):
|
||||
client.force_login(baker.make(User, is_superuser=True))
|
||||
cache.clear()
|
||||
with assertNumQueries(6):
|
||||
with assertNumQueries(5):
|
||||
# - 2 for authentication
|
||||
# - 1 for pagination
|
||||
# - 1 for the actual request
|
||||
# - 2 to prefetch the related prices and groups
|
||||
# - 1 to prefetch the related buying_groups
|
||||
client.get(reverse("api:search_products_detailed"))
|
||||
|
||||
|
||||
@@ -108,21 +107,48 @@ class TestCreateProduct(TestCase):
|
||||
"selling_price": 1.0,
|
||||
"special_selling_price": 1.0,
|
||||
"limit_age": 0,
|
||||
"price-TOTAL_FORMS": 0,
|
||||
"price-INITIAL_FORMS": 0,
|
||||
"action-TOTAL_FORMS": 0,
|
||||
"action-INITIAL_FORMS": 0,
|
||||
"form-TOTAL_FORMS": 0,
|
||||
"form-INITIAL_FORMS": 0,
|
||||
}
|
||||
|
||||
def test_form_simple(self):
|
||||
def test_form(self):
|
||||
form = ProductForm(data=self.data)
|
||||
assert form.is_valid()
|
||||
instance = form.save()
|
||||
assert instance.club == self.club
|
||||
assert instance.product_type == self.product_type
|
||||
assert instance.name == "foo"
|
||||
assert instance.selling_price == 1.0
|
||||
|
||||
def test_view_simple(self):
|
||||
def test_form_with_product_from_formula(self):
|
||||
"""Test when the edited product is a result of a formula."""
|
||||
self.client.force_login(self.counter_admin)
|
||||
products = product_recipe.make(
|
||||
selling_price=iter([1.5, 1, 1]),
|
||||
special_selling_price=iter([1.4, 0.9, 0.9]),
|
||||
_quantity=3,
|
||||
_bulk_create=True,
|
||||
)
|
||||
baker.make(ProductFormula, result=products[0], products=products[1:])
|
||||
|
||||
data = self.data | {"selling_price": 1.7, "special_selling_price": 1.5}
|
||||
form = ProductForm(data=data, instance=products[0])
|
||||
assert form.is_valid()
|
||||
|
||||
# it shouldn't be possible to give a price higher than the formula's products
|
||||
data = self.data | {"selling_price": 2.1, "special_selling_price": 1.9}
|
||||
form = ProductForm(data=data, instance=products[0])
|
||||
assert not form.is_valid()
|
||||
assert form.errors == {
|
||||
"selling_price": [
|
||||
"Assurez-vous que cette valeur est inférieure ou égale à 2.00."
|
||||
],
|
||||
"special_selling_price": [
|
||||
"Assurez-vous que cette valeur est inférieure ou égale à 1.80."
|
||||
],
|
||||
}
|
||||
|
||||
def test_view(self):
|
||||
self.client.force_login(self.counter_admin)
|
||||
url = reverse("counter:new_product")
|
||||
response = self.client.get(url)
|
||||
@@ -133,92 +159,3 @@ class TestCreateProduct(TestCase):
|
||||
assert product.name == "foo"
|
||||
assert product.club == self.club
|
||||
assert product.product_type == self.product_type
|
||||
|
||||
|
||||
class TestPriceFormSet(TestCase):
|
||||
@classmethod
|
||||
def setUpTestData(cls):
|
||||
cls.product = product_recipe.make()
|
||||
cls.counter_admin = baker.make(
|
||||
User, groups=[Group.objects.get(id=settings.SITH_GROUP_COUNTER_ADMIN_ID)]
|
||||
)
|
||||
cls.groups = baker.make(Group, _quantity=3)
|
||||
|
||||
def test_add_price(self):
|
||||
data = {
|
||||
"prices-0-amount": 2,
|
||||
"prices-0-label": "foo",
|
||||
"prices-0-groups": [self.groups[0].id, self.groups[1].id],
|
||||
"prices-0-is_always_shown": True,
|
||||
"prices-1-amount": 1.5,
|
||||
"prices-1-label": "",
|
||||
"prices-1-groups": [self.groups[1].id, self.groups[2].id],
|
||||
"prices-1-is_always_shown": False,
|
||||
"prices-TOTAL_FORMS": 2,
|
||||
"prices-INITIAL_FORMS": 0,
|
||||
}
|
||||
form = ProductPriceFormSet(instance=self.product, data=data)
|
||||
assert form.is_valid()
|
||||
form.save()
|
||||
prices = list(self.product.prices.order_by("amount"))
|
||||
assert len(prices) == 2
|
||||
assert prices[0].amount == 1.5
|
||||
assert prices[0].label == ""
|
||||
assert prices[0].is_always_shown is False
|
||||
assert set(prices[0].groups.all()) == {self.groups[1], self.groups[2]}
|
||||
assert prices[1].amount == 2
|
||||
assert prices[1].label == "foo"
|
||||
assert prices[1].is_always_shown is True
|
||||
assert set(prices[1].groups.all()) == {self.groups[0], self.groups[1]}
|
||||
|
||||
def test_change_prices(self):
|
||||
price_a = baker.make(
|
||||
Price, product=self.product, amount=1.5, groups=self.groups[:1]
|
||||
)
|
||||
price_b = baker.make(
|
||||
Price, product=self.product, amount=2, groups=self.groups[1:]
|
||||
)
|
||||
data = {
|
||||
"prices-0-id": price_a.id,
|
||||
"prices-0-DELETE": True,
|
||||
"prices-1-id": price_b.id,
|
||||
"prices-1-DELETE": False,
|
||||
"prices-1-amount": 3,
|
||||
"prices-1-label": "foo",
|
||||
"prices-1-groups": [self.groups[1].id],
|
||||
"prices-1-is_always_shown": True,
|
||||
"prices-TOTAL_FORMS": 2,
|
||||
"prices-INITIAL_FORMS": 2,
|
||||
}
|
||||
form = ProductPriceFormSet(instance=self.product, data=data)
|
||||
assert form.is_valid()
|
||||
form.save()
|
||||
prices = list(self.product.prices.order_by("amount"))
|
||||
assert len(prices) == 1
|
||||
assert prices[0].amount == 3
|
||||
assert prices[0].label == "foo"
|
||||
assert prices[0].is_always_shown is True
|
||||
assert set(prices[0].groups.all()) == {self.groups[1]}
|
||||
assert not Price.objects.filter(id=price_a.id).exists()
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_price_for_user():
|
||||
groups = baker.make(Group, _quantity=4)
|
||||
users = [
|
||||
baker.make(User, groups=groups[:2]),
|
||||
baker.make(User, groups=groups[1:3]),
|
||||
baker.make(User, groups=[groups[3]]),
|
||||
]
|
||||
recipe = Recipe(Price, product=product_recipe.make())
|
||||
prices = [
|
||||
recipe.make(amount=5, groups=groups, is_always_shown=True),
|
||||
recipe.make(amount=4, groups=[groups[0]], is_always_shown=True),
|
||||
recipe.make(amount=3, groups=[groups[1]], is_always_shown=False),
|
||||
recipe.make(amount=2, groups=[groups[3]], is_always_shown=False),
|
||||
recipe.make(amount=1, groups=[groups[1]], is_always_shown=False),
|
||||
]
|
||||
qs = Price.objects.order_by("-amount")
|
||||
assert set(qs.for_user(users[0])) == {prices[0], prices[1], prices[4]}
|
||||
assert set(qs.for_user(users[1])) == {prices[0], prices[4]}
|
||||
assert set(qs.for_user(users[2])) == {prices[0], prices[3]}
|
||||
|
||||
+22
-20
@@ -73,7 +73,7 @@ class CounterClick(
|
||||
kwargs["form_kwargs"] = {
|
||||
"customer": self.customer,
|
||||
"counter": self.object,
|
||||
"allowed_prices": {price.id: price for price in self.prices},
|
||||
"allowed_products": {product.id: product for product in self.products},
|
||||
}
|
||||
return kwargs
|
||||
|
||||
@@ -103,7 +103,7 @@ class CounterClick(
|
||||
):
|
||||
return redirect(obj) # Redirect to counter
|
||||
|
||||
self.prices = obj.get_prices_for(self.customer)
|
||||
self.products = obj.get_products_for(self.customer)
|
||||
|
||||
return super().dispatch(request, *args, **kwargs)
|
||||
|
||||
@@ -121,31 +121,32 @@ class CounterClick(
|
||||
# This is important because some items have a negative price
|
||||
# Negative priced items gives money to the customer and should
|
||||
# be processed first so that we don't throw a not enough money error
|
||||
for form in sorted(formset, key=lambda form: form.price.amount):
|
||||
for form in sorted(formset, key=lambda form: form.product.price):
|
||||
self.request.session["last_basket"].append(
|
||||
f"{form.cleaned_data['quantity']} x {form.price.full_label}"
|
||||
f"{form.cleaned_data['quantity']} x {form.product.name}"
|
||||
)
|
||||
|
||||
common_kwargs = {
|
||||
"product": form.price.product,
|
||||
"club_id": form.price.product.club_id,
|
||||
"counter": self.object,
|
||||
"seller": operator,
|
||||
"customer": self.customer,
|
||||
}
|
||||
Selling(
|
||||
**common_kwargs,
|
||||
label=form.price.full_label,
|
||||
unit_price=form.price.amount,
|
||||
label=form.product.name,
|
||||
product=form.product,
|
||||
club=form.product.club,
|
||||
counter=self.object,
|
||||
unit_price=form.product.price,
|
||||
quantity=form.cleaned_data["quantity"]
|
||||
- form.cleaned_data["bonus_quantity"],
|
||||
seller=operator,
|
||||
customer=self.customer,
|
||||
).save()
|
||||
if form.cleaned_data["bonus_quantity"] > 0:
|
||||
Selling(
|
||||
**common_kwargs,
|
||||
label=f"{form.price.full_label} (Plateau)",
|
||||
label=f"{form.product.name} (Plateau)",
|
||||
product=form.product,
|
||||
club=form.product.club,
|
||||
counter=self.object,
|
||||
unit_price=0,
|
||||
quantity=form.cleaned_data["bonus_quantity"],
|
||||
seller=operator,
|
||||
customer=self.customer,
|
||||
).save()
|
||||
|
||||
self.customer.update_returnable_balance()
|
||||
@@ -206,13 +207,14 @@ class CounterClick(
|
||||
def get_context_data(self, **kwargs):
|
||||
"""Add customer to the context."""
|
||||
kwargs = super().get_context_data(**kwargs)
|
||||
kwargs["prices"] = self.prices
|
||||
kwargs["products"] = self.products
|
||||
kwargs["formulas"] = ProductFormula.objects.filter(
|
||||
result__in=[p.product_id for p in self.prices]
|
||||
result__in=self.products
|
||||
).prefetch_related("products")
|
||||
kwargs["categories"] = defaultdict(list)
|
||||
for price in self.prices:
|
||||
kwargs["categories"][price.product.product_type].append(price)
|
||||
for product in kwargs["products"]:
|
||||
if product.product_type:
|
||||
kwargs["categories"][product.product_type].append(product)
|
||||
kwargs["customer"] = self.customer
|
||||
kwargs["cancel_url"] = self.get_success_url()
|
||||
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
## Pourquoi Xapian
|
||||
|
||||
Xapian permet de faire de la recherche fulltext.
|
||||
C'est une librairie écrite en C++ avec des bindings Python
|
||||
qu'on utilise avec la dépendance `django-haystack` via `xapian-haystack`.
|
||||
|
||||
Elle a les avantages suivants:
|
||||
|
||||
* C'est très rapide et ça correspond très bien à notre échelle
|
||||
* C'est performant
|
||||
* Pas besoin de service supplémentaire, c'est une librairie qui utilise des fichiers, comme sqlite
|
||||
|
||||
Mais elle a un défaut majeur: on ne peut pas « juste » la `pip install`,
|
||||
il faut installer une librairie système et des bindings et ça a toujours été
|
||||
l'étape la plus frustrante et buggée de notre process d'installation. C'est
|
||||
aussi la seule raison qui fait que le projet n'es pas compatible windows.
|
||||
|
||||
## Mettre à jour Xapian
|
||||
|
||||
Pour installer xapian le plus simplement possible, on le compile depuis les
|
||||
sources via la commande `./manage.py install_xapian` comme indiqué dans la
|
||||
documentation d'installation.
|
||||
|
||||
La version de xapian est contrôlée par le `pyproject.toml` dans la section
|
||||
`[tool.xapian]`.
|
||||
|
||||
Cette section ressemble à ceci:
|
||||
|
||||
```toml
|
||||
[tool.xapian]
|
||||
version = "x.y.z"
|
||||
core-sha256 = "abcdefghijklmnopqrstuvwyz0123456789"
|
||||
bindings-sha256 = "abcdefghijklmnopqrstuvwyz0123456789"
|
||||
```
|
||||
|
||||
Comme on peut le voir, il y a 3 variables différentes, une variable de version,
|
||||
qui sert à choisir la version à télécharger, et deux variables sha256.
|
||||
|
||||
Ces variables sha256 permettent de protéger des attaques par supply chain, un
|
||||
peu comme uv et npm font avec leurs respectifs `uv.lock` et `package-lock.json`
|
||||
. Elles permettent de vérifier que les fichiers téléchargés n'ont pas été
|
||||
altérés entre la configuration du fichier et l'installation par l'utilisateur
|
||||
et/ou le déploiement.
|
||||
|
||||
L'installation de xapian passe par deux fichiers, `xapian-core` et
|
||||
`xapian-bindings` disponibles sur [https://xapian.org/download](https://xapian.org/download).
|
||||
|
||||
Lorsque le script d'installation télécharge les fichiers, il vérifie leur
|
||||
signature sha256 contre celles contenues dans ces deux variables. Si la
|
||||
signature n'est pas la même, une erreur est levée, protégant l'utilisateur
|
||||
d'une potentielle attaque.
|
||||
|
||||
Pour mettre à jour, il faut donc changer la version ET modifier la signature !
|
||||
|
||||
Pour récupérer ces signatures, il suffit de télécharger soi-même les archives
|
||||
du logiciel sur ce site, utiliser la commande `sha256sum` dessus et, enfin,
|
||||
reporter la valeur sortie par cette commande.
|
||||
|
||||
Pour ce qui est de la correspondance, `core-sha256` correspond à la signature
|
||||
de `xapian-core` et `bindings-sha256` de `xapian-bindings`.
|
||||
|
||||
Voici un bout de script qui peut faciliter une mise à jour:
|
||||
|
||||
```bash
|
||||
VERSION="x.y.z" # À modifier avec la bonne version
|
||||
curl -O "https://oligarchy.co.uk/xapian/${VERSION}/xapian-core-${VERSION}.tar.xz"
|
||||
sha256sum xapian-core-${VERSION}.tar.xz # Affiche la signature pour `core-sha256`
|
||||
rm -f xapian-core-${VERSION}
|
||||
|
||||
curl -O "https://oligarchy.co.uk/xapian/${VERSION}/xapian-bindings-${VERSION}.tar.xz"
|
||||
sha256sum xapian-bindings-${VERSION}.tar.xz # Affiche la signature pour `bindingse-sha256`
|
||||
rm -f xapian-bindings-${VERSION}.tar.xz
|
||||
```
|
||||
@@ -56,12 +56,6 @@ Commencez par installer les dépendances système :
|
||||
sudo pacman -S postgresql nginx
|
||||
```
|
||||
|
||||
=== "Fedora/RHEL/AlmaLinux/Rocky"
|
||||
|
||||
```bash
|
||||
sudo dnf install postgresql libpq-devel nginx
|
||||
```
|
||||
|
||||
=== "macOS"
|
||||
|
||||
```bash
|
||||
@@ -106,11 +100,9 @@ PROCFILE_SERVICE=
|
||||
vous devez ouvrir une autre fenêtre de votre terminal
|
||||
et lancer la commande `npm run serve`
|
||||
|
||||
## Configurer Redis/Valkey en service externe
|
||||
## Configurer Redis en service externe
|
||||
|
||||
Redis est installé comme dépendance mais n'es pas lancé par défaut.
|
||||
|
||||
Si vous avez installé Valkey parce que Redis n'es pas disponible, remplacez juste `redis` par `valkey`.
|
||||
Redis est installé comme dépendance mais pas lancé par défaut.
|
||||
|
||||
En mode développement, le sith se charge de le démarrer mais
|
||||
pas en production !
|
||||
|
||||
@@ -79,29 +79,6 @@ cd /mnt/<la_lettre_du_disque>/vos/fichiers/comme/dhab
|
||||
sudo pacman -S uv gcc git gettext pkgconf npm valkey
|
||||
```
|
||||
|
||||
=== "Fedora"
|
||||
```bash
|
||||
sudo dnf update
|
||||
sudo dnf install epel-release
|
||||
sudo dnf install python-devel uv git gettext pkgconf npm redis @c-development @development-tools
|
||||
```
|
||||
|
||||
=== "RHEL/AlmaLinux/Rocky"
|
||||
```bash
|
||||
dnf update
|
||||
dnf install epel-release
|
||||
dnf install python-devel uv git gettext pkgconf npm valkey
|
||||
dnf group install "Development Tools"
|
||||
```
|
||||
|
||||
La couche de compatibilitée valkey/redis est un package Fedora.
|
||||
Il est nécessaire de faire un alias nous même:
|
||||
|
||||
```bash
|
||||
ln -s /usr/bin/valkey-server /usr/bin/redis-server
|
||||
```
|
||||
|
||||
|
||||
=== "macOS"
|
||||
|
||||
Pour installer les dépendances, il est fortement recommandé d'installer le gestionnaire de paquets `homebrew <https://brew.sh/index_fr>`_.
|
||||
@@ -121,7 +98,7 @@ cd /mnt/<la_lettre_du_disque>/vos/fichiers/comme/dhab
|
||||
!!!note
|
||||
|
||||
Python ne fait pas parti des dépendances puisqu'il est automatiquement
|
||||
installé par uv. Il est cependant parfois nécessaire d'installer les headers Python nécessaire à la compilation de certains paquets.
|
||||
installé par uv.
|
||||
|
||||
## Finaliser l'installation
|
||||
|
||||
|
||||
+7
-7
@@ -22,22 +22,23 @@ from eboutic.models import Basket, BasketItem, Invoice, InvoiceItem
|
||||
class BasketAdmin(admin.ModelAdmin):
|
||||
list_display = ("user", "date", "total")
|
||||
autocomplete_fields = ("user",)
|
||||
date_hierarchy = "date"
|
||||
|
||||
def get_queryset(self, request):
|
||||
return (
|
||||
super()
|
||||
.get_queryset(request)
|
||||
.annotate(
|
||||
total=Sum(F("items__quantity") * F("items__unit_price"), default=0)
|
||||
total=Sum(
|
||||
F("items__quantity") * F("items__product_unit_price"), default=0
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@admin.register(BasketItem)
|
||||
class BasketItemAdmin(admin.ModelAdmin):
|
||||
list_display = ("label", "unit_price", "quantity")
|
||||
search_fields = ("label",)
|
||||
list_display = ("basket", "product_name", "product_unit_price", "quantity")
|
||||
search_fields = ("product_name",)
|
||||
|
||||
|
||||
@admin.register(Invoice)
|
||||
@@ -49,6 +50,5 @@ class InvoiceAdmin(admin.ModelAdmin):
|
||||
|
||||
@admin.register(InvoiceItem)
|
||||
class InvoiceItemAdmin(admin.ModelAdmin):
|
||||
list_display = ("label", "unit_price", "quantity")
|
||||
search_fields = ("label",)
|
||||
list_select_related = ("price",)
|
||||
list_display = ("invoice", "product_name", "product_unit_price", "quantity")
|
||||
search_fields = ("product_name",)
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
# Generated by Django 5.2.11 on 2026-02-22 18:13
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [("counter", "0039_price"), ("eboutic", "0002_auto_20221005_2243")]
|
||||
|
||||
operations = [
|
||||
migrations.RenameField(
|
||||
model_name="basketitem", old_name="product_name", new_name="label"
|
||||
),
|
||||
migrations.RenameField(
|
||||
model_name="basketitem",
|
||||
old_name="product_unit_price",
|
||||
new_name="unit_price",
|
||||
),
|
||||
migrations.RenameField(
|
||||
model_name="basketitem", old_name="product_id", new_name="product"
|
||||
),
|
||||
migrations.RenameField(
|
||||
model_name="invoiceitem", old_name="product_name", new_name="label"
|
||||
),
|
||||
migrations.RenameField(
|
||||
model_name="invoiceitem",
|
||||
old_name="product_unit_price",
|
||||
new_name="unit_price",
|
||||
),
|
||||
migrations.RenameField(
|
||||
model_name="invoiceitem", old_name="product_id", new_name="product"
|
||||
),
|
||||
migrations.RemoveField(model_name="basketitem", name="type_id"),
|
||||
migrations.RemoveField(model_name="invoiceitem", name="type_id"),
|
||||
migrations.AlterField(
|
||||
model_name="basketitem",
|
||||
name="product",
|
||||
field=models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.PROTECT,
|
||||
to="counter.product",
|
||||
verbose_name="product",
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="invoiceitem",
|
||||
name="product",
|
||||
field=models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.PROTECT,
|
||||
to="counter.product",
|
||||
verbose_name="product",
|
||||
),
|
||||
),
|
||||
]
|
||||
+90
-49
@@ -17,7 +17,7 @@ from __future__ import annotations
|
||||
import hmac
|
||||
from datetime import datetime
|
||||
from enum import Enum
|
||||
from typing import Self
|
||||
from typing import Any, Self
|
||||
|
||||
from dict2xml import dict2xml
|
||||
from django.conf import settings
|
||||
@@ -30,8 +30,8 @@ from core.models import User
|
||||
from counter.fields import CurrencyField
|
||||
from counter.models import (
|
||||
BillingInfo,
|
||||
Counter,
|
||||
Customer,
|
||||
Price,
|
||||
Product,
|
||||
Refilling,
|
||||
Selling,
|
||||
@@ -39,6 +39,22 @@ from counter.models import (
|
||||
)
|
||||
|
||||
|
||||
def get_eboutic_products(user: User) -> list[Product]:
|
||||
products = (
|
||||
get_eboutic()
|
||||
.products.filter(product_type__isnull=False)
|
||||
.filter(archived=False, limit_age__lte=user.age)
|
||||
.annotate(
|
||||
order=F("product_type__order"),
|
||||
category=F("product_type__name"),
|
||||
category_comment=F("product_type__comment"),
|
||||
price=F("selling_price"), # <-- selected price for basket validation
|
||||
)
|
||||
.prefetch_related("buying_groups") # <-- used in `Product.can_be_sold_to`
|
||||
)
|
||||
return [p for p in products if p.can_be_sold_to(user)]
|
||||
|
||||
|
||||
class BillingInfoState(Enum):
|
||||
VALID = 1
|
||||
EMPTY = 2
|
||||
@@ -78,21 +94,21 @@ class Basket(models.Model):
|
||||
def __str__(self):
|
||||
return f"{self.user}'s basket ({self.items.all().count()} items)"
|
||||
|
||||
def can_be_viewed_by(self, user: User):
|
||||
def can_be_viewed_by(self, user):
|
||||
return self.user == user
|
||||
|
||||
@cached_property
|
||||
def contains_refilling_item(self) -> bool:
|
||||
return self.items.filter(
|
||||
product__product_type_id=settings.SITH_COUNTER_PRODUCTTYPE_REFILLING
|
||||
type_id=settings.SITH_COUNTER_PRODUCTTYPE_REFILLING
|
||||
).exists()
|
||||
|
||||
@cached_property
|
||||
def total(self) -> float:
|
||||
return float(
|
||||
self.items.aggregate(total=Sum(F("quantity") * F("unit_price"), default=0))[
|
||||
"total"
|
||||
]
|
||||
self.items.aggregate(
|
||||
total=Sum(F("quantity") * F("product_unit_price"), default=0)
|
||||
)["total"]
|
||||
)
|
||||
|
||||
def generate_sales(
|
||||
@@ -104,8 +120,7 @@ class Basket(models.Model):
|
||||
Example:
|
||||
```python
|
||||
counter = Counter.objects.get(name="Eboutic")
|
||||
user = User.objects.get(username="bibou")
|
||||
sales = basket.generate_sales(counter, user, Selling.PaymentMethod.SITH_ACCOUNT)
|
||||
sales = basket.generate_sales(counter, "SITH_ACCOUNT")
|
||||
# here the basket is in the same state as before the method call
|
||||
|
||||
with transaction.atomic():
|
||||
@@ -116,23 +131,31 @@ class Basket(models.Model):
|
||||
# thus only the sales remain
|
||||
```
|
||||
"""
|
||||
customer = Customer.get_or_create(self.user)[0]
|
||||
return [
|
||||
# I must proceed with two distinct requests instead of
|
||||
# only one with a join because the AbstractBaseItem model has been
|
||||
# poorly designed. If you refactor the model, please refactor this too.
|
||||
items = self.items.order_by("product_id")
|
||||
ids = [item.product_id for item in items]
|
||||
products = Product.objects.filter(id__in=ids).order_by("id")
|
||||
# items and products are sorted in the same order
|
||||
sales = []
|
||||
for item, product in zip(items, products, strict=False):
|
||||
sales.append(
|
||||
Selling(
|
||||
label=item.label,
|
||||
label=product.name,
|
||||
counter=counter,
|
||||
club_id=item.product.club_id,
|
||||
product=item.product,
|
||||
club=product.club,
|
||||
product=product,
|
||||
seller=seller,
|
||||
customer=customer,
|
||||
unit_price=item.unit_price,
|
||||
customer=Customer.get_or_create(self.user)[0],
|
||||
unit_price=item.product_unit_price,
|
||||
quantity=item.quantity,
|
||||
payment_method=payment_method,
|
||||
)
|
||||
for item in self.items.select_related("product")
|
||||
]
|
||||
)
|
||||
return sales
|
||||
|
||||
def get_e_transaction_data(self) -> list[tuple[str, str]]:
|
||||
def get_e_transaction_data(self) -> list[tuple[str, Any]]:
|
||||
user = self.user
|
||||
if not hasattr(user, "customer"):
|
||||
raise Customer.DoesNotExist
|
||||
@@ -178,7 +201,7 @@ class InvoiceQueryset(models.QuerySet):
|
||||
def annotate_total(self) -> Self:
|
||||
"""Annotate the queryset with the total amount of each invoice.
|
||||
|
||||
The total amount is the sum of (unit_price * quantity)
|
||||
The total amount is the sum of (product_unit_price * quantity)
|
||||
for all items related to the invoice.
|
||||
"""
|
||||
# aggregates within subqueries require a little bit of black magic,
|
||||
@@ -188,7 +211,7 @@ class InvoiceQueryset(models.QuerySet):
|
||||
total=Subquery(
|
||||
InvoiceItem.objects.filter(invoice_id=OuterRef("pk"))
|
||||
.values("invoice_id")
|
||||
.annotate(total=Sum(F("unit_price") * F("quantity")))
|
||||
.annotate(total=Sum(F("product_unit_price") * F("quantity")))
|
||||
.values("total")
|
||||
)
|
||||
)
|
||||
@@ -198,7 +221,11 @@ class Invoice(models.Model):
|
||||
"""Invoices are generated once the payment has been validated."""
|
||||
|
||||
user = models.ForeignKey(
|
||||
User, related_name="invoices", verbose_name=_("user"), on_delete=models.CASCADE
|
||||
User,
|
||||
related_name="invoices",
|
||||
verbose_name=_("user"),
|
||||
blank=False,
|
||||
on_delete=models.CASCADE,
|
||||
)
|
||||
date = models.DateTimeField(_("date"), auto_now=True)
|
||||
validated = models.BooleanField(_("validated"), default=False)
|
||||
@@ -219,44 +246,53 @@ class Invoice(models.Model):
|
||||
if self.validated:
|
||||
raise DataError(_("Invoice already validated"))
|
||||
customer, _created = Customer.get_or_create(user=self.user)
|
||||
kwargs = {
|
||||
"counter": get_eboutic(),
|
||||
"customer": customer,
|
||||
"date": self.date,
|
||||
"payment_method": Selling.PaymentMethod.CARD,
|
||||
}
|
||||
for i in self.items.select_related("product"):
|
||||
if i.product.product_type_id == settings.SITH_COUNTER_PRODUCTTYPE_REFILLING:
|
||||
Refilling.objects.create(
|
||||
**kwargs, operator=self.user, amount=i.unit_price * i.quantity
|
||||
eboutic = Counter.objects.filter(type="EBOUTIC").first()
|
||||
for i in self.items.all():
|
||||
if i.type_id == settings.SITH_COUNTER_PRODUCTTYPE_REFILLING:
|
||||
new = Refilling(
|
||||
counter=eboutic,
|
||||
customer=customer,
|
||||
operator=self.user,
|
||||
amount=i.product_unit_price * i.quantity,
|
||||
payment_method=Refilling.PaymentMethod.CARD,
|
||||
date=self.date,
|
||||
)
|
||||
new.save()
|
||||
else:
|
||||
Selling.objects.create(
|
||||
**kwargs,
|
||||
label=i.label,
|
||||
club_id=i.product.club_id,
|
||||
product=i.product,
|
||||
product = Product.objects.filter(id=i.product_id).first()
|
||||
new = Selling(
|
||||
label=i.product_name,
|
||||
counter=eboutic,
|
||||
club=product.club,
|
||||
product=product,
|
||||
seller=self.user,
|
||||
unit_price=i.unit_price,
|
||||
customer=customer,
|
||||
unit_price=i.product_unit_price,
|
||||
quantity=i.quantity,
|
||||
payment_method=Selling.PaymentMethod.CARD,
|
||||
date=self.date,
|
||||
)
|
||||
new.save()
|
||||
self.validated = True
|
||||
self.save()
|
||||
|
||||
|
||||
class AbstractBaseItem(models.Model):
|
||||
product = models.ForeignKey(
|
||||
Product, verbose_name=_("product"), on_delete=models.PROTECT
|
||||
)
|
||||
label = models.CharField(_("product name"), max_length=255)
|
||||
unit_price = CurrencyField(_("unit price"))
|
||||
product_id = models.IntegerField(_("product id"))
|
||||
product_name = models.CharField(_("product name"), max_length=255)
|
||||
type_id = models.IntegerField(_("product type id"))
|
||||
product_unit_price = CurrencyField(_("unit price"))
|
||||
quantity = models.PositiveIntegerField(_("quantity"))
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
def __str__(self):
|
||||
return "Item: %s (%s) x%d" % (self.product.name, self.unit_price, self.quantity)
|
||||
return "Item: %s (%s) x%d" % (
|
||||
self.product_name,
|
||||
self.product_unit_price,
|
||||
self.quantity,
|
||||
)
|
||||
|
||||
|
||||
class BasketItem(AbstractBaseItem):
|
||||
@@ -265,16 +301,21 @@ class BasketItem(AbstractBaseItem):
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def from_price(cls, price: Price, quantity: int, basket: Basket):
|
||||
def from_product(cls, product: Product, quantity: int, basket: Basket):
|
||||
"""Create a BasketItem with the same characteristics as the
|
||||
product price passed in parameters, with the specified quantity.
|
||||
product passed in parameters, with the specified quantity.
|
||||
|
||||
Warning:
|
||||
the basket field is not filled, so you must set
|
||||
it yourself before saving the model.
|
||||
"""
|
||||
return cls(
|
||||
basket=basket,
|
||||
label=price.full_label,
|
||||
product_id=price.product_id,
|
||||
product_id=product.id,
|
||||
product_name=product.name,
|
||||
type_id=product.product_type_id,
|
||||
quantity=quantity,
|
||||
unit_price=price.amount,
|
||||
product_unit_price=product.selling_price,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
export {};
|
||||
|
||||
interface BasketItem {
|
||||
priceId: number;
|
||||
id: number;
|
||||
name: string;
|
||||
quantity: number;
|
||||
unitPrice: number;
|
||||
// biome-ignore lint/style/useNamingConvention: the python code is snake_case
|
||||
unit_price: number;
|
||||
}
|
||||
|
||||
// increment the key number if the data schema of the cached basket changes
|
||||
const BASKET_CACHE_KEY = "basket1";
|
||||
|
||||
document.addEventListener("alpine:init", () => {
|
||||
Alpine.data("basket", (lastPurchaseTime?: number) => ({
|
||||
basket: [] as BasketItem[],
|
||||
@@ -32,24 +30,24 @@ document.addEventListener("alpine:init", () => {
|
||||
// It's quite tricky to manually apply attributes to the management part
|
||||
// of a formset so we dynamically apply it here
|
||||
this.$refs.basketManagementForm
|
||||
.getElementById("#id_form-TOTAL_FORMS")
|
||||
.querySelector("#id_form-TOTAL_FORMS")
|
||||
.setAttribute(":value", "basket.length");
|
||||
},
|
||||
|
||||
loadBasket(): BasketItem[] {
|
||||
if (localStorage.getItem(BASKET_CACHE_KEY) === null) {
|
||||
if (localStorage.basket === undefined) {
|
||||
return [];
|
||||
}
|
||||
try {
|
||||
return JSON.parse(localStorage.getItem(BASKET_CACHE_KEY));
|
||||
return JSON.parse(localStorage.basket);
|
||||
} catch (_err) {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
|
||||
saveBasket() {
|
||||
localStorage.setItem(BASKET_CACHE_KEY, JSON.stringify(this.basket));
|
||||
localStorage.setItem("basketTimestamp", Date.now().toString());
|
||||
localStorage.basket = JSON.stringify(this.basket);
|
||||
localStorage.basketTimestamp = Date.now();
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -58,7 +56,7 @@ document.addEventListener("alpine:init", () => {
|
||||
*/
|
||||
getTotal() {
|
||||
return this.basket.reduce(
|
||||
(acc: number, item: BasketItem) => acc + item.quantity * item.unitPrice,
|
||||
(acc: number, item: BasketItem) => acc + item.quantity * item.unit_price,
|
||||
0,
|
||||
);
|
||||
},
|
||||
@@ -76,7 +74,7 @@ document.addEventListener("alpine:init", () => {
|
||||
* @param itemId the id of the item to remove
|
||||
*/
|
||||
remove(itemId: number) {
|
||||
const index = this.basket.findIndex((e: BasketItem) => e.priceId === itemId);
|
||||
const index = this.basket.findIndex((e: BasketItem) => e.id === itemId);
|
||||
|
||||
if (index < 0) {
|
||||
return;
|
||||
@@ -85,7 +83,7 @@ document.addEventListener("alpine:init", () => {
|
||||
|
||||
if (this.basket[index].quantity === 0) {
|
||||
this.basket = this.basket.filter(
|
||||
(e: BasketItem) => e.priceId !== this.basket[index].id,
|
||||
(e: BasketItem) => e.id !== this.basket[index].id,
|
||||
);
|
||||
}
|
||||
},
|
||||
@@ -106,10 +104,11 @@ document.addEventListener("alpine:init", () => {
|
||||
*/
|
||||
createItem(id: number, name: string, price: number): BasketItem {
|
||||
const newItem = {
|
||||
priceId: id,
|
||||
id,
|
||||
name,
|
||||
quantity: 0,
|
||||
unitPrice: price,
|
||||
// biome-ignore lint/style/useNamingConvention: the python code is snake_case
|
||||
unit_price: price,
|
||||
} as BasketItem;
|
||||
|
||||
this.basket.push(newItem);
|
||||
@@ -126,7 +125,7 @@ document.addEventListener("alpine:init", () => {
|
||||
* @param price The unit price of the product
|
||||
*/
|
||||
addFromCatalog(id: number, name: string, price: number) {
|
||||
let item = this.basket.find((e: BasketItem) => e.priceId === id);
|
||||
let item = this.basket.find((e: BasketItem) => e.id === id);
|
||||
|
||||
// if the item is not in the basket, we create it
|
||||
// else we add + 1 to it
|
||||
|
||||
@@ -32,9 +32,9 @@
|
||||
<tbody>
|
||||
{% for item in basket.items.all() %}
|
||||
<tr>
|
||||
<td>{{ item.label }}</td>
|
||||
<td>{{ item.product_name }}</td>
|
||||
<td>{{ item.quantity }}</td>
|
||||
<td>{{ item.unit_price }} €</td>
|
||||
<td>{{ item.product_unit_price }} €</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
||||
@@ -51,15 +51,15 @@
|
||||
</span>
|
||||
</li>
|
||||
|
||||
<template x-for="(item, index) in Object.values(basket)" :key="item.priceId">
|
||||
<template x-for="(item, index) in Object.values(basket)" :key="item.id">
|
||||
<li class="item-row" x-show="item.quantity > 0">
|
||||
<div class="item-quantity">
|
||||
<i class="fa fa-minus fa-xs" @click="remove(item.priceId)"></i>
|
||||
<i class="fa fa-minus fa-xs" @click="remove(item.id)"></i>
|
||||
<span x-text="item.quantity"></span>
|
||||
<i class="fa fa-plus" @click="add(item)"></i>
|
||||
</div>
|
||||
<span class="item-name" x-text="item.name"></span>
|
||||
<span class="item-price" x-text="(item.unitPrice * item.quantity).toFixed(2) + ' €'"></span>
|
||||
<span class="item-price" x-text="(item.unit_price * item.quantity).toFixed(2) + ' €'"></span>
|
||||
|
||||
<input
|
||||
type="hidden"
|
||||
@@ -71,9 +71,9 @@
|
||||
>
|
||||
<input
|
||||
type="hidden"
|
||||
:value="item.priceId"
|
||||
:id="`id_form-${index}-price_id`"
|
||||
:name="`form-${index}-price_id`"
|
||||
:value="item.id"
|
||||
:id="`id_form-${index}-id`"
|
||||
:name="`form-${index}-id`"
|
||||
required
|
||||
readonly
|
||||
>
|
||||
@@ -166,40 +166,45 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
</section>
|
||||
{% for prices in categories %}
|
||||
{% set category = prices[0].product.product_type %}
|
||||
{% for priority_groups in products|groupby('order') %}
|
||||
{% for category, items in priority_groups.list|groupby('category') %}
|
||||
{% if items|count > 0 %}
|
||||
<section>
|
||||
{# I would have wholeheartedly directly used the header element instead
|
||||
but it has already been made messy in core/style.scss #}
|
||||
<div class="category-header">
|
||||
<h3>{{ category.name }}</h3>
|
||||
{% if category.comment %}
|
||||
<p><i>{{ category.comment }}</i></p>
|
||||
<h3>{{ category }}</h3>
|
||||
{% if items[0].category_comment %}
|
||||
<p><i>{{ items[0].category_comment }}</i></p>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="product-group">
|
||||
{% for price in prices %}
|
||||
{% for p in items %}
|
||||
<button
|
||||
id="{{ price.id }}"
|
||||
id="{{ p.id }}"
|
||||
class="card product-button clickable shadow"
|
||||
:class="{selected: basket.some((i) => i.priceId === {{ price.id }})}"
|
||||
@click='addFromCatalog({{ price.id }}, {{ price.full_label|tojson }}, {{ price.amount }})'
|
||||
:class="{selected: basket.some((i) => i.id === {{ p.id }})}"
|
||||
@click='addFromCatalog({{ p.id }}, {{ p.name|tojson }}, {{ p.selling_price }})'
|
||||
>
|
||||
{% if price.product.icon %}
|
||||
{% if p.icon %}
|
||||
<img
|
||||
class="card-image"
|
||||
src="{{ price.product.icon.url }}"
|
||||
alt="image de {{ price.full_label }}"
|
||||
src="{{ p.icon.url }}"
|
||||
alt="image de {{ p.name }}"
|
||||
>
|
||||
{% else %}
|
||||
<i class="fa-regular fa-image fa-2x card-image"></i>
|
||||
{% endif %}
|
||||
<div class="card-content">
|
||||
<h4 class="card-title">{{ price.full_label }}</h4>
|
||||
<p>{{ price.amount }} €</p>
|
||||
<h4 class="card-title">{{ p.name }}</h4>
|
||||
<p>{{ p.selling_price }} €</p>
|
||||
</div>
|
||||
</button>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</section>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<p>{% trans %}There are no items available for sale{% endtrans %}</p>
|
||||
{% endfor %}
|
||||
|
||||
@@ -11,12 +11,7 @@ from pytest_django.asserts import assertRedirects
|
||||
|
||||
from core.baker_recipes import subscriber_user
|
||||
from core.models import Group, User
|
||||
from counter.baker_recipes import (
|
||||
price_recipe,
|
||||
product_recipe,
|
||||
refill_recipe,
|
||||
sale_recipe,
|
||||
)
|
||||
from counter.baker_recipes import product_recipe, refill_recipe, sale_recipe
|
||||
from counter.models import (
|
||||
Counter,
|
||||
Customer,
|
||||
@@ -152,29 +147,29 @@ class TestEboutic(TestCase):
|
||||
|
||||
product_type = baker.make(ProductType)
|
||||
|
||||
cls.snack = price_recipe.make(
|
||||
amount=1.5, product=product_recipe.make(product_type=product_type)
|
||||
cls.snack = product_recipe.make(
|
||||
selling_price=1.5, special_selling_price=1, product_type=product_type
|
||||
)
|
||||
cls.beer = price_recipe.make(
|
||||
product=product_recipe.make(limit_age=18, product_type=product_type),
|
||||
amount=2.5,
|
||||
cls.beer = product_recipe.make(
|
||||
limit_age=18,
|
||||
selling_price=2.5,
|
||||
special_selling_price=1,
|
||||
product_type=product_type,
|
||||
)
|
||||
cls.not_in_counter = price_recipe.make(
|
||||
product=product_recipe.make(product_type=product_type), amount=3.5
|
||||
)
|
||||
cls.cotiz = price_recipe.make(
|
||||
amount=10, product=product_recipe.make(product_type=product_type)
|
||||
cls.not_in_counter = product_recipe.make(
|
||||
selling_price=3.5, product_type=product_type
|
||||
)
|
||||
cls.cotiz = product_recipe.make(selling_price=10, product_type=product_type)
|
||||
|
||||
cls.group_public.prices.add(cls.snack, cls.beer, cls.not_in_counter)
|
||||
cls.group_cotiz.prices.add(cls.cotiz)
|
||||
cls.group_public.products.add(cls.snack, cls.beer, cls.not_in_counter)
|
||||
cls.group_cotiz.products.add(cls.cotiz)
|
||||
|
||||
cls.subscriber.groups.add(cls.group_cotiz, cls.group_public)
|
||||
cls.new_customer.groups.add(cls.group_public)
|
||||
cls.new_customer_adult.groups.add(cls.group_public)
|
||||
|
||||
cls.eboutic = get_eboutic()
|
||||
cls.eboutic.products.add(cls.cotiz.product, cls.beer.product, cls.snack.product)
|
||||
cls.eboutic.products.add(cls.cotiz, cls.beer, cls.snack)
|
||||
|
||||
@classmethod
|
||||
def set_age(cls, user: User, age: int):
|
||||
@@ -258,7 +253,7 @@ class TestEboutic(TestCase):
|
||||
self.submit_basket([BasketItem(self.snack.id, 2)]),
|
||||
reverse("eboutic:checkout", kwargs={"basket_id": 1}),
|
||||
)
|
||||
assert Basket.objects.get(id=1).total == self.snack.amount * 2
|
||||
assert Basket.objects.get(id=1).total == self.snack.selling_price * 2
|
||||
|
||||
self.client.force_login(self.new_customer_adult)
|
||||
assertRedirects(
|
||||
@@ -268,7 +263,8 @@ class TestEboutic(TestCase):
|
||||
reverse("eboutic:checkout", kwargs={"basket_id": 2}),
|
||||
)
|
||||
assert (
|
||||
Basket.objects.get(id=2).total == self.snack.amount * 2 + self.beer.amount
|
||||
Basket.objects.get(id=2).total
|
||||
== self.snack.selling_price * 2 + self.beer.selling_price
|
||||
)
|
||||
|
||||
self.client.force_login(self.subscriber)
|
||||
@@ -284,5 +280,7 @@ class TestEboutic(TestCase):
|
||||
)
|
||||
assert (
|
||||
Basket.objects.get(id=3).total
|
||||
== self.snack.amount * 2 + self.beer.amount + self.cotiz.amount
|
||||
== self.snack.selling_price * 2
|
||||
+ self.beer.selling_price
|
||||
+ self.cotiz.selling_price
|
||||
)
|
||||
|
||||
@@ -16,7 +16,7 @@ from model_bakery import baker
|
||||
from pytest_django.asserts import assertRedirects
|
||||
|
||||
from core.baker_recipes import old_subscriber_user, subscriber_user
|
||||
from counter.baker_recipes import price_recipe, product_recipe
|
||||
from counter.baker_recipes import product_recipe
|
||||
from counter.models import Product, ProductType, Selling
|
||||
from counter.tests.test_counter import force_refill_user
|
||||
from eboutic.models import Basket, BasketItem
|
||||
@@ -32,22 +32,23 @@ class TestPaymentBase(TestCase):
|
||||
cls.basket = baker.make(Basket, user=cls.customer)
|
||||
cls.refilling = product_recipe.make(
|
||||
product_type_id=settings.SITH_COUNTER_PRODUCTTYPE_REFILLING,
|
||||
prices=[price_recipe.make(amount=15)],
|
||||
selling_price=15,
|
||||
)
|
||||
|
||||
product_type = baker.make(ProductType)
|
||||
|
||||
cls.snack = product_recipe.make(
|
||||
product_type=product_type, prices=[price_recipe.make(amount=1.5)]
|
||||
selling_price=1.5, special_selling_price=1, product_type=product_type
|
||||
)
|
||||
cls.beer = product_recipe.make(
|
||||
limit_age=18,
|
||||
selling_price=2.5,
|
||||
special_selling_price=1,
|
||||
product_type=product_type,
|
||||
prices=[price_recipe.make(amount=2.5)],
|
||||
)
|
||||
|
||||
BasketItem.from_price(cls.snack.prices.first(), 1, cls.basket).save()
|
||||
BasketItem.from_price(cls.beer.prices.first(), 2, cls.basket).save()
|
||||
BasketItem.from_product(cls.snack, 1, cls.basket).save()
|
||||
BasketItem.from_product(cls.beer, 2, cls.basket).save()
|
||||
|
||||
|
||||
class TestPaymentSith(TestPaymentBase):
|
||||
@@ -115,13 +116,13 @@ class TestPaymentSith(TestPaymentBase):
|
||||
assert len(sellings) == 2
|
||||
assert sellings[0].payment_method == Selling.PaymentMethod.SITH_ACCOUNT
|
||||
assert sellings[0].quantity == 1
|
||||
assert sellings[0].unit_price == self.snack.prices.first().amount
|
||||
assert sellings[0].unit_price == self.snack.selling_price
|
||||
assert sellings[0].counter.type == "EBOUTIC"
|
||||
assert sellings[0].product == self.snack
|
||||
|
||||
assert sellings[1].payment_method == Selling.PaymentMethod.SITH_ACCOUNT
|
||||
assert sellings[1].quantity == 2
|
||||
assert sellings[1].unit_price == self.beer.prices.first().amount
|
||||
assert sellings[1].unit_price == self.beer.selling_price
|
||||
assert sellings[1].counter.type == "EBOUTIC"
|
||||
assert sellings[1].product == self.beer
|
||||
|
||||
@@ -145,7 +146,7 @@ class TestPaymentSith(TestPaymentBase):
|
||||
)
|
||||
|
||||
def test_refilling_in_basket(self):
|
||||
BasketItem.from_price(self.refilling.prices.first(), 1, self.basket).save()
|
||||
BasketItem.from_product(self.refilling, 1, self.basket).save()
|
||||
self.client.force_login(self.customer)
|
||||
force_refill_user(self.customer, self.basket.total + 1)
|
||||
self.customer.customer.refresh_from_db()
|
||||
@@ -190,8 +191,8 @@ class TestPaymentCard(TestPaymentBase):
|
||||
def test_buy_success(self):
|
||||
response = self.client.get(self.generate_bank_valid_answer(self.basket))
|
||||
assert response.status_code == 200
|
||||
assert response.content.decode() == "Payment successful"
|
||||
assert not Basket.objects.filter(id=self.basket.id).exists()
|
||||
assert response.content.decode("utf-8") == "Payment successful"
|
||||
assert Basket.objects.filter(id=self.basket.id).first() is None
|
||||
|
||||
sellings = Selling.objects.filter(customer=self.customer.customer).order_by(
|
||||
"quantity"
|
||||
@@ -199,13 +200,13 @@ class TestPaymentCard(TestPaymentBase):
|
||||
assert len(sellings) == 2
|
||||
assert sellings[0].payment_method == Selling.PaymentMethod.CARD
|
||||
assert sellings[0].quantity == 1
|
||||
assert sellings[0].unit_price == self.snack.prices.first().amount
|
||||
assert sellings[0].unit_price == self.snack.selling_price
|
||||
assert sellings[0].counter.type == "EBOUTIC"
|
||||
assert sellings[0].product == self.snack
|
||||
|
||||
assert sellings[1].payment_method == Selling.PaymentMethod.CARD
|
||||
assert sellings[1].quantity == 2
|
||||
assert sellings[1].unit_price == self.beer.prices.first().amount
|
||||
assert sellings[1].unit_price == self.beer.selling_price
|
||||
assert sellings[1].counter.type == "EBOUTIC"
|
||||
assert sellings[1].product == self.beer
|
||||
|
||||
@@ -215,9 +216,7 @@ class TestPaymentCard(TestPaymentBase):
|
||||
assert not customer.subscriptions.first().is_valid_now()
|
||||
|
||||
basket = baker.make(Basket, user=customer)
|
||||
BasketItem.from_price(
|
||||
Product.objects.get(code="2SCOTIZ").prices.first(), 1, basket
|
||||
).save()
|
||||
BasketItem.from_product(Product.objects.get(code="2SCOTIZ"), 1, basket).save()
|
||||
response = self.client.get(self.generate_bank_valid_answer(basket))
|
||||
assert response.status_code == 200
|
||||
|
||||
@@ -229,13 +228,12 @@ class TestPaymentCard(TestPaymentBase):
|
||||
assert subscription.location == "EBOUTIC"
|
||||
|
||||
def test_buy_refilling(self):
|
||||
price = self.refilling.prices.first()
|
||||
BasketItem.from_price(price, 2, self.basket).save()
|
||||
BasketItem.from_product(self.refilling, 2, self.basket).save()
|
||||
response = self.client.get(self.generate_bank_valid_answer(self.basket))
|
||||
assert response.status_code == 200
|
||||
|
||||
self.customer.customer.refresh_from_db()
|
||||
assert self.customer.customer.amount == price.amount * 2
|
||||
assert self.customer.customer.amount == self.refilling.selling_price * 2
|
||||
|
||||
def test_multiple_responses(self):
|
||||
bank_response = self.generate_bank_valid_answer(self.basket)
|
||||
@@ -255,17 +253,17 @@ class TestPaymentCard(TestPaymentBase):
|
||||
self.basket.delete()
|
||||
response = self.client.get(bank_response)
|
||||
assert response.status_code == 500
|
||||
assert response.text == (
|
||||
"Basket processing failed with error: "
|
||||
"SuspiciousOperation('Basket does not exists')"
|
||||
assert (
|
||||
response.text
|
||||
== "Basket processing failed with error: SuspiciousOperation('Basket does not exists')"
|
||||
)
|
||||
|
||||
def test_altered_basket(self):
|
||||
bank_response = self.generate_bank_valid_answer(self.basket)
|
||||
BasketItem.from_price(self.snack.prices.first(), 1, self.basket).save()
|
||||
BasketItem.from_product(self.snack, 1, self.basket).save()
|
||||
response = self.client.get(bank_response)
|
||||
assert response.status_code == 500
|
||||
assert response.text == (
|
||||
"Basket processing failed with error: "
|
||||
assert (
|
||||
response.text == "Basket processing failed with error: "
|
||||
"SuspiciousOperation('Basket total and amount do not match')"
|
||||
)
|
||||
|
||||
+40
-40
@@ -17,7 +17,6 @@ from __future__ import annotations
|
||||
|
||||
import base64
|
||||
import contextlib
|
||||
import itertools
|
||||
import json
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
@@ -29,7 +28,9 @@ from cryptography.hazmat.primitives.serialization import load_pem_public_key
|
||||
from django.conf import settings
|
||||
from django.contrib import messages
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
from django.contrib.auth.mixins import (
|
||||
LoginRequiredMixin,
|
||||
)
|
||||
from django.contrib.messages.views import SuccessMessageMixin
|
||||
from django.core.exceptions import SuspiciousOperation, ValidationError
|
||||
from django.db import DatabaseError, transaction
|
||||
@@ -47,16 +48,23 @@ from django_countries.fields import Country
|
||||
|
||||
from core.auth.mixins import CanViewMixin, IsSubscriberMixin
|
||||
from core.views.mixins import FragmentMixin, UseFragmentsMixin
|
||||
from counter.forms import BaseBasketForm, BasketItemForm, BillingInfoForm
|
||||
from counter.forms import BaseBasketForm, BasketProductForm, BillingInfoForm
|
||||
from counter.models import (
|
||||
BillingInfo,
|
||||
Customer,
|
||||
Price,
|
||||
Product,
|
||||
Refilling,
|
||||
Selling,
|
||||
get_eboutic,
|
||||
)
|
||||
from eboutic.models import Basket, BasketItem, BillingInfoState, Invoice, InvoiceItem
|
||||
from eboutic.models import (
|
||||
Basket,
|
||||
BasketItem,
|
||||
BillingInfoState,
|
||||
Invoice,
|
||||
InvoiceItem,
|
||||
get_eboutic_products,
|
||||
)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from cryptography.hazmat.primitives.asymmetric.rsa import RSAPublicKey
|
||||
@@ -70,7 +78,7 @@ class BaseEbouticBasketForm(BaseBasketForm):
|
||||
|
||||
|
||||
EbouticBasketForm = forms.formset_factory(
|
||||
BasketItemForm, formset=BaseEbouticBasketForm, absolute_max=None, min_num=1
|
||||
BasketProductForm, formset=BaseEbouticBasketForm, absolute_max=None, min_num=1
|
||||
)
|
||||
|
||||
|
||||
@@ -80,6 +88,7 @@ class EbouticMainView(LoginRequiredMixin, FormView):
|
||||
The purchasable products are those of the eboutic which
|
||||
belong to a category of products of a product category
|
||||
(orphan products are inaccessible).
|
||||
|
||||
"""
|
||||
|
||||
template_name = "eboutic/eboutic_main.jinja"
|
||||
@@ -90,7 +99,7 @@ class EbouticMainView(LoginRequiredMixin, FormView):
|
||||
kwargs["form_kwargs"] = {
|
||||
"customer": self.customer,
|
||||
"counter": get_eboutic(),
|
||||
"allowed_prices": {price.id: price for price in self.prices},
|
||||
"allowed_products": {product.id: product for product in self.products},
|
||||
}
|
||||
return kwargs
|
||||
|
||||
@@ -101,25 +110,19 @@ class EbouticMainView(LoginRequiredMixin, FormView):
|
||||
|
||||
with transaction.atomic():
|
||||
self.basket = Basket.objects.create(user=self.request.user)
|
||||
BasketItem.objects.bulk_create(
|
||||
[
|
||||
BasketItem.from_price(
|
||||
form.price, form.cleaned_data["quantity"], self.basket
|
||||
)
|
||||
for form in formset
|
||||
]
|
||||
)
|
||||
for form in formset:
|
||||
BasketItem.from_product(
|
||||
form.product, form.cleaned_data["quantity"], self.basket
|
||||
).save()
|
||||
self.basket.save()
|
||||
return super().form_valid(formset)
|
||||
|
||||
def get_success_url(self):
|
||||
return reverse("eboutic:checkout", kwargs={"basket_id": self.basket.id})
|
||||
|
||||
@cached_property
|
||||
def prices(self) -> list[Price]:
|
||||
return get_eboutic().get_prices_for(
|
||||
self.customer,
|
||||
order_by=["product__product_type__order", "product_id", "amount"],
|
||||
)
|
||||
def products(self) -> list[Product]:
|
||||
return get_eboutic_products(self.request.user)
|
||||
|
||||
@cached_property
|
||||
def customer(self) -> Customer:
|
||||
@@ -127,12 +130,7 @@ class EbouticMainView(LoginRequiredMixin, FormView):
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
context["categories"] = [
|
||||
list(i[1])
|
||||
for i in itertools.groupby(
|
||||
self.prices, key=lambda p: p.product.product_type_id
|
||||
)
|
||||
]
|
||||
context["products"] = self.products
|
||||
context["customer_amount"] = self.request.user.account_balance
|
||||
|
||||
purchases = (
|
||||
@@ -269,8 +267,11 @@ class EbouticPayWithSith(CanViewMixin, SingleObjectMixin, View):
|
||||
def post(self, request, *args, **kwargs):
|
||||
basket = self.get_object()
|
||||
refilling = settings.SITH_COUNTER_PRODUCTTYPE_REFILLING
|
||||
if basket.items.filter(product__product_type_id=refilling).exists():
|
||||
messages.error(self.request, _("You can't buy a refilling with sith money"))
|
||||
if basket.items.filter(type_id=refilling).exists():
|
||||
messages.error(
|
||||
self.request,
|
||||
_("You can't buy a refilling with sith money"),
|
||||
)
|
||||
return redirect("eboutic:payment_result", "failure")
|
||||
|
||||
eboutic = get_eboutic()
|
||||
@@ -325,23 +326,22 @@ class EtransactionAutoAnswer(View):
|
||||
raise SuspiciousOperation(
|
||||
"Basket total and amount do not match"
|
||||
)
|
||||
i = Invoice.objects.create(user=b.user)
|
||||
InvoiceItem.objects.bulk_create(
|
||||
[
|
||||
i = Invoice()
|
||||
i.user = b.user
|
||||
i.payment_method = "CARD"
|
||||
i.save()
|
||||
for it in b.items.all():
|
||||
InvoiceItem(
|
||||
invoice=i,
|
||||
product_id=item.product_id,
|
||||
label=item.label,
|
||||
unit_price=item.unit_price,
|
||||
quantity=item.quantity,
|
||||
)
|
||||
for item in b.items.all()
|
||||
]
|
||||
)
|
||||
product_id=it.product_id,
|
||||
product_name=it.product_name,
|
||||
type_id=it.type_id,
|
||||
product_unit_price=it.product_unit_price,
|
||||
quantity=it.quantity,
|
||||
).save()
|
||||
i.validate()
|
||||
b.delete()
|
||||
except Exception as e:
|
||||
sentry_sdk.capture_exception(e)
|
||||
return HttpResponse(
|
||||
"Basket processing failed with error: " + repr(e), status=500
|
||||
)
|
||||
|
||||
@@ -56,7 +56,7 @@ msgstr "nom"
|
||||
msgid "owner"
|
||||
msgstr "propriétaire"
|
||||
|
||||
#: api/models.py core/models.py counter/models.py
|
||||
#: api/models.py core/models.py
|
||||
msgid "groups"
|
||||
msgstr "groupes"
|
||||
|
||||
@@ -310,36 +310,16 @@ msgid "The list of all clubs existing at UTBM."
|
||||
msgstr "La liste de tous les clubs existants à l'UTBM"
|
||||
|
||||
#: club/templates/club/club_list.jinja
|
||||
msgid "Filters"
|
||||
msgstr "Filtres"
|
||||
|
||||
#: club/templates/club/club_list.jinja
|
||||
msgid "Name"
|
||||
msgstr "Nom"
|
||||
|
||||
#: club/templates/club/club_list.jinja
|
||||
msgid "Club state"
|
||||
msgstr "Etat du club"
|
||||
|
||||
#: club/templates/club/club_list.jinja
|
||||
msgid "Active"
|
||||
msgstr "Actif"
|
||||
|
||||
#: club/templates/club/club_list.jinja
|
||||
msgid "Inactive"
|
||||
msgstr "Inactif"
|
||||
|
||||
#: club/templates/club/club_list.jinja
|
||||
msgid "All clubs"
|
||||
msgstr "Tous les clubs"
|
||||
msgid "inactive"
|
||||
msgstr "inactif"
|
||||
|
||||
#: club/templates/club/club_list.jinja core/templates/core/user_tools.jinja
|
||||
msgid "New club"
|
||||
msgstr "Nouveau club"
|
||||
|
||||
#: club/templates/club/club_list.jinja
|
||||
msgid "inactive"
|
||||
msgstr "inactif"
|
||||
msgid "There is no club in this website."
|
||||
msgstr "Il n'y a pas de club dans ce site web."
|
||||
|
||||
#: club/templates/club/club_members.jinja
|
||||
msgid "Club members"
|
||||
@@ -1901,6 +1881,10 @@ msgstr "L'AE"
|
||||
msgid "AE's clubs"
|
||||
msgstr "Les clubs de L'AE"
|
||||
|
||||
#: core/templates/core/base/navbar.jinja
|
||||
msgid "Others UTBM's Associations"
|
||||
msgstr "Les autres associations de l'UTBM"
|
||||
|
||||
#: core/templates/core/base/navbar.jinja
|
||||
msgid "Big event"
|
||||
msgstr "Grandes Activités"
|
||||
@@ -3043,6 +3027,24 @@ msgstr ""
|
||||
"Décrivez le produit. Si c'est un click pour un évènement, donnez quelques "
|
||||
"détails dessus, comme la date (en incluant l'année)."
|
||||
|
||||
#: counter/forms.py
|
||||
#, python-format
|
||||
msgid ""
|
||||
"This product is a formula. Its price cannot be greater than the price of the "
|
||||
"products constituting it, which is %(price)s €"
|
||||
msgstr ""
|
||||
"Ce produit est une formule. Son prix ne peut pas être supérieur au prix des "
|
||||
"produits qui la constituent, soit %(price)s €."
|
||||
|
||||
#: counter/forms.py
|
||||
#, python-format
|
||||
msgid ""
|
||||
"This product is a formula. Its special price cannot be greater than the "
|
||||
"price of the products constituting it, which is %(price)s €"
|
||||
msgstr ""
|
||||
"Ce produit est une formule. Son prix spécial ne peut pas être supérieur au "
|
||||
"prix des produits qui la constituent, soit %(price)s €."
|
||||
|
||||
#: counter/forms.py
|
||||
msgid ""
|
||||
"The same product cannot be at the same time the result and a part of the "
|
||||
@@ -3051,13 +3053,19 @@ msgstr ""
|
||||
"Un même produit ne peut pas être à la fois le résultat et un élément de la "
|
||||
"formule."
|
||||
|
||||
#: counter/forms.py
|
||||
msgid ""
|
||||
"The result cannot be more expensive than the total of the other products."
|
||||
msgstr ""
|
||||
"Le résultat ne peut pas être plus cher que le total des autres produits."
|
||||
|
||||
#: counter/forms.py
|
||||
msgid "Refound this account"
|
||||
msgstr "Rembourser ce compte"
|
||||
|
||||
#: counter/forms.py
|
||||
msgid "The selected product isn't available for this user"
|
||||
msgstr "Le produit sélectionné n'est pas disponible pour cet utilisateur"
|
||||
msgstr "Le produit sélectionné n'est pas disponnible pour cet utilisateur"
|
||||
|
||||
#: counter/forms.py
|
||||
msgid "Submitted basket is invalid"
|
||||
@@ -3171,6 +3179,18 @@ msgstr "prix d'achat"
|
||||
msgid "Initial cost of purchasing the product"
|
||||
msgstr "Coût initial d'achat du produit"
|
||||
|
||||
#: counter/models.py
|
||||
msgid "selling price"
|
||||
msgstr "prix de vente"
|
||||
|
||||
#: counter/models.py
|
||||
msgid "special selling price"
|
||||
msgstr "prix de vente spécial"
|
||||
|
||||
#: counter/models.py
|
||||
msgid "Price for barmen during their permanence"
|
||||
msgstr "Prix pour les barmen durant leur permanence"
|
||||
|
||||
#: counter/models.py
|
||||
msgid "icon"
|
||||
msgstr "icône"
|
||||
@@ -3183,10 +3203,6 @@ msgstr "âge limite"
|
||||
msgid "tray price"
|
||||
msgstr "prix plateau"
|
||||
|
||||
#: counter/models.py
|
||||
msgid "Buy five, get the sixth free"
|
||||
msgstr "Pour cinq achetés, le sixième offert"
|
||||
|
||||
#: counter/models.py
|
||||
msgid "buying groups"
|
||||
msgstr "groupe d'achat"
|
||||
@@ -3199,35 +3215,10 @@ msgstr "archivé"
|
||||
msgid "updated at"
|
||||
msgstr "mis à jour le"
|
||||
|
||||
#: counter/models.py eboutic/models.py
|
||||
#: counter/models.py
|
||||
msgid "product"
|
||||
msgstr "produit"
|
||||
|
||||
#: counter/models.py
|
||||
msgid "always show"
|
||||
msgstr "toujours montrer"
|
||||
|
||||
#: counter/models.py
|
||||
msgid ""
|
||||
"If this option is enabled, people will see this price and be able to pay it, "
|
||||
"even if another cheaper price exists. Else it will visible only if it is the "
|
||||
"cheapest available price."
|
||||
msgstr ""
|
||||
"Si cette option est activée, les gens verront ce prix et pourront le payer, "
|
||||
"même si un autre moins cher existe. Dans le cas contraire, le prix sera "
|
||||
"visible uniquement s'il s'agit du prix disponible le plus faible."
|
||||
|
||||
#: counter/models.py
|
||||
msgid ""
|
||||
"A short label for easier differentiation if a user can see multiple prices."
|
||||
msgstr ""
|
||||
"Un court libellé pour faciliter la différentiation si un utilisateur peut "
|
||||
"voir plusieurs prix."
|
||||
|
||||
#: counter/models.py
|
||||
msgid "price"
|
||||
msgstr "prix"
|
||||
|
||||
#: counter/models.py
|
||||
msgid "products"
|
||||
msgstr "produits"
|
||||
@@ -3706,6 +3697,10 @@ msgstr ""
|
||||
msgid "New formula"
|
||||
msgstr "Nouvelle formule"
|
||||
|
||||
#: counter/templates/counter/formula_list.jinja
|
||||
msgid "instead of"
|
||||
msgstr "au lieu de"
|
||||
|
||||
#: counter/templates/counter/fragments/create_student_card.jinja
|
||||
msgid "No student card registered."
|
||||
msgstr "Aucune carte étudiante enregistrée."
|
||||
@@ -3828,10 +3823,6 @@ msgstr ""
|
||||
"votre cotisation. Si vous ne renouvelez pas votre cotisation, il n'y aura "
|
||||
"aucune conséquence autre que le retrait de l'argent de votre compte."
|
||||
|
||||
#: counter/templates/counter/product_form.jinja
|
||||
msgid "Remove price"
|
||||
msgstr "Retirer le prix"
|
||||
|
||||
#: counter/templates/counter/product_form.jinja
|
||||
msgid "Remove this action"
|
||||
msgstr "Retirer cette action"
|
||||
@@ -3853,14 +3844,6 @@ msgstr "Dernière mise à jour"
|
||||
msgid "Product creation"
|
||||
msgstr "Création de produit"
|
||||
|
||||
#: counter/templates/counter/product_form.jinja
|
||||
msgid "Prices"
|
||||
msgstr "Prix"
|
||||
|
||||
#: counter/templates/counter/product_form.jinja
|
||||
msgid "Add a price"
|
||||
msgstr "Ajouter un prix"
|
||||
|
||||
#: counter/templates/counter/product_form.jinja
|
||||
msgid "Automatic actions"
|
||||
msgstr "Actions automatiques"
|
||||
@@ -4112,10 +4095,18 @@ msgstr "validé"
|
||||
msgid "Invoice already validated"
|
||||
msgstr "Facture déjà validée"
|
||||
|
||||
#: eboutic/models.py
|
||||
msgid "product id"
|
||||
msgstr "ID du produit"
|
||||
|
||||
#: eboutic/models.py
|
||||
msgid "product name"
|
||||
msgstr "nom du produit"
|
||||
|
||||
#: eboutic/models.py
|
||||
msgid "product type id"
|
||||
msgstr "id du type du produit"
|
||||
|
||||
#: eboutic/models.py
|
||||
msgid "basket"
|
||||
msgstr "panier"
|
||||
|
||||
@@ -80,7 +80,6 @@ nav:
|
||||
- Ajouter un logo de promo: howto/logo.md
|
||||
- Ajouter une cotisation: howto/subscriptions.md
|
||||
- Modifier le weekmail: howto/weekmail.md
|
||||
- Mettre à jour xapian: howto/xapian.md
|
||||
- Terminal: howto/terminal.md
|
||||
- Direnv: howto/direnv.md
|
||||
- Reference:
|
||||
|
||||
+2
-6
@@ -78,7 +78,7 @@ tests = [
|
||||
"pytest-django<5.0.0,>=4.12.0",
|
||||
"model-bakery<2.0.0,>=1.23.3",
|
||||
"beautifulsoup4>=4.14.3,<5",
|
||||
"lxml>=6.0.2,<7",
|
||||
"lxml>=6.1.0,<7",
|
||||
]
|
||||
docs = [
|
||||
"mkdocs<2.0.0,>=1.6.1",
|
||||
@@ -92,11 +92,7 @@ docs = [
|
||||
default-groups = ["dev", "tests", "docs"]
|
||||
|
||||
[tool.xapian]
|
||||
version = "1.4.31"
|
||||
# Those hashes are here to protect against supply chains attacks
|
||||
# See `https://ae-utbm.github.io/sith/howto/xapian/` for more information
|
||||
core-sha256 = "fecf609ea2efdc8a64be369715aac733336a11f7480a6545244964ae6bc80811"
|
||||
bindings-sha256 = "a38cc7ba4188cc0bd27dc7369f03906772047087a1c54f1b93355d5e9103c304"
|
||||
version = "1.4.29"
|
||||
|
||||
[tool.ruff]
|
||||
output-format = "concise" # makes ruff error logs easier to read
|
||||
|
||||
@@ -33,6 +33,8 @@ class TestMergeUser(TestCase):
|
||||
cls.club = baker.make(Club)
|
||||
cls.eboutic = Counter.objects.get(name="Eboutic")
|
||||
cls.barbar = Product.objects.get(code="BARB")
|
||||
cls.barbar.selling_price = 2
|
||||
cls.barbar.save()
|
||||
cls.root = User.objects.get(username="root")
|
||||
cls.to_keep = User.objects.create(
|
||||
username="to_keep", password="plop", email="u.1@utbm.fr"
|
||||
|
||||
+1
-3
@@ -50,15 +50,13 @@ class AlbumEditForm(forms.ModelForm):
|
||||
model = Album
|
||||
fields = ["name", "date", "file", "parent", "edit_groups"]
|
||||
widgets = {
|
||||
"parent": AutoCompleteSelectAlbum,
|
||||
"edit_groups": AutoCompleteSelectMultipleGroup,
|
||||
}
|
||||
|
||||
name = forms.CharField(max_length=Album.NAME_MAX_LENGTH, label=_("file name"))
|
||||
date = forms.DateField(label=_("Date"), widget=SelectDate, required=True)
|
||||
recursive = forms.BooleanField(label=_("Apply rights recursively"), required=False)
|
||||
parent = forms.ModelChoiceField(
|
||||
Album.objects.all(), required=True, widget=AutoCompleteSelectAlbum
|
||||
)
|
||||
|
||||
|
||||
class PictureModerationRequestForm(forms.ModelForm):
|
||||
|
||||
+1
-7
@@ -205,13 +205,7 @@ class AlbumQuerySet(models.QuerySet):
|
||||
|
||||
class SASAlbumManager(models.Manager):
|
||||
def get_queryset(self):
|
||||
return (
|
||||
super()
|
||||
.get_queryset()
|
||||
.filter(
|
||||
Q(id=settings.SITH_SAS_ROOT_DIR_ID) | Q(is_in_sas=True, is_folder=True)
|
||||
)
|
||||
)
|
||||
return super().get_queryset().filter(is_in_sas=True, is_folder=True)
|
||||
|
||||
|
||||
class Album(SasFile):
|
||||
|
||||
@@ -20,14 +20,12 @@ from django.conf import settings
|
||||
from django.core.cache import cache
|
||||
from django.test import Client, TestCase
|
||||
from django.urls import reverse
|
||||
from django.utils import timezone
|
||||
from model_bakery import baker
|
||||
from pytest_django.asserts import assertHTMLEqual, assertInHTML, assertRedirects
|
||||
|
||||
from core.baker_recipes import old_subscriber_user, subscriber_user
|
||||
from core.models import Group, User
|
||||
from sas.baker_recipes import picture_recipe
|
||||
from sas.forms import AlbumEditForm
|
||||
from sas.models import Album, Picture
|
||||
|
||||
# Create your tests here.
|
||||
@@ -135,171 +133,6 @@ class TestAlbumUpload:
|
||||
assert not album.children.exists()
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
class TestAlbumEdit:
|
||||
@pytest.fixture
|
||||
def sas_root(self) -> Album:
|
||||
return Album.objects.get(id=settings.SITH_SAS_ROOT_DIR_ID)
|
||||
|
||||
@pytest.fixture
|
||||
def album(self) -> Album:
|
||||
return baker.make(
|
||||
Album, parent_id=settings.SITH_SAS_ROOT_DIR_ID, is_moderated=True
|
||||
)
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"user",
|
||||
[
|
||||
None,
|
||||
lambda: baker.make(User),
|
||||
subscriber_user.make,
|
||||
],
|
||||
)
|
||||
def test_permission_denied(
|
||||
self,
|
||||
client: Client,
|
||||
album: Album,
|
||||
user: Callable[[], User] | None,
|
||||
):
|
||||
if user:
|
||||
client.force_login(user())
|
||||
|
||||
response = client.get(reverse("sas:album_edit", kwargs={"album_id": album.pk}))
|
||||
assert response.status_code == 403
|
||||
response = client.post(reverse("sas:album_edit", kwargs={"album_id": album.pk}))
|
||||
assert response.status_code == 403
|
||||
|
||||
def test_sas_root_read_only(self, client: Client, sas_root: Album):
|
||||
moderator = baker.make(
|
||||
User, groups=[Group.objects.get(pk=settings.SITH_GROUP_SAS_ADMIN_ID)]
|
||||
)
|
||||
client.force_login(moderator)
|
||||
response = client.get(
|
||||
reverse("sas:album_edit", kwargs={"album_id": sas_root.pk})
|
||||
)
|
||||
assert response.status_code == 404
|
||||
response = client.post(
|
||||
reverse("sas:album_edit", kwargs={"album_id": sas_root.pk})
|
||||
)
|
||||
assert response.status_code == 404
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("excluded", "is_valid"),
|
||||
[
|
||||
("name", False),
|
||||
("date", False),
|
||||
("file", True),
|
||||
("parent", False),
|
||||
("edit_groups", True),
|
||||
("recursive", True),
|
||||
],
|
||||
)
|
||||
def test_form_required(self, album: Album, excluded: str, is_valid: bool): # noqa: FBT001
|
||||
data = {
|
||||
"name": album.name[: Album.NAME_MAX_LENGTH],
|
||||
"parent": baker.make(Album, parent=album.parent, is_moderated=True).pk,
|
||||
"date": timezone.now().strftime("%Y-%m-%d"),
|
||||
"file": "/random/path",
|
||||
"edit_groups": [settings.SITH_GROUP_SAS_ADMIN_ID],
|
||||
"recursive": False,
|
||||
}
|
||||
del data[excluded]
|
||||
assert AlbumEditForm(data=data).is_valid() == is_valid
|
||||
|
||||
def test_form_album_name(self, album: Album):
|
||||
data = {
|
||||
"name": album.name[: Album.NAME_MAX_LENGTH],
|
||||
"parent": album.pk,
|
||||
"date": timezone.now().strftime("%Y-%m-%d"),
|
||||
}
|
||||
assert AlbumEditForm(data=data).is_valid()
|
||||
|
||||
data["name"] = album.name[: Album.NAME_MAX_LENGTH + 1]
|
||||
assert not AlbumEditForm(data=data).is_valid()
|
||||
|
||||
def test_update_recursive_parent(self, client: Client, album: Album):
|
||||
client.force_login(baker.make(User, is_superuser=True))
|
||||
|
||||
payload = {
|
||||
"name": album.name[: Album.NAME_MAX_LENGTH],
|
||||
"parent": album.pk,
|
||||
"date": timezone.now().strftime("%Y-%m-%d"),
|
||||
}
|
||||
response = client.post(
|
||||
reverse(
|
||||
"sas:album_edit",
|
||||
kwargs={"album_id": album.pk},
|
||||
),
|
||||
payload,
|
||||
)
|
||||
assertInHTML(
|
||||
"<li>Boucle dans l'arborescence des dossiers</li>",
|
||||
response.text,
|
||||
)
|
||||
assert response.status_code == 200
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"user",
|
||||
[
|
||||
lambda: baker.make(User, is_superuser=True),
|
||||
lambda: baker.make(
|
||||
User, groups=[Group.objects.get(pk=settings.SITH_GROUP_SAS_ADMIN_ID)]
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_update(
|
||||
self,
|
||||
client: Client,
|
||||
album: Album,
|
||||
sas_root: Album,
|
||||
user: Callable[[], User],
|
||||
):
|
||||
client.force_login(user())
|
||||
|
||||
# Prepare a good payload
|
||||
expected_redirect = reverse("sas:album", kwargs={"album_id": album.pk})
|
||||
expected_date = timezone.now()
|
||||
payload = {
|
||||
"name": album.name[: Album.NAME_MAX_LENGTH],
|
||||
"parent": baker.make(Album, parent=sas_root, is_moderated=True).pk,
|
||||
"date": expected_date.strftime("%Y-%m-%d"),
|
||||
"recursive": False,
|
||||
}
|
||||
|
||||
# Test successful update
|
||||
response = client.post(
|
||||
reverse(
|
||||
"sas:album_edit",
|
||||
kwargs={"album_id": album.pk},
|
||||
),
|
||||
payload,
|
||||
)
|
||||
assertRedirects(response, expected_redirect)
|
||||
updated_album = Album.objects.get(id=album.pk)
|
||||
assert updated_album.name == payload["name"]
|
||||
assert updated_album.parent.id == payload["parent"]
|
||||
assert timezone.localdate(updated_album.date) == timezone.localdate(
|
||||
expected_date
|
||||
)
|
||||
|
||||
# Test root album can be used as parent
|
||||
payload["parent"] = sas_root.pk
|
||||
response = client.post(
|
||||
reverse(
|
||||
"sas:album_edit",
|
||||
kwargs={"album_id": album.pk},
|
||||
),
|
||||
payload,
|
||||
)
|
||||
assertRedirects(response, expected_redirect)
|
||||
updated_album = Album.objects.get(id=album.pk)
|
||||
assert updated_album.name == payload["name"]
|
||||
assert updated_album.parent.id == payload["parent"]
|
||||
assert timezone.localdate(updated_album.date) == timezone.localdate(
|
||||
expected_date
|
||||
)
|
||||
|
||||
|
||||
class TestSasModeration(TestCase):
|
||||
@classmethod
|
||||
def setUpTestData(cls):
|
||||
|
||||
+1
-4
@@ -37,7 +37,7 @@ from sas.forms import (
|
||||
PictureModerationRequestForm,
|
||||
PictureUploadForm,
|
||||
)
|
||||
from sas.models import Album, AlbumQuerySet, PeoplePictureRelation, Picture
|
||||
from sas.models import Album, PeoplePictureRelation, Picture
|
||||
|
||||
|
||||
class AlbumCreateFragment(FragmentMixin, CreateView):
|
||||
@@ -266,9 +266,6 @@ class AlbumEditView(CanEditMixin, UpdateView):
|
||||
template_name = "core/edit.jinja"
|
||||
pk_url_kwarg = "album_id"
|
||||
|
||||
def get_queryset(self) -> AlbumQuerySet:
|
||||
return super().get_queryset().exclude(id=settings.SITH_SAS_ROOT_DIR_ID)
|
||||
|
||||
def form_valid(self, form):
|
||||
ret = super().form_valid(form)
|
||||
if form.cleaned_data["recursive"]:
|
||||
|
||||
@@ -6,8 +6,14 @@
|
||||
{% trans %}New subscription{% endtrans %}
|
||||
{% endblock %}
|
||||
|
||||
{# The following statics are bundled with our autocomplete select.
|
||||
However, if one tries to swap a form by another, then the urls in script-once
|
||||
and link-once disappear.
|
||||
So we give them here.
|
||||
If the aforementioned bug is resolved, you can remove this. #}
|
||||
{% block additional_js %}
|
||||
<script type="module" src="{{ static('bundled/core/components/tabs-index.ts') }}"></script>
|
||||
<script type="module" src="{{ static("bundled/core/components/ajax-select-index.ts") }}"></script>
|
||||
<script
|
||||
type="module"
|
||||
src="{{ static("bundled/subscription/creation-form-existing-user-index.ts") }}"
|
||||
@@ -15,6 +21,8 @@
|
||||
{% endblock %}
|
||||
{% block additional_css %}
|
||||
<link rel="stylesheet" href="{{ static("core/components/tabs.scss") }}">
|
||||
<link rel="stylesheet" href="{{ static("bundled/core/components/ajax-select-index.css") }}">
|
||||
<link rel="stylesheet" href="{{ static("core/components/ajax-select.scss") }}">
|
||||
<link rel="stylesheet" href="{{ static("subscription/css/subscription.scss") }}">
|
||||
{% endblock %}
|
||||
|
||||
|
||||
@@ -817,6 +817,7 @@ wheels = [
|
||||
name = "griffelib"
|
||||
version = "2.0.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/ad/06/eccbd311c9e2b3ca45dbc063b93134c57a1ccc7607c5e545264ad092c4a9/griffelib-2.0.0.tar.gz", hash = "sha256:e504d637a089f5cab9b5daf18f7645970509bf4f53eda8d79ed71cce8bd97934", size = 166312, upload-time = "2026-03-23T21:06:55.954Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/4d/51/c936033e16d12b627ea334aaaaf42229c37620d0f15593456ab69ab48161/griffelib-2.0.0-py3-none-any.whl", hash = "sha256:01284878c966508b6d6f1dbff9b6fa607bc062d8261c5c7253cb285b06422a7f", size = 142004, upload-time = "2026-02-09T19:09:40.561Z" },
|
||||
]
|
||||
@@ -1044,82 +1045,82 @@ wheels = [
|
||||
|
||||
[[package]]
|
||||
name = "lxml"
|
||||
version = "6.0.2"
|
||||
version = "6.1.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/aa/88/262177de60548e5a2bfc46ad28232c9e9cbde697bd94132aeb80364675cb/lxml-6.0.2.tar.gz", hash = "sha256:cd79f3367bd74b317dda655dc8fcfa304d9eb6e4fb06b7168c5cf27f96e0cd62", size = 4073426, upload-time = "2025-09-22T04:04:59.287Z" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/28/30/9abc9e34c657c33834eaf6cd02124c61bdf5944d802aa48e69be8da3585d/lxml-6.1.0.tar.gz", hash = "sha256:bfd57d8008c4965709a919c3e9a98f76c2c7cb319086b3d26858250620023b13", size = 4197006, upload-time = "2026-04-18T04:32:51.613Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/f3/c8/8ff2bc6b920c84355146cd1ab7d181bc543b89241cfb1ebee824a7c81457/lxml-6.0.2-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:a59f5448ba2ceccd06995c95ea59a7674a10de0810f2ce90c9006f3cbc044456", size = 8661887, upload-time = "2025-09-22T04:01:17.265Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/37/6f/9aae1008083bb501ef63284220ce81638332f9ccbfa53765b2b7502203cf/lxml-6.0.2-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:e8113639f3296706fbac34a30813929e29247718e88173ad849f57ca59754924", size = 4667818, upload-time = "2025-09-22T04:01:19.688Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/f1/ca/31fb37f99f37f1536c133476674c10b577e409c0a624384147653e38baf2/lxml-6.0.2-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:a8bef9b9825fa8bc816a6e641bb67219489229ebc648be422af695f6e7a4fa7f", size = 4950807, upload-time = "2025-09-22T04:01:21.487Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/da/87/f6cb9442e4bada8aab5ae7e1046264f62fdbeaa6e3f6211b93f4c0dd97f1/lxml-6.0.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:65ea18d710fd14e0186c2f973dc60bb52039a275f82d3c44a0e42b43440ea534", size = 5109179, upload-time = "2025-09-22T04:01:23.32Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c8/20/a7760713e65888db79bbae4f6146a6ae5c04e4a204a3c48896c408cd6ed2/lxml-6.0.2-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c371aa98126a0d4c739ca93ceffa0fd7a5d732e3ac66a46e74339acd4d334564", size = 5023044, upload-time = "2025-09-22T04:01:25.118Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/a2/b0/7e64e0460fcb36471899f75831509098f3fd7cd02a3833ac517433cb4f8f/lxml-6.0.2-cp312-cp312-manylinux_2_26_i686.manylinux_2_28_i686.whl", hash = "sha256:700efd30c0fa1a3581d80a748157397559396090a51d306ea59a70020223d16f", size = 5359685, upload-time = "2025-09-22T04:01:27.398Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/b9/e1/e5df362e9ca4e2f48ed6411bd4b3a0ae737cc842e96877f5bf9428055ab4/lxml-6.0.2-cp312-cp312-manylinux_2_26_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:c33e66d44fe60e72397b487ee92e01da0d09ba2d66df8eae42d77b6d06e5eba0", size = 5654127, upload-time = "2025-09-22T04:01:29.629Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c6/d1/232b3309a02d60f11e71857778bfcd4acbdb86c07db8260caf7d008b08f8/lxml-6.0.2-cp312-cp312-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:90a345bbeaf9d0587a3aaffb7006aa39ccb6ff0e96a57286c0cb2fd1520ea192", size = 5253958, upload-time = "2025-09-22T04:01:31.535Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/35/35/d955a070994725c4f7d80583a96cab9c107c57a125b20bb5f708fe941011/lxml-6.0.2-cp312-cp312-manylinux_2_31_armv7l.whl", hash = "sha256:064fdadaf7a21af3ed1dcaa106b854077fbeada827c18f72aec9346847cd65d0", size = 4711541, upload-time = "2025-09-22T04:01:33.801Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/1e/be/667d17363b38a78c4bd63cfd4b4632029fd68d2c2dc81f25ce9eb5224dd5/lxml-6.0.2-cp312-cp312-manylinux_2_38_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:fbc74f42c3525ac4ffa4b89cbdd00057b6196bcefe8bce794abd42d33a018092", size = 5267426, upload-time = "2025-09-22T04:01:35.639Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ea/47/62c70aa4a1c26569bc958c9ca86af2bb4e1f614e8c04fb2989833874f7ae/lxml-6.0.2-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:6ddff43f702905a4e32bc24f3f2e2edfe0f8fde3277d481bffb709a4cced7a1f", size = 5064917, upload-time = "2025-09-22T04:01:37.448Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/bd/55/6ceddaca353ebd0f1908ef712c597f8570cc9c58130dbb89903198e441fd/lxml-6.0.2-cp312-cp312-musllinux_1_2_armv7l.whl", hash = "sha256:6da5185951d72e6f5352166e3da7b0dc27aa70bd1090b0eb3f7f7212b53f1bb8", size = 4788795, upload-time = "2025-09-22T04:01:39.165Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/cf/e8/fd63e15da5e3fd4c2146f8bbb3c14e94ab850589beab88e547b2dbce22e1/lxml-6.0.2-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:57a86e1ebb4020a38d295c04fc79603c7899e0df71588043eb218722dabc087f", size = 5676759, upload-time = "2025-09-22T04:01:41.506Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/76/47/b3ec58dc5c374697f5ba37412cd2728f427d056315d124dd4b61da381877/lxml-6.0.2-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:2047d8234fe735ab77802ce5f2297e410ff40f5238aec569ad7c8e163d7b19a6", size = 5255666, upload-time = "2025-09-22T04:01:43.363Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/19/93/03ba725df4c3d72afd9596eef4a37a837ce8e4806010569bedfcd2cb68fd/lxml-6.0.2-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:6f91fd2b2ea15a6800c8e24418c0775a1694eefc011392da73bc6cef2623b322", size = 5277989, upload-time = "2025-09-22T04:01:45.215Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c6/80/c06de80bfce881d0ad738576f243911fccf992687ae09fd80b734712b39c/lxml-6.0.2-cp312-cp312-win32.whl", hash = "sha256:3ae2ce7d6fedfb3414a2b6c5e20b249c4c607f72cb8d2bb7cc9c6ec7c6f4e849", size = 3611456, upload-time = "2025-09-22T04:01:48.243Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/f7/d7/0cdfb6c3e30893463fb3d1e52bc5f5f99684a03c29a0b6b605cfae879cd5/lxml-6.0.2-cp312-cp312-win_amd64.whl", hash = "sha256:72c87e5ee4e58a8354fb9c7c84cbf95a1c8236c127a5d1b7683f04bed8361e1f", size = 4011793, upload-time = "2025-09-22T04:01:50.042Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ea/7b/93c73c67db235931527301ed3785f849c78991e2e34f3fd9a6663ffda4c5/lxml-6.0.2-cp312-cp312-win_arm64.whl", hash = "sha256:61cb10eeb95570153e0c0e554f58df92ecf5109f75eacad4a95baa709e26c3d6", size = 3672836, upload-time = "2025-09-22T04:01:52.145Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/53/fd/4e8f0540608977aea078bf6d79f128e0e2c2bba8af1acf775c30baa70460/lxml-6.0.2-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:9b33d21594afab46f37ae58dfadd06636f154923c4e8a4d754b0127554eb2e77", size = 8648494, upload-time = "2025-09-22T04:01:54.242Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/5d/f4/2a94a3d3dfd6c6b433501b8d470a1960a20ecce93245cf2db1706adf6c19/lxml-6.0.2-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:6c8963287d7a4c5c9a432ff487c52e9c5618667179c18a204bdedb27310f022f", size = 4661146, upload-time = "2025-09-22T04:01:56.282Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/25/2e/4efa677fa6b322013035d38016f6ae859d06cac67437ca7dc708a6af7028/lxml-6.0.2-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:1941354d92699fb5ffe6ed7b32f9649e43c2feb4b97205f75866f7d21aa91452", size = 4946932, upload-time = "2025-09-22T04:01:58.989Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ce/0f/526e78a6d38d109fdbaa5049c62e1d32fdd70c75fb61c4eadf3045d3d124/lxml-6.0.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:bb2f6ca0ae2d983ded09357b84af659c954722bbf04dea98030064996d156048", size = 5100060, upload-time = "2025-09-22T04:02:00.812Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/81/76/99de58d81fa702cc0ea7edae4f4640416c2062813a00ff24bd70ac1d9c9b/lxml-6.0.2-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:eb2a12d704f180a902d7fa778c6d71f36ceb7b0d317f34cdc76a5d05aa1dd1df", size = 5019000, upload-time = "2025-09-22T04:02:02.671Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/b5/35/9e57d25482bc9a9882cb0037fdb9cc18f4b79d85df94fa9d2a89562f1d25/lxml-6.0.2-cp313-cp313-manylinux_2_26_i686.manylinux_2_28_i686.whl", hash = "sha256:6ec0e3f745021bfed19c456647f0298d60a24c9ff86d9d051f52b509663feeb1", size = 5348496, upload-time = "2025-09-22T04:02:04.904Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/a6/8e/cb99bd0b83ccc3e8f0f528e9aa1f7a9965dfec08c617070c5db8d63a87ce/lxml-6.0.2-cp313-cp313-manylinux_2_26_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:846ae9a12d54e368933b9759052d6206a9e8b250291109c48e350c1f1f49d916", size = 5643779, upload-time = "2025-09-22T04:02:06.689Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/d0/34/9e591954939276bb679b73773836c6684c22e56d05980e31d52a9a8deb18/lxml-6.0.2-cp313-cp313-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:ef9266d2aa545d7374938fb5c484531ef5a2ec7f2d573e62f8ce722c735685fd", size = 5244072, upload-time = "2025-09-22T04:02:08.587Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/8d/27/b29ff065f9aaca443ee377aff699714fcbffb371b4fce5ac4ca759e436d5/lxml-6.0.2-cp313-cp313-manylinux_2_31_armv7l.whl", hash = "sha256:4077b7c79f31755df33b795dc12119cb557a0106bfdab0d2c2d97bd3cf3dffa6", size = 4718675, upload-time = "2025-09-22T04:02:10.783Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/2b/9f/f756f9c2cd27caa1a6ef8c32ae47aadea697f5c2c6d07b0dae133c244fbe/lxml-6.0.2-cp313-cp313-manylinux_2_38_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:a7c5d5e5f1081955358533be077166ee97ed2571d6a66bdba6ec2f609a715d1a", size = 5255171, upload-time = "2025-09-22T04:02:12.631Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/61/46/bb85ea42d2cb1bd8395484fd72f38e3389611aa496ac7772da9205bbda0e/lxml-6.0.2-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:8f8d0cbd0674ee89863a523e6994ac25fd5be9c8486acfc3e5ccea679bad2679", size = 5057175, upload-time = "2025-09-22T04:02:14.718Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/95/0c/443fc476dcc8e41577f0af70458c50fe299a97bb6b7505bb1ae09aa7f9ac/lxml-6.0.2-cp313-cp313-musllinux_1_2_armv7l.whl", hash = "sha256:2cbcbf6d6e924c28f04a43f3b6f6e272312a090f269eff68a2982e13e5d57659", size = 4785688, upload-time = "2025-09-22T04:02:16.957Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/48/78/6ef0b359d45bb9697bc5a626e1992fa5d27aa3f8004b137b2314793b50a0/lxml-6.0.2-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:dfb874cfa53340009af6bdd7e54ebc0d21012a60a4e65d927c2e477112e63484", size = 5660655, upload-time = "2025-09-22T04:02:18.815Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ff/ea/e1d33808f386bc1339d08c0dcada6e4712d4ed8e93fcad5f057070b7988a/lxml-6.0.2-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:fb8dae0b6b8b7f9e96c26fdd8121522ce5de9bb5538010870bd538683d30e9a2", size = 5247695, upload-time = "2025-09-22T04:02:20.593Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/4f/47/eba75dfd8183673725255247a603b4ad606f4ae657b60c6c145b381697da/lxml-6.0.2-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:358d9adae670b63e95bc59747c72f4dc97c9ec58881d4627fe0120da0f90d314", size = 5269841, upload-time = "2025-09-22T04:02:22.489Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/76/04/5c5e2b8577bc936e219becb2e98cdb1aca14a4921a12995b9d0c523502ae/lxml-6.0.2-cp313-cp313-win32.whl", hash = "sha256:e8cd2415f372e7e5a789d743d133ae474290a90b9023197fd78f32e2dc6873e2", size = 3610700, upload-time = "2025-09-22T04:02:24.465Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/fe/0a/4643ccc6bb8b143e9f9640aa54e38255f9d3b45feb2cbe7ae2ca47e8782e/lxml-6.0.2-cp313-cp313-win_amd64.whl", hash = "sha256:b30d46379644fbfc3ab81f8f82ae4de55179414651f110a1514f0b1f8f6cb2d7", size = 4010347, upload-time = "2025-09-22T04:02:26.286Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/31/ef/dcf1d29c3f530577f61e5fe2f1bd72929acf779953668a8a47a479ae6f26/lxml-6.0.2-cp313-cp313-win_arm64.whl", hash = "sha256:13dcecc9946dca97b11b7c40d29fba63b55ab4170d3c0cf8c0c164343b9bfdcf", size = 3671248, upload-time = "2025-09-22T04:02:27.918Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/03/15/d4a377b385ab693ce97b472fe0c77c2b16ec79590e688b3ccc71fba19884/lxml-6.0.2-cp314-cp314-macosx_10_13_universal2.whl", hash = "sha256:b0c732aa23de8f8aec23f4b580d1e52905ef468afb4abeafd3fec77042abb6fe", size = 8659801, upload-time = "2025-09-22T04:02:30.113Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c8/e8/c128e37589463668794d503afaeb003987373c5f94d667124ffd8078bbd9/lxml-6.0.2-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:4468e3b83e10e0317a89a33d28f7aeba1caa4d1a6fd457d115dd4ffe90c5931d", size = 4659403, upload-time = "2025-09-22T04:02:32.119Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/00/ce/74903904339decdf7da7847bb5741fc98a5451b42fc419a86c0c13d26fe2/lxml-6.0.2-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:abd44571493973bad4598a3be7e1d807ed45aa2adaf7ab92ab7c62609569b17d", size = 4966974, upload-time = "2025-09-22T04:02:34.155Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/1f/d3/131dec79ce61c5567fecf82515bd9bc36395df42501b50f7f7f3bd065df0/lxml-6.0.2-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:370cd78d5855cfbffd57c422851f7d3864e6ae72d0da615fca4dad8c45d375a5", size = 5102953, upload-time = "2025-09-22T04:02:36.054Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/3a/ea/a43ba9bb750d4ffdd885f2cd333572f5bb900cd2408b67fdda07e85978a0/lxml-6.0.2-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:901e3b4219fa04ef766885fb40fa516a71662a4c61b80c94d25336b4934b71c0", size = 5055054, upload-time = "2025-09-22T04:02:38.154Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/60/23/6885b451636ae286c34628f70a7ed1fcc759f8d9ad382d132e1c8d3d9bfd/lxml-6.0.2-cp314-cp314-manylinux_2_26_i686.manylinux_2_28_i686.whl", hash = "sha256:a4bf42d2e4cf52c28cc1812d62426b9503cdb0c87a6de81442626aa7d69707ba", size = 5352421, upload-time = "2025-09-22T04:02:40.413Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/48/5b/fc2ddfc94ddbe3eebb8e9af6e3fd65e2feba4967f6a4e9683875c394c2d8/lxml-6.0.2-cp314-cp314-manylinux_2_26_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:b2c7fdaa4d7c3d886a42534adec7cfac73860b89b4e5298752f60aa5984641a0", size = 5673684, upload-time = "2025-09-22T04:02:42.288Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/29/9c/47293c58cc91769130fbf85531280e8cc7868f7fbb6d92f4670071b9cb3e/lxml-6.0.2-cp314-cp314-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:98a5e1660dc7de2200b00d53fa00bcd3c35a3608c305d45a7bbcaf29fa16e83d", size = 5252463, upload-time = "2025-09-22T04:02:44.165Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/9b/da/ba6eceb830c762b48e711ded880d7e3e89fc6c7323e587c36540b6b23c6b/lxml-6.0.2-cp314-cp314-manylinux_2_31_armv7l.whl", hash = "sha256:dc051506c30b609238d79eda75ee9cab3e520570ec8219844a72a46020901e37", size = 4698437, upload-time = "2025-09-22T04:02:46.524Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/a5/24/7be3f82cb7990b89118d944b619e53c656c97dc89c28cfb143fdb7cd6f4d/lxml-6.0.2-cp314-cp314-manylinux_2_38_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:8799481bbdd212470d17513a54d568f44416db01250f49449647b5ab5b5dccb9", size = 5269890, upload-time = "2025-09-22T04:02:48.812Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/1b/bd/dcfb9ea1e16c665efd7538fc5d5c34071276ce9220e234217682e7d2c4a5/lxml-6.0.2-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:9261bb77c2dab42f3ecd9103951aeca2c40277701eb7e912c545c1b16e0e4917", size = 5097185, upload-time = "2025-09-22T04:02:50.746Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/21/04/a60b0ff9314736316f28316b694bccbbabe100f8483ad83852d77fc7468e/lxml-6.0.2-cp314-cp314-musllinux_1_2_armv7l.whl", hash = "sha256:65ac4a01aba353cfa6d5725b95d7aed6356ddc0a3cd734de00124d285b04b64f", size = 4745895, upload-time = "2025-09-22T04:02:52.968Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/d6/bd/7d54bd1846e5a310d9c715921c5faa71cf5c0853372adf78aee70c8d7aa2/lxml-6.0.2-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:b22a07cbb82fea98f8a2fd814f3d1811ff9ed76d0fc6abc84eb21527596e7cc8", size = 5695246, upload-time = "2025-09-22T04:02:54.798Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/fd/32/5643d6ab947bc371da21323acb2a6e603cedbe71cb4c99c8254289ab6f4e/lxml-6.0.2-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:d759cdd7f3e055d6bc8d9bec3ad905227b2e4c785dc16c372eb5b5e83123f48a", size = 5260797, upload-time = "2025-09-22T04:02:57.058Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/33/da/34c1ec4cff1eea7d0b4cd44af8411806ed943141804ac9c5d565302afb78/lxml-6.0.2-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:945da35a48d193d27c188037a05fec5492937f66fb1958c24fc761fb9d40d43c", size = 5277404, upload-time = "2025-09-22T04:02:58.966Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/82/57/4eca3e31e54dc89e2c3507e1cd411074a17565fa5ffc437c4ae0a00d439e/lxml-6.0.2-cp314-cp314-win32.whl", hash = "sha256:be3aaa60da67e6153eb15715cc2e19091af5dc75faef8b8a585aea372507384b", size = 3670072, upload-time = "2025-09-22T04:03:38.05Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/e3/e0/c96cf13eccd20c9421ba910304dae0f619724dcf1702864fd59dd386404d/lxml-6.0.2-cp314-cp314-win_amd64.whl", hash = "sha256:fa25afbadead523f7001caf0c2382afd272c315a033a7b06336da2637d92d6ed", size = 4080617, upload-time = "2025-09-22T04:03:39.835Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/d5/5d/b3f03e22b3d38d6f188ef044900a9b29b2fe0aebb94625ce9fe244011d34/lxml-6.0.2-cp314-cp314-win_arm64.whl", hash = "sha256:063eccf89df5b24e361b123e257e437f9e9878f425ee9aae3144c77faf6da6d8", size = 3754930, upload-time = "2025-09-22T04:03:41.565Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/5e/5c/42c2c4c03554580708fc738d13414801f340c04c3eff90d8d2d227145275/lxml-6.0.2-cp314-cp314t-macosx_10_13_universal2.whl", hash = "sha256:6162a86d86893d63084faaf4ff937b3daea233e3682fb4474db07395794fa80d", size = 8910380, upload-time = "2025-09-22T04:03:01.645Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/bf/4f/12df843e3e10d18d468a7557058f8d3733e8b6e12401f30b1ef29360740f/lxml-6.0.2-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:414aaa94e974e23a3e92e7ca5b97d10c0cf37b6481f50911032c69eeb3991bba", size = 4775632, upload-time = "2025-09-22T04:03:03.814Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/e4/0c/9dc31e6c2d0d418483cbcb469d1f5a582a1cd00a1f4081953d44051f3c50/lxml-6.0.2-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:48461bd21625458dd01e14e2c38dd0aea69addc3c4f960c30d9f59d7f93be601", size = 4975171, upload-time = "2025-09-22T04:03:05.651Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/e7/2b/9b870c6ca24c841bdd887504808f0417aa9d8d564114689266f19ddf29c8/lxml-6.0.2-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:25fcc59afc57d527cfc78a58f40ab4c9b8fd096a9a3f964d2781ffb6eb33f4ed", size = 5110109, upload-time = "2025-09-22T04:03:07.452Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/bf/0c/4f5f2a4dd319a178912751564471355d9019e220c20d7db3fb8307ed8582/lxml-6.0.2-cp314-cp314t-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5179c60288204e6ddde3f774a93350177e08876eaf3ab78aa3a3649d43eb7d37", size = 5041061, upload-time = "2025-09-22T04:03:09.297Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/12/64/554eed290365267671fe001a20d72d14f468ae4e6acef1e179b039436967/lxml-6.0.2-cp314-cp314t-manylinux_2_26_i686.manylinux_2_28_i686.whl", hash = "sha256:967aab75434de148ec80597b75062d8123cadf2943fb4281f385141e18b21338", size = 5306233, upload-time = "2025-09-22T04:03:11.651Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/7a/31/1d748aa275e71802ad9722df32a7a35034246b42c0ecdd8235412c3396ef/lxml-6.0.2-cp314-cp314t-manylinux_2_26_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:d100fcc8930d697c6561156c6810ab4a508fb264c8b6779e6e61e2ed5e7558f9", size = 5604739, upload-time = "2025-09-22T04:03:13.592Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/8f/41/2c11916bcac09ed561adccacceaedd2bf0e0b25b297ea92aab99fd03d0fa/lxml-6.0.2-cp314-cp314t-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:2ca59e7e13e5981175b8b3e4ab84d7da57993eeff53c07764dcebda0d0e64ecd", size = 5225119, upload-time = "2025-09-22T04:03:15.408Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/99/05/4e5c2873d8f17aa018e6afde417c80cc5d0c33be4854cce3ef5670c49367/lxml-6.0.2-cp314-cp314t-manylinux_2_31_armv7l.whl", hash = "sha256:957448ac63a42e2e49531b9d6c0fa449a1970dbc32467aaad46f11545be9af1d", size = 4633665, upload-time = "2025-09-22T04:03:17.262Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/0f/c9/dcc2da1bebd6275cdc723b515f93edf548b82f36a5458cca3578bc899332/lxml-6.0.2-cp314-cp314t-manylinux_2_38_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:b7fc49c37f1786284b12af63152fe1d0990722497e2d5817acfe7a877522f9a9", size = 5234997, upload-time = "2025-09-22T04:03:19.14Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/9c/e2/5172e4e7468afca64a37b81dba152fc5d90e30f9c83c7c3213d6a02a5ce4/lxml-6.0.2-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:e19e0643cc936a22e837f79d01a550678da8377d7d801a14487c10c34ee49c7e", size = 5090957, upload-time = "2025-09-22T04:03:21.436Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/a5/b3/15461fd3e5cd4ddcb7938b87fc20b14ab113b92312fc97afe65cd7c85de1/lxml-6.0.2-cp314-cp314t-musllinux_1_2_armv7l.whl", hash = "sha256:1db01e5cf14345628e0cbe71067204db658e2fb8e51e7f33631f5f4735fefd8d", size = 4764372, upload-time = "2025-09-22T04:03:23.27Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/05/33/f310b987c8bf9e61c4dd8e8035c416bd3230098f5e3cfa69fc4232de7059/lxml-6.0.2-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:875c6b5ab39ad5291588aed6925fac99d0097af0dd62f33c7b43736043d4a2ec", size = 5634653, upload-time = "2025-09-22T04:03:25.767Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/70/ff/51c80e75e0bc9382158133bdcf4e339b5886c6ee2418b5199b3f1a61ed6d/lxml-6.0.2-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:cdcbed9ad19da81c480dfd6dd161886db6096083c9938ead313d94b30aadf272", size = 5233795, upload-time = "2025-09-22T04:03:27.62Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/56/4d/4856e897df0d588789dd844dbed9d91782c4ef0b327f96ce53c807e13128/lxml-6.0.2-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:80dadc234ebc532e09be1975ff538d154a7fa61ea5031c03d25178855544728f", size = 5257023, upload-time = "2025-09-22T04:03:30.056Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/0f/85/86766dfebfa87bea0ab78e9ff7a4b4b45225df4b4d3b8cc3c03c5cd68464/lxml-6.0.2-cp314-cp314t-win32.whl", hash = "sha256:da08e7bb297b04e893d91087df19638dc7a6bb858a954b0cc2b9f5053c922312", size = 3911420, upload-time = "2025-09-22T04:03:32.198Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/fe/1a/b248b355834c8e32614650b8008c69ffeb0ceb149c793961dd8c0b991bb3/lxml-6.0.2-cp314-cp314t-win_amd64.whl", hash = "sha256:252a22982dca42f6155125ac76d3432e548a7625d56f5a273ee78a5057216eca", size = 4406837, upload-time = "2025-09-22T04:03:34.027Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/92/aa/df863bcc39c5e0946263454aba394de8a9084dbaff8ad143846b0d844739/lxml-6.0.2-cp314-cp314t-win_arm64.whl", hash = "sha256:bb4c1847b303835d89d785a18801a883436cdfd5dc3d62947f9c49e24f0f5a2c", size = 3822205, upload-time = "2025-09-22T04:03:36.249Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/d2/d4/9326838b59dc36dfae42eec9656b97520f9997eee1de47b8316aaeed169c/lxml-6.1.0-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:d2f17a16cd8751e8eb233a7e41aecdf8e511712e00088bf9be455f604cd0d28d", size = 8570663, upload-time = "2026-04-18T04:27:48.253Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/d8/a4/053745ce1f8303ccbb788b86c0db3a91b973675cefc42566a188637b7c40/lxml-6.1.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:f0cea5b1d3e6e77d71bd2b9972eb2446221a69dc52bb0b9c3c6f6e5700592d93", size = 4624024, upload-time = "2026-04-18T04:27:52.594Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/90/97/a517944b20f8fd0932ad2109482bee4e29fe721416387a363306667941f6/lxml-6.1.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:fc46da94826188ed45cb53bd8e3fc076ae22675aea2087843d4735627f867c6d", size = 4930895, upload-time = "2026-04-18T04:32:56.29Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/94/7c/e08a970727d556caa040a44773c7b7e3ad0f0d73dedc863543e9a8b931f2/lxml-6.1.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:9147d8e386ec3b82c3b15d88927f734f565b0aaadef7def562b853adca45784a", size = 5093820, upload-time = "2026-04-18T04:32:58.94Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/88/ee/2a5c2aa2c32016a226ca25d3e1056a8102ea6e1fe308bf50213586635400/lxml-6.1.0-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5715e0e28736a070f3f34a7ccc09e2fdcba0e3060abbcf61a1a5718ff6d6b105", size = 5005790, upload-time = "2026-04-18T04:33:01.272Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/e3/38/a0db9be8f38ad6043ab9429487c128dd1d30f07956ef43040402f8da49e8/lxml-6.1.0-cp312-cp312-manylinux_2_26_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:4937460dc5df0cdd2f06a86c285c28afda06aefa3af949f9477d3e8df430c485", size = 5630827, upload-time = "2026-04-18T04:33:04.036Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/31/ba/3c13d3fc24b7cacf675f808a3a1baabf43a30d0cd24c98f94548e9aa58eb/lxml-6.1.0-cp312-cp312-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:bc783ee3147e60a25aa0445ea82b3e8aabb83b240f2b95d32cb75587ff781814", size = 5240445, upload-time = "2026-04-18T04:33:06.87Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/55/ba/eeef4ccba09b2212fe239f46c1692a98db1878e0872ae320756488878a94/lxml-6.1.0-cp312-cp312-manylinux_2_28_i686.whl", hash = "sha256:40d9189f80075f2e1f88db21ef815a2b17b28adf8e50aaf5c789bfe737027f32", size = 5350121, upload-time = "2026-04-18T04:33:09.365Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/7e/01/1da87c7b587c38d0cbe77a01aae3b9c1c49ed47d76918ef3db8fc151b1ca/lxml-6.1.0-cp312-cp312-manylinux_2_31_armv7l.whl", hash = "sha256:05b9b8787e35bec69e68daf4952b2e6dfcfb0db7ecf1a06f8cdfbbac4eb71aad", size = 4694949, upload-time = "2026-04-18T04:33:11.628Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/a1/88/7db0fe66d5aaf128443ee1623dec3db1576f3e4c17751ec0ef5866468590/lxml-6.1.0-cp312-cp312-manylinux_2_38_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:0f0f08beb0182e3e9a86fae124b3c47a7b41b7b69b225e1377db983802404e54", size = 5243901, upload-time = "2026-04-18T04:33:13.95Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/00/a8/1346726af7d1f6fca1f11223ba34001462b0a3660416986d37641708d57c/lxml-6.1.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:73becf6d8c81d4c76b1014dbd3584cb26d904492dcf73ca85dc8bff08dcd6d2d", size = 5048054, upload-time = "2026-04-18T04:33:16.965Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/2e/b7/85057012f035d1a0c87e02f8c723ca3c3e6e0728bcf4cb62080b21b1c1e3/lxml-6.1.0-cp312-cp312-musllinux_1_2_armv7l.whl", hash = "sha256:1ae225f66e5938f4fa29d37e009a3bb3b13032ac57eb4eb42afa44f6e4054e69", size = 4777324, upload-time = "2026-04-18T04:33:19.832Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/75/6c/ad2f94a91073ef570f33718040e8e160d5fb93331cf1ab3ca1323f939e2d/lxml-6.1.0-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:690022c7fae793b0489aa68a658822cea83e0d5933781811cabbf5ea3bcfe73d", size = 5645702, upload-time = "2026-04-18T04:33:22.436Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/3b/89/0bb6c0bd549c19004c60eea9dc554dd78fd647b72314ef25d460e0d208c6/lxml-6.1.0-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:63aeafc26aac0be8aff14af7871249e87ea1319be92090bfd632ec68e03b16a5", size = 5232901, upload-time = "2026-04-18T04:33:26.21Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/a1/d9/d609a11fb567da9399f525193e2b49847b5a409cdebe737f06a8b7126bdc/lxml-6.1.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:264c605ab9c0e4aa1a679636f4582c4d3313700009fac3ec9c3412ed0d8f3e1d", size = 5261333, upload-time = "2026-04-18T04:33:28.984Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/a6/3a/ac3f99ec8ac93089e7dd556f279e0d14c24de0a74a507e143a2e4b496e7c/lxml-6.1.0-cp312-cp312-win32.whl", hash = "sha256:56971379bc5ee8037c5a0f09fa88f66cdb7d37c3e38af3e45cf539f41131ac1f", size = 3596289, upload-time = "2026-04-18T04:27:42.819Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/f2/a7/0a915557538593cb1bbeedcd40e13c7a261822c26fecbbdb71dad0c2f540/lxml-6.1.0-cp312-cp312-win_amd64.whl", hash = "sha256:bba078de0031c219e5dd06cf3e6bf8fb8e6e64a77819b358f53bb132e3e03366", size = 3997059, upload-time = "2026-04-18T04:27:46.764Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/92/96/a5dc078cf0126fbfbc35611d77ecd5da80054b5893e28fb213a5613b9e1d/lxml-6.1.0-cp312-cp312-win_arm64.whl", hash = "sha256:c3592631e652afa34999a088f98ba7dfc7d6aff0d535c410bea77a71743f3819", size = 3659552, upload-time = "2026-04-18T04:27:51.133Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/08/03/69347590f1cf4a6d5a4944bb6099e6d37f334784f16062234e1f892fdb1d/lxml-6.1.0-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:a0092f2b107b69601adf562a57c956fbb596e05e3e6651cabd3054113b007e45", size = 8559689, upload-time = "2026-04-18T04:31:57.785Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/3f/58/25e00bb40b185c974cfe156c110474d9a8a8390d5f7c92a4e328189bb60e/lxml-6.1.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:fc7140d7a7386e6b545d41b7358f4d02b656d4053f5fa6859f92f4b9c2572c4d", size = 4617892, upload-time = "2026-04-18T04:32:01.78Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/f5/54/92ad98a94ac318dc4f97aaac22ff8d1b94212b2ae8af5b6e9b354bf825f7/lxml-6.1.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:419c58fc92cc3a2c3fa5f78c63dbf5da70c1fa9c1b25f25727ecee89a96c7de2", size = 4923489, upload-time = "2026-04-18T04:33:31.401Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/15/3b/a20aecfab42bdf4f9b390590d345857ad3ffd7c51988d1c89c53a0c73faf/lxml-6.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:37fabd1452852636cf38ecdcc9dd5ca4bba7a35d6c53fa09725deeb894a87491", size = 5082162, upload-time = "2026-04-18T04:33:34.262Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/45/26/2cdb3d281ac1bd175603e290cbe4bad6eff127c0f8de90bafd6f8548f0fd/lxml-6.1.0-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:a2853c8b2170cc6cd54a6b4d50d2c1a8a7aeca201f23804b4898525c7a152cfc", size = 4993247, upload-time = "2026-04-18T04:33:36.674Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/f6/05/d735aef963740022a08185c84821f689fc903acb3d50326e6b1e9886cc22/lxml-6.1.0-cp313-cp313-manylinux_2_26_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:8e369cbd690e788c8d15e56222d91a09c6a417f49cbc543040cba0fe2e25a79e", size = 5613042, upload-time = "2026-04-18T04:33:39.205Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ee/b8/ead7c10efff731738c72e59ed6eb5791854879fbed7ae98781a12006263a/lxml-6.1.0-cp313-cp313-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:e69aa6805905807186eb00e66c6d97a935c928275182eb02ee40ba00da9623b2", size = 5228304, upload-time = "2026-04-18T04:33:41.647Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/6b/10/e9842d2ec322ea65f0a7270aa0315a53abed06058b88ef1b027f620e7a5f/lxml-6.1.0-cp313-cp313-manylinux_2_28_i686.whl", hash = "sha256:4bd1bdb8a9e0e2dd229de19b5f8aebac80e916921b4b2c6ef8a52bc131d0c1f9", size = 5341578, upload-time = "2026-04-18T04:33:44.596Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/89/54/40d9403d7c2775fa7301d3ddd3464689bfe9ba71acc17dfff777071b4fdc/lxml-6.1.0-cp313-cp313-manylinux_2_31_armv7l.whl", hash = "sha256:cbd7b79cdcb4986ad78a2662625882747f09db5e4cd7b2ae178a88c9c51b3dfe", size = 4700209, upload-time = "2026-04-18T04:33:47.552Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/85/b2/bbdcc2cf45dfc7dfffef4fd97e5c47b15919b6a365247d95d6f684ef5e82/lxml-6.1.0-cp313-cp313-manylinux_2_38_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:43e4d297f11080ec9d64a4b1ad7ac02b4484c9f0e2179d9c4ef78e886e747b88", size = 5232365, upload-time = "2026-04-18T04:33:50.249Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/48/5a/b06875665e53aaba7127611a7bed3b7b9658e20b22bc2dd217a0b7ab0091/lxml-6.1.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:cc16682cc987a3da00aa56a3aa3075b08edb10d9b1e476938cfdbee8f3b67181", size = 5043654, upload-time = "2026-04-18T04:33:52.71Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/e9/9c/e71a069d09641c1a7abeb30e693f828c7c90a41cbe3d650b2d734d876f85/lxml-6.1.0-cp313-cp313-musllinux_1_2_armv7l.whl", hash = "sha256:d6d8efe71429635f0559579092bb5e60560d7b9115ee38c4adbea35632e7fa24", size = 4769326, upload-time = "2026-04-18T04:33:55.244Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/cc/06/7a9cd84b3d4ed79adf35f874750abb697dec0b4a81a836037b36e47c091a/lxml-6.1.0-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:7e39ab3a28af7784e206d8606ec0e4bcad0190f63a492bca95e94e5a4aef7f6e", size = 5635879, upload-time = "2026-04-18T04:33:58.509Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/cc/f0/9d57916befc1e54c451712c7ee48e9e74e80ae4d03bdce49914e0aee42cd/lxml-6.1.0-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:9eb667bf50856c4a58145f8ca2d5e5be160191e79eb9e30855a476191b3c3495", size = 5224048, upload-time = "2026-04-18T04:34:00.943Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/99/75/90c4eefda0c08c92221fe0753db2d6699a4c628f76ff4465ec20dea84cc1/lxml-6.1.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:7f4a77d6f7edf9230cee3e1f7f6764722a41604ee5681844f18db9a81ea0ec33", size = 5250241, upload-time = "2026-04-18T04:34:03.365Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/5e/73/16596f7e4e38fa33084b9ccbccc22a15f82a290a055126f2c1541236d2ff/lxml-6.1.0-cp313-cp313-win32.whl", hash = "sha256:28902146ffbe5222df411c5d19e5352490122e14447e98cd118907ee3fd6ee62", size = 3596938, upload-time = "2026-04-18T04:31:56.206Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/8e/63/981401c5680c1eb30893f00a19641ac80db5d1e7086c62cb4b13ed813038/lxml-6.1.0-cp313-cp313-win_amd64.whl", hash = "sha256:4a1503c56e4e2b38dc76f2f2da7bae69670c0f1933e27cfa34b2fa5876410b16", size = 3995728, upload-time = "2026-04-18T04:31:58.763Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/e7/e8/c358a38ac3e541d16a1b527e4e9cb78c0419b0506a070ace11777e5e8404/lxml-6.1.0-cp313-cp313-win_arm64.whl", hash = "sha256:e0af85773850417d994d019741239b901b22c6680206f46a34766926e466141d", size = 3658372, upload-time = "2026-04-18T04:32:03.629Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/eb/45/cee4cf203ef0bab5c52afc118da61d6b460c928f2893d40023cfa27e0b80/lxml-6.1.0-cp314-cp314-macosx_10_15_universal2.whl", hash = "sha256:ab863fd37458fed6456525f297d21239d987800c46e67da5ef04fc6b3dd93ac8", size = 8576713, upload-time = "2026-04-18T04:32:06.831Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/8a/a7/eda05babeb7e046839204eaf254cd4d7c9130ce2bbf0d9e90ea41af5654d/lxml-6.1.0-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:6fd8b1df8254ff4fd93fd31da1fc15770bde23ac045be9bb1f87425702f61cc9", size = 4623874, upload-time = "2026-04-18T04:32:10.755Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/e7/e9/db5846de9b436b91890a62f29d80cd849ea17948a49bf532d5278ee69a9e/lxml-6.1.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:47024feaae386a92a146af0d2aeed65229bf6fff738e6a11dda6b0015fb8fd03", size = 4949535, upload-time = "2026-04-18T04:34:06.657Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/5a/ba/0d3593373dcae1d68f40dc3c41a5a92f2544e68115eb2f62319a4c2a6500/lxml-6.1.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:3f00972f84450204cd5d93a5395965e348956aaceaadec693a22ec743f8ae3eb", size = 5086881, upload-time = "2026-04-18T04:34:09.556Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/43/76/759a7484539ad1af0d125a9afe9c3fb5f82a8779fd1f5f56319d9e4ea2fd/lxml-6.1.0-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:97faa0860e13b05b15a51fb4986421ef7a30f0b3334061c416e0981e9450ca4c", size = 5031305, upload-time = "2026-04-18T04:34:12.336Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/dc/b9/c1f0daf981a11e47636126901fd4ab82429e18c57aeb0fc3ad2940b42d8b/lxml-6.1.0-cp314-cp314-manylinux_2_26_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:972a6451204798675407beaad97b868d0c733d9a74dafefc63120b81b8c2de28", size = 5647522, upload-time = "2026-04-18T04:34:14.89Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/31/e6/1f533dcd205275363d9ba3511bcec52fa2df86abf8abe6a5f2c599f0dc31/lxml-6.1.0-cp314-cp314-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:fe022f20bc4569ec66b63b3fb275a3d628d9d32da6326b2982584104db6d3086", size = 5239310, upload-time = "2026-04-18T04:34:17.652Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c3/8c/4175fb709c78a6e315ed814ed33be3defd8b8721067e70419a6cf6f971da/lxml-6.1.0-cp314-cp314-manylinux_2_28_i686.whl", hash = "sha256:75c4c7c619a744f972f4451bf5adf6d0fb00992a1ffc9fd78e13b0bc817cc99f", size = 5350799, upload-time = "2026-04-18T04:34:20.529Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/fd/77/6ffdebc5994975f0dde4acb59761902bd9d9bb84422b9a0bd239a7da9ca8/lxml-6.1.0-cp314-cp314-manylinux_2_31_armv7l.whl", hash = "sha256:3648f20d25102a22b6061c688beb3a805099ea4beb0a01ce62975d926944d292", size = 4697693, upload-time = "2026-04-18T04:34:23.541Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/f8/f1/565f36bd5c73294602d48e04d23f81ff4c8736be6ba5e1d1ec670ac9be80/lxml-6.1.0-cp314-cp314-manylinux_2_38_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:77b9f99b17cbf14026d1e618035077060fc7195dd940d025149f3e2e830fbfcb", size = 5250708, upload-time = "2026-04-18T04:34:26.001Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/5a/11/a68ab9dd18c5c499404deb4005f4bc4e0e88e5b72cd755ad96efec81d18d/lxml-6.1.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:32662519149fd7a9db354175aa5e417d83485a8039b8aaa62f873ceee7ea4cad", size = 5084737, upload-time = "2026-04-18T04:34:28.32Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ab/78/e8f41e2c74f4af564e6a0348aea69fb6daaefa64bc071ef469823d22cc18/lxml-6.1.0-cp314-cp314-musllinux_1_2_armv7l.whl", hash = "sha256:73d658216fc173cf2c939e90e07b941c5e12736b0bf6a99e7af95459cfe8eabb", size = 4737817, upload-time = "2026-04-18T04:34:30.784Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/06/2d/aa4e117aa2ce2f3b35d9ff246be74a2f8e853baba5d2a92c64744474603a/lxml-6.1.0-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:ac4db068889f8772a4a698c5980ec302771bb545e10c4b095d4c8be26749616f", size = 5670753, upload-time = "2026-04-18T04:34:33.675Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/08/f5/dd745d50c0409031dbfcc4881740542a01e54d6f0110bd420fa7782110b8/lxml-6.1.0-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:45e9dfbd1b661eb64ba0d4dbe762bd210c42d86dd1e5bd2bdf89d634231beb43", size = 5238071, upload-time = "2026-04-18T04:34:36.12Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/3e/74/ad424f36d0340a904665867dab310a3f1f4c96ff4039698de83b77f44c1f/lxml-6.1.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:89e8d73d09ac696a5ba42ec69787913d53284f12092f651506779314f10ba585", size = 5264319, upload-time = "2026-04-18T04:34:39.035Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/53/36/a15d8b3514ec889bfd6aa3609107fcb6c9189f8dc347f1c0b81eded8d87c/lxml-6.1.0-cp314-cp314-win32.whl", hash = "sha256:ebe33f4ec1b2de38ceb225a1749a2965855bffeef435ba93cd2d5d540783bf2f", size = 3657139, upload-time = "2026-04-18T04:32:20.006Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/1a/a4/263ebb0710851a3c6c937180a9a86df1206fdfe53cc43005aa2237fd7736/lxml-6.1.0-cp314-cp314-win_amd64.whl", hash = "sha256:398443df51c538bd578529aa7e5f7afc6c292644174b47961f3bf87fe5741120", size = 4064195, upload-time = "2026-04-18T04:32:23.876Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/80/68/2000f29d323b6c286de077ad20b429fc52272e44eae6d295467043e56012/lxml-6.1.0-cp314-cp314-win_arm64.whl", hash = "sha256:8c8984e1d8c4b3949e419158fda14d921ff703a9ed8a47236c6eb7a2b6cb4946", size = 3741870, upload-time = "2026-04-18T04:32:27.922Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/30/e9/21383c7c8d43799f0da90224c0d7c921870d476ec9b3e01e1b2c0b8237c5/lxml-6.1.0-cp314-cp314t-macosx_10_15_universal2.whl", hash = "sha256:1081dd10bc6fa437db2500e13993abf7cc30716d0a2f40e65abb935f02ec559c", size = 8827548, upload-time = "2026-04-18T04:32:15.094Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/a5/01/c6bc11cd587030dd4f719f65c5657960649fe3e19196c844c75bf32cd0d6/lxml-6.1.0-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:dabecc48db5f42ba348d1f5d5afdc54c6c4cc758e676926c7cd327045749517d", size = 4735866, upload-time = "2026-04-18T04:32:18.924Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/f3/01/757132fff5f4acf25463b5298f1a46099f3a94480b806547b29ce5e385de/lxml-6.1.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:e3dd5fe19c9e0ac818a9c7f132a5e43c1339ec1cbbfecb1a938bd3a47875b7c9", size = 4969476, upload-time = "2026-04-18T04:34:41.889Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/fd/fb/1bc8b9d27ed64be7c8903db6c89e74dc8c2cd9ec630a7462e4654316dc5b/lxml-6.1.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:9e7b0a4ca6dcc007a4cef00a761bba2dea959de4bd2df98f926b33c92ca5dfb9", size = 5103719, upload-time = "2026-04-18T04:34:44.797Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/d5/e7/5bf82fa28133536a54601aae633b14988e89ed61d4c1eb6b899b023233aa/lxml-6.1.0-cp314-cp314t-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5d27bbe326c6b539c64b42638b18bc6003a8d88f76213a97ac9ed4f885efeab7", size = 5027890, upload-time = "2026-04-18T04:34:47.634Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/2d/20/e048db5d4b4ea0366648aa595f26bb764b2670903fc585b87436d0a5032c/lxml-6.1.0-cp314-cp314t-manylinux_2_26_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:c4e425db0c5445ef0ad56b0eec54f89b88b2d884656e536a90b2f52aecb4ca86", size = 5596008, upload-time = "2026-04-18T04:34:51.503Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/9a/c2/d10807bc8da4824b39e5bd01b5d05c077b6fd01bd91584167edf6b269d22/lxml-6.1.0-cp314-cp314t-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4b89b098105b8599dc57adac95d1813409ac476d3c948a498775d3d0c6124bfb", size = 5224451, upload-time = "2026-04-18T04:34:54.263Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/3c/15/2ebea45bea427e7f0057e9ce7b2d62c5aba20c6b001cca89ed0aadb3ad41/lxml-6.1.0-cp314-cp314t-manylinux_2_28_i686.whl", hash = "sha256:c4a699432846df86cc3de502ee85f445ebad748a1c6021d445f3e514d2cd4b1c", size = 5312135, upload-time = "2026-04-18T04:34:56.818Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/31/e2/87eeae151b0be2a308d49a7ec444ff3eb192b14251e62addb29d0bf3778f/lxml-6.1.0-cp314-cp314t-manylinux_2_31_armv7l.whl", hash = "sha256:30e7b2ed63b6c8e97cca8af048589a788ab5c9c905f36d9cf1c2bb549f450d2f", size = 4639126, upload-time = "2026-04-18T04:34:59.704Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/a3/51/8a3f6a20902ad604dd746ec7b4000311b240d389dac5e9d95adefd349e0c/lxml-6.1.0-cp314-cp314t-manylinux_2_38_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:022981127642fe19866d2907d76241bb07ed21749601f727d5d5dd1ce5d1b773", size = 5232579, upload-time = "2026-04-18T04:35:02.658Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/6d/d2/650d619bdbe048d2c3f2c31edb00e35670a5e2d65b4fe3b61bce37b19121/lxml-6.1.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:23cad0cc86046d4222f7f418910e46b89971c5a45d3c8abfad0f64b7b05e4a9b", size = 5084206, upload-time = "2026-04-18T04:35:05.175Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/dd/8a/672ca1a3cbeabd1f511ca275a916c0514b747f4b85bdaae103b8fa92f307/lxml-6.1.0-cp314-cp314t-musllinux_1_2_armv7l.whl", hash = "sha256:21c3302068f50d1e8728c67c87ba92aa87043abee517aa2576cca1855326b405", size = 4758906, upload-time = "2026-04-18T04:35:08.098Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/be/f1/ef4b691da85c916cb2feb1eec7414f678162798ac85e042fa164419ac05c/lxml-6.1.0-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:be10838781cb3be19251e276910cd508fe127e27c3242e50521521a0f3781690", size = 5620553, upload-time = "2026-04-18T04:35:11.23Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/59/17/94e81def74107809755ac2782fdad4404420f1c92ca83433d117a6d5acf0/lxml-6.1.0-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:2173a7bffe97667bbf0767f8a99e587740a8c56fdf3befac4b09cb29a80276fd", size = 5229458, upload-time = "2026-04-18T04:35:14.254Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/21/55/c4be91b0f830a871fc1b0d730943d56013b683d4671d5198260e2eae722b/lxml-6.1.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:c6854e9cf99c84beb004eecd7d3a3868ef1109bf2b1df92d7bc11e96a36c2180", size = 5247861, upload-time = "2026-04-18T04:35:17.006Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c2/ca/77123e4d77df3cb1e968ade7b1f808f5d3a5c1c96b18a33895397de292c1/lxml-6.1.0-cp314-cp314t-win32.whl", hash = "sha256:00750d63ef0031a05331b9223463b1c7c02b9004cef2346a5b2877f0f9494dd2", size = 3897377, upload-time = "2026-04-18T04:32:07.656Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/64/ce/3554833989d074267c063209bae8b09815e5656456a2d332b947806b05ff/lxml-6.1.0-cp314-cp314t-win_amd64.whl", hash = "sha256:80410c3a7e3c617af04de17caa9f9f20adaa817093293d69eae7d7d0522836f5", size = 4392701, upload-time = "2026-04-18T04:32:12.113Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/2b/a0/9b916c68c0e57752c07f8f64b30138d9d4059dbeb27b90274dedbea128ff/lxml-6.1.0-cp314-cp314t-win_arm64.whl", hash = "sha256:26dd9f57ee3bd41e7d35b4c98a2ffd89ed11591649f421f0ec19f67d50ec67ac", size = 3817120, upload-time = "2026-04-18T04:32:15.803Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2142,7 +2143,7 @@ prod = [{ name = "psycopg", extras = ["c"], specifier = ">=3.3.3,<4.0.0" }]
|
||||
tests = [
|
||||
{ name = "beautifulsoup4", specifier = ">=4.14.3,<5" },
|
||||
{ name = "freezegun", specifier = ">=1.5.5,<2.0.0" },
|
||||
{ name = "lxml", specifier = ">=6.0.2,<7" },
|
||||
{ name = "lxml", specifier = ">=6.1.0,<7" },
|
||||
{ name = "model-bakery", specifier = ">=1.23.3,<2.0.0" },
|
||||
{ name = "pytest", specifier = ">=9.0.2,<10.0.0" },
|
||||
{ name = "pytest-cov", specifier = ">=7.0.0,<8.0.0" },
|
||||
|
||||
Reference in New Issue
Block a user