Compare commits

..
292 changed files with 108768 additions and 195639 deletions
+1
View File
@@ -5,6 +5,7 @@ on:
branches: [ master ] branches: [ master ]
paths-ignore: paths-ignore:
- 'doc/**' - 'doc/**'
- 'src/pretix/locale/**'
pull_request: pull_request:
branches: [ master ] branches: [ master ]
paths-ignore: paths-ignore:
-1
View File
@@ -1 +0,0 @@
17
-2
View File
@@ -10,8 +10,6 @@ recursive-include src/pretix/helpers/locale *
recursive-include src/pretix/base/templates * recursive-include src/pretix/base/templates *
recursive-include src/pretix/control/templates * recursive-include src/pretix/control/templates *
recursive-include src/pretix/presale/templates * recursive-include src/pretix/presale/templates *
recursive-include src/pretix/plugins/autocheckin/templates *
recursive-include src/pretix/plugins/autocheckin/static *
recursive-include src/pretix/plugins/banktransfer/templates * recursive-include src/pretix/plugins/banktransfer/templates *
recursive-include src/pretix/plugins/banktransfer/static * recursive-include src/pretix/plugins/banktransfer/static *
recursive-include src/pretix/plugins/manualpayment/templates * recursive-include src/pretix/plugins/manualpayment/templates *
+1 -1
View File
@@ -65,7 +65,7 @@ Package dependencies
To build and run pretix, you will need the following debian packages:: To build and run pretix, you will need the following debian packages::
# apt-get install git build-essential python3-dev python3-venv python3 python3-pip \ # apt-get install git build-essential python3-dev python3-venv python3 python3-pip \
libxml2-dev libxslt1-dev libffi-dev zlib1g-dev libssl-dev \ python3-dev libxml2-dev libxslt1-dev libffi-dev zlib1g-dev libssl-dev \
gettext libpq-dev libjpeg-dev libopenjp2-7-dev gettext libpq-dev libjpeg-dev libopenjp2-7-dev
Config file Config file
-7
View File
@@ -73,11 +73,4 @@ This release includes a migration that changes retroactively fills an `organizer
`pretixbase_logentry`. If you have a large database, the migration step of the upgrade might take significantly `pretixbase_logentry`. If you have a large database, the migration step of the upgrade might take significantly
longer than usual, so plan the update accordingly. longer than usual, so plan the update accordingly.
Upgrade to 2024.7.0 or newer
"""""""""""""""""""""""""""""
This release includes a migration that changes how sales channels are referred on orders.
If you have a large database, the migration step of the upgrade might take significantly longer than usual, so plan
the update accordingly.
.. _blog: https://pretix.eu/about/en/blog/ .. _blog: https://pretix.eu/about/en/blog/
-259
View File
@@ -1,259 +0,0 @@
.. _rest-autocheckinrules:
Auto check-in rules
===================
This feature requires the bundled ``pretix.plugins.autocheckin`` plugin to be active for the event in order to work properly.
Resource description
--------------------
Auto check-in rules specify that tickets should under specific conditions automatically be considered checked in after
they have been purchased.
.. rst-class:: rest-resource-table
===================================== ========================== =======================================================
Field Type Description
===================================== ========================== =======================================================
id integer Internal ID of the rule
list integer ID of the check-in list to check the ticket in on. If
``None``, the system will select all matching check-in lists.
mode string ``"placed"`` if the rule should be evaluated right after
an order has been created, ``"paid"`` if the rule should
be evaluated after the order has been fully paid.
all_sales_channels boolean If ``true`` (default), the rule applies to tickets sold on all sales channels.
limit_sales_channels list of strings List of sales channel identifiers the rule should apply to
if ``all_sales_channels`` is ``false``.
all_products boolean If ``true`` (default), the rule affects all products and variations.
limit_products list of integers List of item IDs, if ``all_products`` is not set. If the
product listed here has variations, all variations will be matched.
limit_variations list of integers List of product variation IDs, if ``all_products`` is not set.
The parent product does not need to be part of ``limit_products``.
all_payment_methods boolean If ``true`` (default), the rule applies to tickets paid with all payment methods.
limit_payment_methods list of strings List of payment method identifiers the rule should apply to
if ``all_payment_methods`` is ``false``.
===================================== ========================== =======================================================
.. versionadded:: 2024.7
Endpoints
---------
.. http:get:: /api/v1/organizers/(organizer)/events/(event)/auto_checkin_rules/
Returns a list of all rules configured for an event.
**Example request**:
.. sourcecode:: http
GET /api/v1/organizers/bigevents/events/sampleconf/auto_checkin_rules/ HTTP/1.1
Host: pretix.eu
Accept: application/json, text/javascript
**Example response**:
.. sourcecode:: http
HTTP/1.1 200 OK
Vary: Accept
Content-Type: application/json
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"list": 12345,
"mode": "placed",
"all_sales_channels": false,
"limit_sales_channels": ["web"],
"all_products": False,
"limit_products": [2, 3],
"limit_variations": [456],
"all_payment_methods": true,
"limit_payment_methods": []
}
]
}
:query page: The page number in case of a multi-page result set, default is 1
:param organizer: The ``slug`` field of a valid organizer
:param event: The ``slug`` field of the event to fetch
:statuscode 200: no error
:statuscode 401: Authentication failure
:statuscode 403: The requested organizer does not exist **or** you have no permission to view it.
.. http:get:: /api/v1/organizers/(organizer)/events/(event)/auto_checkin_rules/(id)/
Returns information on one rule, identified by its ID.
**Example request**:
.. sourcecode:: http
GET /api/v1/organizers/bigevents/events/sampleconf/auto_checkin_rules/1/ HTTP/1.1
Host: pretix.eu
Accept: application/json, text/javascript
**Example response**:
.. sourcecode:: http
HTTP/1.1 200 OK
Vary: Accept
Content-Type: application/json
{
"id": 1,
"list": 12345,
"mode": "placed",
"all_sales_channels": false,
"limit_sales_channels": ["web"],
"all_products": False,
"limit_products": [2, 3],
"limit_variations": [456],
"all_payment_methods": true,
"limit_payment_methods": []
}
:param organizer: The ``slug`` field of the organizer to fetch
:param event: The ``slug`` field of the event to fetch
:param id: The ``id`` field of the rule to fetch
:statuscode 200: no error
:statuscode 401: Authentication failure
:statuscode 403: The requested organizer/event/rule does not exist **or** you have no permission to view it.
.. http:post:: /api/v1/organizers/(organizer)/events/(event)/auto_checkin_rules/
Create a new rule.
**Example request**:
.. sourcecode:: http
POST /api/v1/organizers/bigevents/events/sampleconf/auto_checkin_rules/ HTTP/1.1
Host: pretix.eu
Accept: application/json, text/javascript
Content-Type: application/json
Content-Length: 166
{
"list": 12345,
"mode": "placed",
"all_sales_channels": false,
"limit_sales_channels": ["web"],
"all_products": False,
"limit_products": [2, 3],
"limit_variations": [456],
"all_payment_methods": true,
"limit_payment_methods": []
}
**Example response**:
.. sourcecode:: http
HTTP/1.1 201 Created
Vary: Accept
Content-Type: application/json
{
"id": 1,
"list": 12345,
"mode": "placed",
"all_sales_channels": false,
"limit_sales_channels": ["web"],
"all_products": False,
"limit_products": [2, 3],
"limit_variations": [456],
"all_payment_methods": true,
"limit_payment_methods": []
}
:param organizer: The ``slug`` field of the organizer to create a rule for
:param event: The ``slug`` field of the event to create a rule for
:statuscode 201: no error
:statuscode 400: The rule could not be created due to invalid submitted data.
:statuscode 401: Authentication failure
:statuscode 403: The requested organizer/event does not exist **or** you have no permission to create rules.
.. http:patch:: /api/v1/organizers/(organizer)/events/(event)/auto_checkin_rules/(id)/
Update a rule. You can also use ``PUT`` instead of ``PATCH``. With ``PUT``, you have to provide all fields of
the resource, other fields will be reset to default. With ``PATCH``, you only need to provide the fields that you
want to change.
**Example request**:
.. sourcecode:: http
PATCH /api/v1/organizers/bigevents/events/sampleconf/auto_checkin_rules/1/ HTTP/1.1
Host: pretix.eu
Accept: application/json, text/javascript
Content-Type: application/json
Content-Length: 34
{
"mode": "paid",
}
**Example response**:
.. sourcecode:: http
HTTP/1.1 200 OK
Vary: Accept
Content-Type: text/javascript
{
"id": 1,
"list": 12345,
"mode": "placed",
"all_sales_channels": false,
"limit_sales_channels": ["web"],
"all_products": False,
"limit_products": [2, 3],
"limit_variations": [456],
"all_payment_methods": true,
"limit_payment_methods": []
}
:param organizer: The ``slug`` field of the organizer to modify
:param event: The ``slug`` field of the event to modify
:param id: The ``id`` field of the rule to modify
:statuscode 200: no error
:statuscode 400: The rule could not be modified due to invalid submitted data.
:statuscode 401: Authentication failure
:statuscode 403: The requested organizer/event/rule does not exist **or** you have no permission to change it.
.. http:delete:: /api/v1/organizers/(organizer)/events/(event)/auto_checkin_rules/(id)/
Delete a rule.
**Example request**:
.. sourcecode:: http
DELETE /api/v1/organizers/bigevents/events/sampleconf/auto_checkin_rules/1/ HTTP/1.1
Host: pretix.eu
Accept: application/json, text/javascript
**Example response**:
.. sourcecode:: http
HTTP/1.1 204 No Content
Vary: Accept
:param organizer: The ``slug`` field of the organizer to modify
:param event: The ``slug`` field of the event to modify
:param id: The ``id`` field of the rule to delete
:statuscode 204: no error
:statuscode 401: Authentication failure
:statuscode 403: The requested organizer/event/rule does not exist **or** you have no permission to change it **or** this rule cannot be deleted since it is currently in use.
-5
View File
@@ -40,11 +40,6 @@ answers list of objects Answers to user
seat objects The assigned seat (or ``null``) seat objects The assigned seat (or ``null``)
├ id integer Internal ID of the seat instance ├ id integer Internal ID of the seat instance
├ name string Human-readable seat name ├ name string Human-readable seat name
├ zone_name string Name of the zone the seat is in
├ row_name string Name/number of the row the seat is in
├ row_label string Additional label of the row (or ``null``)
├ seat_number string Number of the seat within the row
├ seat_label string Additional label of the seat (or ``null``)
└ seat_guid string Identifier of the seat within the seating plan └ seat_guid string Identifier of the seat within the seating plan
===================================== ========================== ======================================================= ===================================== ========================== =======================================================
-1
View File
@@ -32,7 +32,6 @@ position_count integer Number of ticke
checkin_count integer Number of check-ins performed on this list (read-only). checkin_count integer Number of check-ins performed on this list (read-only).
include_pending boolean If ``true``, the check-in list also contains tickets from orders in pending state. include_pending boolean If ``true``, the check-in list also contains tickets from orders in pending state.
auto_checkin_sales_channels list of strings All items on the check-in list will be automatically marked as checked-in when purchased through any of the listed sales channels. auto_checkin_sales_channels list of strings All items on the check-in list will be automatically marked as checked-in when purchased through any of the listed sales channels.
**Deprecated, will be removed in pretix 2024.10.** Use :ref:`rest-autocheckinrules`: instead.
allow_multiple_entries boolean If ``true``, subsequent scans of a ticket on this list should not show a warning but instead be stored as an additional check-in. allow_multiple_entries boolean If ``true``, subsequent scans of a ticket on this list should not show a warning but instead be stored as an additional check-in.
allow_entry_after_exit boolean If ``true``, subsequent scans of a ticket on this list are valid if the last scan of the ticket was an exit scan. allow_entry_after_exit boolean If ``true``, subsequent scans of a ticket on this list are valid if the last scan of the ticket was an exit scan.
rules object Custom check-in logic. The contents of this field are currently not considered a stable API and modifications through the API are highly discouraged. rules object Custom check-in logic. The contents of this field are currently not considered a stable API and modifications through the API are highly discouraged.
-2
View File
@@ -96,8 +96,6 @@ Endpoints
:query integer page: The page number in case of a multi-page result set, default is 1 :query integer page: The page number in case of a multi-page result set, default is 1
:query string secret: Only show gift cards with the given secret. :query string secret: Only show gift cards with the given secret.
:query string value: Only show gift cards with the given value.
:query boolean expired: Filter for gift cards that are (not) expired.
:query boolean testmode: Filter for gift cards that are (not) in test mode. :query boolean testmode: Filter for gift cards that are (not) in test mode.
:query boolean include_accepted: Also show gift cards issued by other organizers that are accepted by this organizer. :query boolean include_accepted: Also show gift cards issued by other organizers that are accepted by this organizer.
:query string expand: If you pass ``"owner_ticket"``, the respective field will be shown as a nested value instead of just an ID. :query string expand: If you pass ``"owner_ticket"``, the respective field will be shown as a nested value instead of just an ID.
+1 -3
View File
@@ -44,7 +44,5 @@ at :ref:`plugin-docs`.
scheduled_exports scheduled_exports
shredders shredders
sendmail_rules sendmail_rules
auto_checkin_rules
billing_invoices billing_invoices
billing_var billing_var
seats
-3
View File
@@ -217,9 +217,6 @@ List of all invoices
:query boolean is_cancellation: If set to ``true`` or ``false``, only invoices with this value for the field :query boolean is_cancellation: If set to ``true`` or ``false``, only invoices with this value for the field
``is_cancellation`` will be returned. ``is_cancellation`` will be returned.
:query string order: If set, only invoices belonging to the order with the given order code will be returned. :query string order: If set, only invoices belonging to the order with the given order code will be returned.
This parameter may be given multiple times. In this case, all invoices matching one of the inputs will be returned.
:query string number: If set, only invoices with the given invoice number will be returned.
This parameter may be given multiple times. In this case, all invoices matching one of the inputs will be returned.
:query string refers: If set, only invoices referring to the given invoice will be returned. :query string refers: If set, only invoices referring to the given invoice will be returned.
:query string locale: If set, only invoices with the given locale will be returned. :query string locale: If set, only invoices with the given locale will be returned.
:query string ordering: Manually set the ordering of results. Valid fields to be used are ``date`` and :query string ordering: Manually set the ordering of results. Valid fields to be used are ``date`` and
-1
View File
@@ -164,7 +164,6 @@ Endpoints
} }
:query integer page: The page number in case of a multi-page result set, default is 1 :query integer page: The page number in case of a multi-page result set, default is 1
:query string search: Filter the list by the value of the variation (substring search).
:query boolean active: If set to ``true`` or ``false``, only items with this value for the field ``active`` will be :query boolean active: If set to ``true`` or ``false``, only items with this value for the field ``active`` will be
returned. returned.
:param organizer: The ``slug`` field of the organizer to fetch :param organizer: The ``slug`` field of the organizer to fetch
-1
View File
@@ -392,7 +392,6 @@ Endpoints
} }
:query integer page: The page number in case of a multi-page result set, default is 1 :query integer page: The page number in case of a multi-page result set, default is 1
:query string search: Filter the list by internal name or name of the item (substring search).
:query boolean active: If set to ``true`` or ``false``, only items with this value for the field ``active`` will be :query boolean active: If set to ``true`` or ``false``, only items with this value for the field ``active`` will be
returned. returned.
:query integer category: If set to the ID of a category, only items within that category will be returned. :query integer category: If set to the ID of a category, only items within that category will be returned.
+2 -16
View File
@@ -42,8 +42,6 @@ payment_date date **DEPRECATED AN
payment_provider string **DEPRECATED AND INACCURATE** Payment provider used for this order payment_provider string **DEPRECATED AND INACCURATE** Payment provider used for this order
total money (string) Total value of this order total money (string) Total value of this order
comment string Internal comment on this order comment string Internal comment on this order
api_meta object Meta data for that order. Only available through API, no guarantees
on the content structure. You can use this to save references to your system.
custom_followup_at date Internal date for a custom follow-up action custom_followup_at date Internal date for a custom follow-up action
checkin_attention boolean If ``true``, the check-in app should show a warning checkin_attention boolean If ``true``, the check-in app should show a warning
that this ticket requires special attention if a ticket that this ticket requires special attention if a ticket
@@ -203,8 +201,7 @@ checkins list of objects List of **succe
├ datetime datetime Time of check-in ├ datetime datetime Time of check-in
├ type string Type of scan (defaults to ``entry``) ├ type string Type of scan (defaults to ``entry``)
├ gate integer Internal ID of the gate. Can be ``null``. ├ gate integer Internal ID of the gate. Can be ``null``.
├ device integer Internal ID of the device. Can be ``null``. **Deprecated**, since this ID is not otherwise used in the API and is therefore not very useful. ├ device integer Internal ID of the device. Can be ``null``.
├ device_id integer Attribute ``device_id`` of the device. Can be ``null``.
└ auto_checked_in boolean Indicates if this check-in been performed automatically by the system └ auto_checked_in boolean Indicates if this check-in been performed automatically by the system
downloads list of objects List of ticket download options downloads list of objects List of ticket download options
├ output string Ticket output provider (e.g. ``pdf``, ``passbook``) ├ output string Ticket output provider (e.g. ``pdf``, ``passbook``)
@@ -218,11 +215,6 @@ answers list of objects Answers to user
seat objects The assigned seat. Can be ``null``. seat objects The assigned seat. Can be ``null``.
├ id integer Internal ID of the seat instance ├ id integer Internal ID of the seat instance
├ name string Human-readable seat name ├ name string Human-readable seat name
├ zone_name string Name of the zone the seat is in
├ row_name string Name/number of the row the seat is in
├ row_label string Additional label of the row (or ``null``)
├ seat_number string Number of the seat within the row
├ seat_label string Additional label of the seat (or ``null``)
└ seat_guid string Identifier of the seat within the seating plan └ seat_guid string Identifier of the seat within the seating plan
pdf_data object Data object required for ticket PDF generation. By default, pdf_data object Data object required for ticket PDF generation. By default,
this field is missing. It will be added only if you add the this field is missing. It will be added only if you add the
@@ -463,13 +455,10 @@ List of all orders
:query datetime modified_since: Only return orders that have changed since the given date. Be careful: We only :query datetime modified_since: Only return orders that have changed since the given date. Be careful: We only
recommend using this in combination with ``testmode=false``, since test mode orders can vanish at any time and recommend using this in combination with ``testmode=false``, since test mode orders can vanish at any time and
you will not notice it using this method. you will not notice it using this method.
:query datetime created_since: Only return orders that have been created since the given date (inclusive). :query datetime created_since: Only return orders that have been created since the given date.
:query datetime created_before: Only return orders that have been created before the given date (exclusive).
:query integer subevent: Only return orders with a position that contains this subevent ID. *Warning:* Result will also include orders if they contain mixed subevents, and it will even return orders where the subevent is only contained in a canceled position. :query integer subevent: Only return orders with a position that contains this subevent ID. *Warning:* Result will also include orders if they contain mixed subevents, and it will even return orders where the subevent is only contained in a canceled position.
:query datetime subevent_after: Only return orders that contain a ticket for a subevent taking place after the given date. This is an exclusive after, and it considers the **end** of the subevent (or its start, if the end is not set). :query datetime subevent_after: Only return orders that contain a ticket for a subevent taking place after the given date. This is an exclusive after, and it considers the **end** of the subevent (or its start, if the end is not set).
:query datetime subevent_before: Only return orders that contain a ticket for a subevent taking place after the given date. This is an exclusive before, and it considers the **start** of the subevent. :query datetime subevent_before: Only return orders that contain a ticket for a subevent taking place after the given date. This is an exclusive before, and it considers the **start** of the subevent.
:query string sales_channel: Only return orders with the given sales channel identifier (e.g. ``"web"``).
:query string payment_provider: Only return orders that contain a payment using the given payment provider. Note that this also searches for partial incomplete, or failed payments within the order and is not useful to get a sum of payment amounts without further processing.
:query string exclude: Exclude a field from the output, e.g. ``fees`` or ``positions.downloads``. Can be used as a performance optimization. Can be passed multiple times. :query string exclude: Exclude a field from the output, e.g. ``fees`` or ``positions.downloads``. Can be used as a performance optimization. Can be passed multiple times.
:query string include: Include only the given field in the output, e.g. ``fees`` or ``positions.downloads``. Can be used as a performance optimization. Can be passed multiple times. ``include`` is applied before ``exclude``, so ``exclude`` takes precedence. :query string include: Include only the given field in the output, e.g. ``fees`` or ``positions.downloads``. Can be used as a performance optimization. Can be passed multiple times. ``include`` is applied before ``exclude``, so ``exclude`` takes precedence.
:param organizer: The ``slug`` field of the organizer to fetch :param organizer: The ``slug`` field of the organizer to fetch
@@ -565,7 +554,6 @@ Fetching individual orders
"fees": [], "fees": [],
"total": "23.00", "total": "23.00",
"comment": "", "comment": "",
"api_meta": {},
"custom_followup_at": null, "custom_followup_at": null,
"checkin_attention": false, "checkin_attention": false,
"checkin_text": null, "checkin_text": null,
@@ -746,8 +734,6 @@ Updating order fields
* ``comment`` * ``comment``
* ``api_meta``
* ``custom_followup_at`` * ``custom_followup_at``
* ``invoice_address`` (you always need to supply the full object, or ``null`` to delete the current address) * ``invoice_address`` (you always need to supply the full object, or ``null`` to delete the current address)
-262
View File
@@ -1,262 +0,0 @@
.. _`rest-reusablemedia`:
Seats
=====
The seat resource represents the seats in a seating plan in a specific event or subevent.
Resource description
--------------------
The seat resource contains the following public fields:
.. rst-class:: rest-resource-table
===================================== ========================== =======================================================
Field Type Description
===================================== ========================== =======================================================
id integer Internal ID of this seat
subevent integer Internal ID of the subevent this seat belongs to
zone_name string Name of the zone the seat is in
row_name string Name/number of the row the seat is in
row_label string Additional label of the row (or ``null``)
seat_number string Number of the seat within the row
seat_label string Additional label of the seat (or ``null``)
seat_guid string Identifier of the seat within the seating plan
product integer Internal ID of the product that is mapped to this seat
blocked boolean Whether this seat is blocked manually.
orderposition integer / object Internal ID of an order position reserving this seat.
cartposition integer / object Internal ID of a cart position reserving this seat.
voucher integer / object Internal ID of a voucher reserving this seat.
===================================== ========================== =======================================================
Endpoints
---------
.. http:get:: /api/v1/organizers/(organizer)/events/(event)/seats/
.. http:get:: /api/v1/organizers/(organizer)/events/(event)/subevents/(subevent_id)/seats/
Returns a list of all seats in the specified event or subevent. Depending on whether the event has subevents, the
according endpoint has to be used.
**Example request**:
.. sourcecode:: http
GET /api/v1/organizers/bigevents/events/sampleconf/seats/ HTTP/1.1
Host: pretix.eu
Accept: application/json
**Example response**:
.. sourcecode:: http
HTTP/1.1 200 OK
Vary: Accept
Content-Type: application/json
{
"count": 500,
"next": "https://pretix.eu/api/v1/organizers/bigevents/events/sampleconf/seats/?page=2",
"previous": null,
"results": [
{
"id": 1633,
"subevent": null,
"zone_name": "Ground floor",
"row_name": "1",
"row_label": null,
"seat_number": "1",
"seat_label": null,
"seat_guid": "b9746230-6f31-4f41-bbc9-d6b60bdb3342",
"product": 104,
"blocked": false,
"orderposition": null,
"cartposition": null,
"voucher": 51
},
{
"id": 1634,
"subevent": null,
"zone_name": "Ground floor",
"row_name": "1",
"row_label": null,
"seat_number": "2",
"seat_label": null,
"seat_guid": "1d29fe20-8e1e-4984-b0ee-2773b0d07e07",
"product": 104,
"blocked": true,
"orderposition": 4321,
"cartposition": null,
"voucher": null
},
// ...
]
}
:query integer page: The page number in case of a multi-page result set, default is 1.
:query string zone_name: Only show seats with the given zone_name.
:query string row_name: Only show seats with the given row_name.
:query string row_label: Only show seats with the given row_label.
:query string seat_number: Only show seats with the given seat_number.
:query string seat_label: Only show seats with the given seat_label.
:query string seat_guid: Only show seats with the given seat_guid.
:query boolean blocked: Only show seats with the given blocked status.
:query boolean is_available: Only show seats that are (not) currently available.
:query string expand: If you pass ``"orderposition"``, ``"cartposition"``, or ``"voucher"``, the respective field will be
shown as a nested value instead of just an ID. This requires permission to access that object.
The nested objects are identical to the respective resources, except that order positions
will have an attribute of the format ``"order": {"code": "ABCDE", "event": "eventslug"}`` to make
matching easier, and won't include the `seat` attribute, as that would be redundant.
The parameter can be given multiple times.
:param organizer: The ``slug`` field of the organizer to fetch
:param event: The ``slug`` field of the event to fetch
:param subevent_id: The ``id`` field of the subevent to fetch
:statuscode 200: no error
:statuscode 401: Authentication failure
:statuscode 403: The requested organizer does not exist **or** you have no permission to view this resource.
:statuscode 404: Endpoint without subevent id was used for event with subevents, or vice versa.
.. http:get:: /api/v1/organizers/(organizer)/events/(event)/seats/(id)/
.. http:get:: /api/v1/organizers/(organizer)/events/(event)/subevents/(subevent_id)/seats/(id)/
Returns information on one seat, identified by its ID.
**Example request**:
.. sourcecode:: http
GET /api/v1/organizers/bigevents/events/sampleconf/seats/1634/?expand=orderposition HTTP/1.1
Host: pretix.eu
Accept: application/json
**Example response**:
.. sourcecode:: http
HTTP/1.1 200 OK
Vary: Accept
Content-Type: application/json
{
"id": 1634,
"subevent": null,
"zone_name": "Ground floor",
"row_name": "1",
"row_label": null,
"seat_number": "2",
"seat_label": null,
"seat_guid": "1d29fe20-8e1e-4984-b0ee-2773b0d07e07",
"product": 104,
"blocked": true,
"orderposition": {
"id": 134,
"order": {
"code": "U0HW7",
"event": "sampleconf"
},
"positionid": 1,
"item": 104,
"variation": 59,
"price": "60.00",
"attendee_name": "",
"attendee_name_parts": {
"_scheme": "given_family"
},
"company": null,
"street": null,
"zipcode": null,
"city": null,
"country": null,
"state": null,
"discount": null,
"attendee_email": null,
"voucher": null,
"tax_rate": "0.00",
"tax_value": "0.00",
"secret": "4rfgp263jduratnsvwvy6cc6r6wnptbj",
"addon_to": null,
"subevent": null,
"checkins": [],
"downloads": [],
"answers": [],
"tax_rule": null,
"pseudonymization_id": "ZSNYSG3URZ",
"canceled": false,
"valid_from": null,
"valid_until": null,
"blocked": null,
"voucher_budget_use": null
},
"cartposition": null,
"voucher": null
}
:param organizer: The ``slug`` field of the organizer to fetch
:param event: The ``slug`` field of the event to fetch
:param subevent_id: The ``id`` field of the subevent to fetch
:param id: The ``id`` field of the seat to fetch
:query string expand: If you pass ``"orderposition"``, ``"cartposition"``, or ``"voucher"``, the respective field will be
shown as a nested value instead of just an ID. This requires permission to access that object.
The nested objects are identical to the respective resources, except that order positions
will have an attribute of the format ``"order": {"code": "ABCDE", "event": "eventslug"}`` to make
matching easier, and won't include the `seat` attribute, as that would be redundant.
The parameter can be given multiple times.
:statuscode 200: no error
:statuscode 401: Authentication failure
:statuscode 403: The requested organizer does not exist **or** you have no permission to view this resource.
:statuscode 404: Seat does not exist; or the endpoint without subevent id was used for event with subevents, or vice versa.
.. http:patch:: /api/v1/organizers/(organizer)/events/(event)/seats/(id)/
.. http:patch:: /api/v1/organizers/(organizer)/events/(event)/subevents/(id)/seats/(id)/
Update a seat.
You can only change the ``blocked`` field.
**Example request**:
.. sourcecode:: http
PATCH /api/v1/organizers/bigevents/events/sampleconf/seats/1636/ HTTP/1.1
Host: pretix.eu
Accept: application/json, text/javascript
Content-Type: application/json
{
"blocked": true
}
**Example response**:
.. sourcecode:: http
HTTP/1.1 200 OK
Vary: Accept
Content-Type: application/json
{
"id": 1636,
"subevent": null,
"zone_name": "Ground floor",
"row_name": "1",
"row_label": null,
"seat_number": "4",
"seat_label": null,
"seat_guid": "6c0e29e5-05d6-421f-99f3-afd01478ecad",
"product": 104,
"blocked": true,
"orderposition": null,
"cartposition": null,
"voucher": null
},
:param organizer: The ``slug`` field of the organizer to modify
:param event: The ``slug`` field of the event to modify
:param subevent_id: The ``id`` field of the subevent to modify
:param id: The ``id`` field of the seat to modify
:statuscode 200: no error
:statuscode 400: The seat could not be modified due to invalid submitted data
:statuscode 401: Authentication failure
:statuscode 403: The requested organizer or event does not exist **or** you have no permission to change this resource.
:statuscode 404: Seat does not exist; or the endpoint without subevent id was used for event with subevents, or vice versa.
-3
View File
@@ -1,8 +1,6 @@
Scheduled email rules Scheduled email rules
===================== =====================
This feature requires the bundled ``pretix.plugins.sendmail`` plugin to be active for the event in order to work properly.
Resource description Resource description
-------------------- --------------------
@@ -50,7 +48,6 @@ send_to string Can be ``"order
or ``"both"``. or ``"both"``.
date. Otherwise it is relative to the event start date. date. Otherwise it is relative to the event start date.
===================================== ========================== ======================================================= ===================================== ========================== =======================================================
.. versionchanged:: 2023.7 .. versionchanged:: 2023.7
The ``include_pending`` field has been deprecated. The ``include_pending`` field has been deprecated.
+2 -3
View File
@@ -20,9 +20,8 @@ internal_name string An optional nam
rate decimal (string) Tax rate in percent rate decimal (string) Tax rate in percent
price_includes_tax boolean If ``true`` (default), tax is assumed to be included in price_includes_tax boolean If ``true`` (default), tax is assumed to be included in
the specified product price the specified product price
eu_reverse_charge boolean **DEPRECATED**. If ``true``, EU reverse charge rules eu_reverse_charge boolean If ``true``, EU reverse charge rules are applied. Will
are applied. Will be ignored if custom rules are set. be ignored if custom rules are set.
Use custom rules instead.
home_country string Merchant country (required for reverse charge), can be home_country string Merchant country (required for reverse charge), can be
``null`` or empty string ``null`` or empty string
keep_gross_if_rate_changes boolean If ``true``, changes of the tax rate based on custom keep_gross_if_rate_changes boolean If ``true``, changes of the tax rate based on custom
-2
View File
@@ -41,7 +41,6 @@ The following values for ``action_types`` are valid with pretix core:
* ``pretix.event.order.modified`` * ``pretix.event.order.modified``
* ``pretix.event.order.contact.changed`` * ``pretix.event.order.contact.changed``
* ``pretix.event.order.changed.*`` * ``pretix.event.order.changed.*``
* ``pretix.event.order.deleted`` (can only occur for test mode orders)
* ``pretix.event.order.refund.created`` * ``pretix.event.order.refund.created``
* ``pretix.event.order.refund.created.externally`` * ``pretix.event.order.refund.created.externally``
* ``pretix.event.order.refund.requested`` * ``pretix.event.order.refund.requested``
@@ -116,7 +115,6 @@ Endpoints
} }
:query integer page: The page number in case of a multi-page result set, default is 1 :query integer page: The page number in case of a multi-page result set, default is 1
:query boolean enabled: Only show webhooks that are or are not enabled
:param organizer: The ``slug`` field of the organizer to fetch :param organizer: The ``slug`` field of the organizer to fetch
:statuscode 200: no error :statuscode 200: no error
:statuscode 401: Authentication failure :statuscode 401: Authentication failure
+2 -2
View File
@@ -35,11 +35,11 @@ Frontend
-------- --------
.. automodule:: pretix.presale.signals .. automodule:: pretix.presale.signals
:members: html_head, html_footer, footer_link, global_footer_link, front_page_top, front_page_bottom, front_page_bottom_widget, fee_calculation_for_cart, contact_form_fields, question_form_fields, contact_form_fields_overrides, question_form_fields_overrides, checkout_confirm_messages, checkout_confirm_page_content, checkout_all_optional, html_page_header, render_seating_plan, checkout_flow_steps, position_info, position_info_top, item_description, global_html_head, global_html_footer, global_html_page_header, seatingframe_html_head :members: html_head, html_footer, footer_link, global_footer_link, front_page_top, front_page_bottom, front_page_bottom_widget, fee_calculation_for_cart, contact_form_fields, question_form_fields, contact_form_fields_overrides, question_form_fields_overrides, checkout_confirm_messages, checkout_confirm_page_content, checkout_all_optional, html_page_header, render_seating_plan, checkout_flow_steps, position_info, position_info_top, item_description, global_html_head, global_html_footer, global_html_page_header
.. automodule:: pretix.presale.signals .. automodule:: pretix.presale.signals
:members: order_info, order_info_top, order_meta_from_request, order_api_meta_from_request :members: order_info, order_info_top, order_meta_from_request
Request flow Request flow
"""""""""""" """"""""""""
+1 -1
View File
@@ -17,7 +17,7 @@ The project pretix is split into several components. The main components are:
create and manage their events, items, orders and tickets. create and manage their events, items, orders and tickets.
**presale** **presale**
This is the ticket shop itself, containing all of the parts visible to the This is the ticket-shop itself, containing all of the parts visible to the
end user. Also called "frontend" in parts of this documentation. end user. Also called "frontend" in parts of this documentation.
**api** **api**
+3 -1
View File
@@ -136,7 +136,9 @@ It is a good idea to put this command into your git hook ``.git/hooks/pre-commit
for example, to check for any errors in any staged files when committing:: for example, to check for any errors in any staged files when committing::
#!/bin/bash #!/bin/bash
cd $GIT_DIR/../src
export GIT_WORK_TREE=../
export GIT_DIR=../.git
source ../env/bin/activate # Adjust to however you activate your virtual environment source ../env/bin/activate # Adjust to however you activate your virtual environment
for file in $(git diff --cached --name-only | grep -E '\.py$' | grep -Ev "migrations|mt940\.py|pretix/settings\.py|make_testdata\.py|testutils/settings\.py|tests/settings\.py|pretix/base/models/__init__\.py|.*_pb2\.py") for file in $(git diff --cached --name-only | grep -E '\.py$' | grep -Ev "migrations|mt940\.py|pretix/settings\.py|make_testdata\.py|testutils/settings\.py|tests/settings\.py|pretix/base/models/__init__\.py|.*_pb2\.py")
do do
-105
View File
@@ -1,105 +0,0 @@
GetYourGuide
============
.. note::
The GetYourGuide integration is currently in Beta. Please contact support@pretix.eu to enable the integration
for your pretix.eu organizer account.
Introduction
------------
Using third party aggregators, such als GetYourGuide, event organizers can sell tickets to their events not only on
their own ticket-shop but also on the aggregator's portal. While this service is not for free, it allows event
organizers to reacher a larger audience that would otherwise not have found their way into the organizers webshop.
Using pretix' integration with GetYourGuide, event organizers can profit from an additional sales and revenue channel,
while keeping the effort for setting up and maintaining multiple ticket shops to a minimum.
Preparing your organizer account
--------------------------------
The first step in enabling the GetYourGuide integration, is to setup a corresponding Sales Channel, which will be used
to properly attribute the sales generated. This needs to be done only once per organizer account.
To do so, log into the pretix backend, select ``Organizers`` from the navigation and then the organizer in question.
Extending the ``Settings``-menu, find the ``Sales channels`` configuration and click the ``Add a new channel`` button.
On the following page, you will be able to select ``GetYourGuide`` as the sales channel type and give it a custom name.
Preparing your event
--------------------
In order to now sell your events on GetYourGuide, you will need to configure each event in question.
1. Enabling the plugin
Within your event, extend the ``Settings`` menu and navigate to ``Plugins``. Activate the plugin in the
``Integrations`` tab.
2. Sell the event on the sales channel
Pick the sales channel or channels, on which you would like to sell your event by navigating to the event's general
settings page using the ``Sell on all sales channels`` or ``Restrict to specific sales channels`` checkboxes.
3. Configure one or more products to be sold on GetYourGuide
Either create a new or edit an existing product, that you would like to sell on GetYourGuide. To do so, you will
need to have checked the ``Sell on all sales channels`` or appropriate ``Restrict to specific sales channels``
checkbox of the product within it's ``Availability`` tab.
In addition, you will also need to set the GetYourGuide equivalent ticket category in the product's accordingly
named settings tab. Within your event, there can be only one product per ticket category. Depending on your further
configuration, you must at least select one product to be in the ``Adult`` or ``Group`` category.
4. Configuring the GetYourGuide-plugin
Once you have configured one or more products to be eligible to be sold on GetYourGuide, you'll need to configure a
few basic settings within the event (``Settings`` --> ``GetYourGuide``). The most important settings can be found
the in the ``Configuration`` tab, such as the location of the event on sale.
Ticket Categories
-----------------
While pretix only uses the ticket category term loosely to group together multiple products for nicer display,
GetYourGuide is relying on the ticket categories to price the tickets.
First of all, you need to make the decision on how you are planning on selling your tickets on GetYourGuide - in most
cases, this will reflect your current sales strategy within your pretix shop.
- Individual tickets
Every single person attending will need to purchase their own ticket. A family of two adults and two
children will have to purchase and pay for a total of 4 tickets.
In this case, you will need to offer *at least* a ticket of the ``Adult`` type, but may offer any other ticket
category type (Child, Youth, Senior, ...) in addition. But you cannot offer a ``Group`` ticket.
- Group tickets
Two groups, consisting of 10 and 20 participants respectively, won't need to purchase a total of 30 tickets, but
rather two group tickets. It is up to you to configure the group size limits within the GetYourGuide-settings of your
product.
Choosing this option, you cannot offer any other ticket categories besides ``Group``.
Setting up event dates and quotas
---------------------------------
Of course, in addition to creating products, you will also need to add them to a quota for them to be available for
sale. The process for doing this is the very same as for any regular event or event series.
.. note::
When selling individual tickets through GetYourGuide, you will not be able to offer differing quantities for
individual ticket categories.
For this reason, we recommend to place all GetYourGuide-eligible products into the same quota. Should you however opt
to create multiple quotas which create an imbalance, pretix will report only the available number of tickets for the
lowest relevant quota.
Connecting your event to GetYourGuide
-------------------------------------
Once you have set up your event and products and performed all necessary configuration, you may want to use the
Analyzer-feature of our GetYourGuide-plugin (``Settings`` -> ``GetYourGuide`` -> tab ``Analyzer``).
The Analyzer should not display any blocking error messages and at least one event date that is ready for publishing on
the GetYourGuide platform.
At this point, you will need to setup your event (called ``product`` in the GetYourGuide universe) on their
`Supplier Portal`_ and connect it with your pretix shop. To do so, please follow the
`Connecting a new product to your Reservation System`_ on the GetYourGuide Supply Partner Help Center.
Select ``pretix.eu`` as your reservation system; the required ``product ID`` can be found in the ``Configuration`` tab
of the GetYourGuide plugin settings page.
From this point on, GetYourGuide will automatically import the availabilities and products and offer them for sale.
.. _Supplier Portal: https://suppliers.getyourguide.com/
.. _Connecting a new product to your Reservation System: https://supply.getyourguide.support/hc/en-us/articles/18008029689373-Connecting-a-new-product-to-your-Reservation-system
-1
View File
@@ -25,4 +25,3 @@ If you want to **create** a plugin, please go to the
webinar webinar
presale-saml presale-saml
kulturpass kulturpass
getyourguide
+2 -1
View File
@@ -1,4 +1,4 @@
sphinx==7.4.* sphinx==7.3.*
jinja2==3.1.* jinja2==3.1.*
sphinx-rtd-theme sphinx-rtd-theme
sphinxcontrib-httpdomain sphinxcontrib-httpdomain
@@ -6,4 +6,5 @@ sphinxcontrib-images
sphinxcontrib-jquery sphinxcontrib-jquery
sphinxcontrib-spelling==8.* sphinxcontrib-spelling==8.*
sphinxemoji sphinxemoji
pygments-markdown-lexer
pyenchant==3.2.* pyenchant==3.2.*
+2 -1
View File
@@ -1,5 +1,5 @@
-e ../ -e ../
sphinx==7.4.* sphinx==7.3.*
jinja2==3.1.* jinja2==3.1.*
sphinx-rtd-theme sphinx-rtd-theme
sphinxcontrib-httpdomain sphinxcontrib-httpdomain
@@ -7,4 +7,5 @@ sphinxcontrib-images
sphinxcontrib-jquery sphinxcontrib-jquery
sphinxcontrib-spelling==8.* sphinxcontrib-spelling==8.*
sphinxemoji sphinxemoji
pygments-markdown-lexer
pyenchant==3.2.* pyenchant==3.2.*
+6 -3
View File
@@ -31,7 +31,8 @@ Android 9 Support planned until at least 12/2025.
Android 8 Support planned until at least 12/2025. Android 8 Support planned until at least 12/2025.
Android 7 Support planned until at least 06/2025. Android 7 Support planned until at least 06/2025.
Android 6 Support planned until at least 06/2025. Android 6 Support planned until at least 06/2025.
Android 5 Support planned until at least 06/2025. Android 5 | Support planned until at least 06/2025.
| No support for COVID certificate verification.
Android 4 Support dropped. Android 4 Support dropped.
=========================== ========================================================== =========================== ==========================================================
@@ -56,17 +57,16 @@ Android 8 | Support planned until at least 12/2025.
Android 7 | Support planned until at least 12/2024. Android 7 | Support planned until at least 12/2024.
| Support for Stripe Terminal to be dropped 05/2024. | Support for Stripe Terminal to be dropped 05/2024.
| No support for Cryptovision TSE. | No support for Cryptovision TSE.
| No support for SumUp.
Android 6 | Support planned until at least 12/2024. Android 6 | Support planned until at least 12/2024.
| No support for Cryptovision TSE. | No support for Cryptovision TSE.
| No support for Fiskal Cloud. | No support for Fiskal Cloud.
| No support for Stripe Terminal. | No support for Stripe Terminal.
| No support for SumUp.
Android 5 | Support planned until at least 12/2024. Android 5 | Support planned until at least 12/2024.
| No support for Cryptovision TSE. | No support for Cryptovision TSE.
| No support for Fiskal Cloud. | No support for Fiskal Cloud.
| No support for Stripe Terminal. | No support for Stripe Terminal.
| No support for SumUp. | No support for SumUp.
| No support for COVID certificate verification.
Android 4 Support dropped. Android 4 Support dropped.
=========================== ========================================================== =========================== ==========================================================
@@ -87,6 +87,9 @@ Android 7 Support planned until at least 06/2025.
Android 6 Support planned until at least 06/2025. Android 6 Support planned until at least 06/2025.
Android 5 | Support planned until at least 06/2025. Android 5 | Support planned until at least 06/2025.
| No support for Evolis printers on some devices. | No support for Evolis printers on some devices.
Android 4.4 | Support planned until at least 06/2024.
| No support for USB printers.
| No support for Evolis printers.
Android 4 Support dropped. Android 4 Support dropped.
=========================== ========================================================== =========================== ==========================================================
+1 -1
View File
@@ -175,7 +175,7 @@ without any special behavior.
Connecting SSO providers (pretix as the SSO client) Connecting SSO providers (pretix as the SSO client)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
To connect an external application as a SSO provider, go to "Customer accounts" → "SSO providers" → "Create a new SSO provider" To connect an external application as a SSO client, go to "Customer accounts" → "SSO providers" → "Create a new SSO provider"
in your organizer account. in your organizer account.
.. thumbnail:: ../../screens/organizer/customer_ssoprovider_add.png .. thumbnail:: ../../screens/organizer/customer_ssoprovider_add.png
-23
View File
@@ -449,29 +449,6 @@ Further reading:
* `Stripe Payment Method Domain registration`_ * `Stripe Payment Method Domain registration`_
Content Security Policy
-----------------------
When using a Content Security Policy (CSP) on your website, you may need to make some adjustments. If your pretix
shop is running under a custom domain, you need to add the following rules:
* ``script-src``: ``'unsafe-eval' https://pretix.eu`` (adjust to your domain for self-hosted pretix)
* ``style-src``: ``https://pretix.eu`` (adjust to your domain for self-hosted pretix **and** for custom domain on pretix Hosted)
* ``connect-src``: ``https://pretix.eu`` (adjust to your domain for self-hosted pretix **and** for custom domain on pretix Hosted)
* ``frame-src``: ``https://pretix.eu`` (adjust to your domain for self-hosted pretix **and** for custom domain on pretix Hosted)
* ``img-src``: ``https://pretix.eu`` (adjust to your domain for self-hosted pretix **and** for custom domain on pretix Hosted) and for pretix Hosted additionally add ``https://cdn.pretix.space``
External payment providers and Cross-Origin-Opener-Policy
---------------------------------------------------------
If you use a payment provider that opens a new window during checkout (such as PayPal), be aware that setting
``Cross-Origin-Opener-Policy: same-origin`` results in an empty popup-window being opened in the foreground. This is
due to JavaScript not having access to the opened window. To mitigate this, you either need to always open the widgets
checkout in a new tab (see :ref:`Always open a new tab`) or set ``Cross-Origin-Opener-Policy: same-origin-allow-popups``
Working with Cross-Origin-Embedder-Policy Working with Cross-Origin-Embedder-Policy
----------------------------------------- -----------------------------------------
+19 -17
View File
@@ -22,7 +22,7 @@ classifiers = [
"Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.11",
"Framework :: Django :: 4.2", "Framework :: Django :: 4.1",
] ]
dependencies = [ dependencies = [
@@ -35,15 +35,16 @@ dependencies = [
"cryptography>=3.4.2", "cryptography>=3.4.2",
"css-inline==0.14.*", "css-inline==0.14.*",
"defusedcsv>=1.1.0", "defusedcsv>=1.1.0",
"Django[argon2]==4.2.*,>=4.2.15", "dj-static",
"django-bootstrap3==24.3", "Django[argon2]==4.2.*",
"django-compressor==4.5.1", "django-bootstrap3==24.2",
"django-compressor==4.5",
"django-countries==7.6.*", "django-countries==7.6.*",
"django-filter==24.3", "django-filter==24.2",
"django-formset-js-improved==0.5.0.3", "django-formset-js-improved==0.5.0.3",
"django-formtools==2.5.1", "django-formtools==2.5.1",
"django-hierarkey==1.2.*", "django-hierarkey==1.2.*",
"django-hijack==3.6.*", "django-hijack==3.5.*",
"django-i18nfield==1.9.*,>=1.9.4", "django-i18nfield==1.9.*,>=1.9.4",
"django-libsass==0.9", "django-libsass==0.9",
"django-localflavor==4.0", "django-localflavor==4.0",
@@ -61,10 +62,10 @@ dependencies = [
"importlib_metadata==8.*", # Polyfill, we can probably drop this once we require Python 3.10+ "importlib_metadata==8.*", # Polyfill, we can probably drop this once we require Python 3.10+
"isoweek", "isoweek",
"jsonschema", "jsonschema",
"kombu==5.4.*", "kombu==5.3.*",
"libsass==0.23.*", "libsass==0.23.*",
"lxml", "lxml",
"markdown==3.7", # 3.3.5 requires importlib-metadata>=4.4, but django-bootstrap3 requires importlib-metadata<3. "markdown==3.6", # 3.3.5 requires importlib-metadata>=4.4, but django-bootstrap3 requires importlib-metadata<3.
# We can upgrade markdown again once django-bootstrap3 upgrades or once we drop Python 3.6 and 3.7 # We can upgrade markdown again once django-bootstrap3 upgrades or once we drop Python 3.6 and 3.7
"mt-940==4.30.*", "mt-940==4.30.*",
"oauthlib==3.2.*", "oauthlib==3.2.*",
@@ -72,17 +73,17 @@ dependencies = [
"packaging", "packaging",
"paypalrestsdk==1.13.*", "paypalrestsdk==1.13.*",
"paypal-checkout-serversdk==1.0.*", "paypal-checkout-serversdk==1.0.*",
"PyJWT==2.9.*", "PyJWT==2.8.*",
"phonenumberslite==8.13.*", "phonenumberslite==8.13.*",
"Pillow==10.4.*", "Pillow==10.3.*",
"pretix-plugin-build", "pretix-plugin-build",
"protobuf==5.28.*", "protobuf==5.27.*",
"psycopg2-binary", "psycopg2-binary",
"pycountry", "pycountry",
"pycparser==2.22", "pycparser==2.22",
"pycryptodome==3.20.*", "pycryptodome==3.20.*",
"pypdf==5.0.*", "pypdf==4.2.*",
"python-bidi==0.6.*", # Support for Arabic in reportlab "python-bidi==0.4.*", # Support for Arabic in reportlab
"python-dateutil==2.9.*", "python-dateutil==2.9.*",
"pytz", "pytz",
"pytz-deprecation-shim==0.1.*", "pytz-deprecation-shim==0.1.*",
@@ -91,9 +92,10 @@ dependencies = [
"redis==5.0.*", "redis==5.0.*",
"reportlab==4.2.*", "reportlab==4.2.*",
"requests==2.31.*", "requests==2.31.*",
"sentry-sdk==2.14.*", "sentry-sdk==2.5.*",
"sepaxml==2.6.*", "sepaxml==2.6.*",
"slimit", "slimit",
"static3==0.7.*",
"stripe==7.9.*", "stripe==7.9.*",
"text-unidecode==1.*", "text-unidecode==1.*",
"tlds>=2020041600", "tlds>=2020041600",
@@ -108,10 +110,10 @@ dependencies = [
[project.optional-dependencies] [project.optional-dependencies]
memcached = ["pylibmc"] memcached = ["pylibmc"]
dev = [ dev = [
"aiohttp==3.10.*", "aiohttp==3.9.*",
"coverage", "coverage",
"coveralls", "coveralls",
"fakeredis==2.24.*", "fakeredis==2.23.*",
"flake8==7.1.*", "flake8==7.1.*",
"freezegun", "freezegun",
"isort==5.13.*", "isort==5.13.*",
@@ -125,7 +127,7 @@ dev = [
"pytest-rerunfailures==14.*", "pytest-rerunfailures==14.*",
"pytest-sugar", "pytest-sugar",
"pytest-xdist==3.6.*", "pytest-xdist==3.6.*",
"pytest==8.3.*", "pytest==8.2.*",
"responses", "responses",
] ]
+1 -1
View File
@@ -19,4 +19,4 @@
# You should have received a copy of the GNU Affero General Public License along with this program. If not, see # You should have received a copy of the GNU Affero General Public License along with this program. If not, see
# <https://www.gnu.org/licenses/>. # <https://www.gnu.org/licenses/>.
# #
__version__ = "2024.10.0.dev0" __version__ = "2024.7.0.dev0"
-2
View File
@@ -62,7 +62,6 @@ INSTALLED_APPS = [
'pretix.plugins.badges', 'pretix.plugins.badges',
'pretix.plugins.manualpayment', 'pretix.plugins.manualpayment',
'pretix.plugins.returnurl', 'pretix.plugins.returnurl',
'pretix.plugins.autocheckin',
'pretix.plugins.webcheckin', 'pretix.plugins.webcheckin',
'django_countries', 'django_countries',
'oauth2_provider', 'oauth2_provider',
@@ -80,7 +79,6 @@ ALL_LANGUAGES = [
('de', _('German')), ('de', _('German')),
('de-informal', _('German (informal)')), ('de-informal', _('German (informal)')),
('ar', _('Arabic')), ('ar', _('Arabic')),
('eu', _('Basque')),
('ca', _('Catalan')), ('ca', _('Catalan')),
('zh-hans', _('Chinese (simplified)')), ('zh-hans', _('Chinese (simplified)')),
('zh-hant', _('Chinese (traditional)')), ('zh-hant', _('Chinese (traditional)')),
-82
View File
@@ -1,82 +0,0 @@
#
# This file is part of pretix (Community Edition).
#
# Copyright (C) 2014-2020 Raphael Michel and contributors
# Copyright (C) 2020-2021 rami.io GmbH and contributors
#
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General
# Public License as published by the Free Software Foundation in version 3 of the License.
#
# ADDITIONAL TERMS APPLY: Pursuant to Section 7 of the GNU Affero General Public License, additional terms are
# applicable granting you additional permissions and placing additional restrictions on your usage of this software.
# Please refer to the pretix LICENSE file to obtain the full terms applicable to this work. If you did not receive
# this file, see <https://pretix.eu/about/en/license>.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along with this program. If not, see
# <https://www.gnu.org/licenses/>.
#
from django import forms
from django.core.exceptions import ValidationError
from django.db.models import Q
from django.db.models.constants import LOOKUP_SEP
from django.forms import MultipleChoiceField
from django_filters import Filter
from django_filters.conf import settings
class MultipleCharField(forms.CharField):
widget = forms.MultipleHiddenInput
def to_python(self, value):
if not value:
return []
elif not isinstance(value, (list, tuple)):
raise ValidationError(
MultipleChoiceField.default_error_messages["invalid_list"], code="invalid_list"
)
return [str(val) for val in value]
class MultipleCharFilter(Filter):
"""
This filter performs OR(by default) or AND(using conjoined=True) query
on the selected inputs.
"""
field_class = MultipleCharField
def __init__(self, *args, **kwargs):
self.conjoined = kwargs.pop("conjoined", False)
super().__init__(*args, **kwargs)
def filter(self, qs, value):
if not value:
# Even though not a noop, no point filtering if empty.
return qs
if not self.conjoined:
q = Q()
for v in set(value):
predicate = self.get_filter_predicate(v)
if self.conjoined:
qs = self.get_method(qs)(**predicate)
else:
q |= Q(**predicate)
if not self.conjoined:
qs = self.get_method(qs)(q)
return qs.distinct() if self.distinct else qs
def get_filter_predicate(self, v):
name = self.field_name
if name and self.lookup_expr != settings.DEFAULT_LOOKUP_EXPR:
name = LOOKUP_SEP.join([name, self.lookup_expr])
try:
return {name: getattr(v, self.field.to_field_name)}
except (AttributeError, TypeError):
return {name: v}
+1 -4
View File
@@ -21,9 +21,8 @@
# #
import json import json
from django.db.models import prefetch_related_objects from django.core.exceptions import ValidationError
from rest_framework import serializers from rest_framework import serializers
from rest_framework.exceptions import ValidationError
class AsymmetricField(serializers.Field): class AsymmetricField(serializers.Field):
@@ -81,7 +80,6 @@ class SalesChannelMigrationMixin:
def to_internal_value(self, data): def to_internal_value(self, data):
if "sales_channels" in data: if "sales_channels" in data:
prefetch_related_objects([self.organizer], "sales_channels")
all_channels = { all_channels = {
s.identifier for s in s.identifier for s in
self.organizer.sales_channels.all() self.organizer.sales_channels.all()
@@ -111,7 +109,6 @@ class SalesChannelMigrationMixin:
def to_representation(self, value): def to_representation(self, value):
value = super().to_representation(value) value = super().to_representation(value)
if value.get("all_sales_channels"): if value.get("all_sales_channels"):
prefetch_related_objects([self.organizer], "sales_channels")
value["sales_channels"] = sorted([ value["sales_channels"] = sorted([
s.identifier for s in s.identifier for s in
self.organizer.sales_channels.all() self.organizer.sales_channels.all()
+3 -84
View File
@@ -35,7 +35,7 @@
import logging import logging
from django.conf import settings from django.conf import settings
from django.core.exceptions import PermissionDenied, ValidationError from django.core.exceptions import ValidationError
from django.db import transaction from django.db import transaction
from django.utils.crypto import get_random_string from django.utils.crypto import get_random_string
from django.utils.functional import cached_property from django.utils.functional import cached_property
@@ -52,8 +52,7 @@ from pretix.api.serializers import (
from pretix.api.serializers.i18n import I18nAwareModelSerializer from pretix.api.serializers.i18n import I18nAwareModelSerializer
from pretix.api.serializers.settings import SettingsSerializer from pretix.api.serializers.settings import SettingsSerializer
from pretix.base.models import ( from pretix.base.models import (
CartPosition, Device, Event, OrderPosition, SalesChannel, Seat, TaxRule, Device, Event, SalesChannel, TaxRule, TeamAPIToken,
TeamAPIToken, Voucher,
) )
from pretix.base.models.event import SubEvent from pretix.base.models.event import SubEvent
from pretix.base.models.items import ( from pretix.base.models.items import (
@@ -282,17 +281,13 @@ class EventSerializer(SalesChannelMigrationMixin, I18nAwareModelSerializer):
from pretix.base.plugins import get_all_plugins from pretix.base.plugins import get_all_plugins
plugins_available = { plugins_available = {
p.module: p for p in get_all_plugins(self.instance) p.module for p in get_all_plugins(self.instance)
if not p.name.startswith('.') and getattr(p, 'visible', True) if not p.name.startswith('.') and getattr(p, 'visible', True)
} }
settings_holder = self.instance if self.instance and self.instance.pk else self.context['organizer']
for plugin in value.get('plugins'): for plugin in value.get('plugins'):
if plugin not in plugins_available: if plugin not in plugins_available:
raise ValidationError(_('Unknown plugin: \'{name}\'.').format(name=plugin)) raise ValidationError(_('Unknown plugin: \'{name}\'.').format(name=plugin))
if getattr(plugins_available[plugin], 'restricted', False):
if plugin not in settings_holder.settings.allowed_restricted_plugins:
raise ValidationError(_('Restricted plugin: \'{name}\'.').format(name=plugin))
return value return value
@@ -845,7 +840,6 @@ class EventSettingsSerializer(SettingsSerializer):
'reusable_media_type_nfc_mf0aes_autocreate_giftcard', 'reusable_media_type_nfc_mf0aes_autocreate_giftcard',
'reusable_media_type_nfc_mf0aes_autocreate_giftcard_currency', 'reusable_media_type_nfc_mf0aes_autocreate_giftcard_currency',
'reusable_media_type_nfc_mf0aes_random_uid', 'reusable_media_type_nfc_mf0aes_random_uid',
'seating_allow_blocked_seats_for_channel',
] ]
readonly_fields = [ readonly_fields = [
# These are read-only since they are currently only settable on organizers, not events # These are read-only since they are currently only settable on organizers, not events
@@ -896,7 +890,6 @@ class DeviceEventSettingsSerializer(EventSettingsSerializer):
'locale', 'locale',
'last_order_modification_date', 'last_order_modification_date',
'show_quota_left', 'show_quota_left',
'show_dates_on_frontpage',
'max_items_per_order', 'max_items_per_order',
'attendee_names_asked', 'attendee_names_asked',
'attendee_names_required', 'attendee_names_required',
@@ -972,77 +965,3 @@ class ItemMetaPropertiesSerializer(I18nAwareModelSerializer):
class Meta: class Meta:
model = ItemMetaProperty model = ItemMetaProperty
fields = ('id', 'name', 'default', 'required', 'allowed_values') fields = ('id', 'name', 'default', 'required', 'allowed_values')
def prefetch_by_id(items, qs, id_attr, target_attr):
"""
Prefetches a related object on each item in the given list of items by searching by id or another
unique field. The id value is read from the attribute on item specified in `id_attr`, searched on queryset `qs` by
the primary key, and the resulting prefetched model object is stored into `target_attr` on the item.
"""
ids = [getattr(item, id_attr) for item in items if getattr(item, id_attr)]
if ids:
result = qs.in_bulk(id_list=ids)
for item in items:
setattr(item, target_attr, result.get(getattr(item, id_attr)))
class SeatSerializer(I18nAwareModelSerializer):
orderposition = serializers.IntegerField(source='orderposition_id')
cartposition = serializers.IntegerField(source='cartposition_id')
voucher = serializers.IntegerField(source='voucher_id')
class Meta:
model = Seat
read_only_fields = (
'id', 'subevent', 'zone_name', 'row_name', 'row_label',
'seat_number', 'seat_label', 'seat_guid', 'product',
'orderposition', 'cartposition', 'voucher',
)
fields = (
'id', 'subevent', 'zone_name', 'row_name', 'row_label',
'seat_number', 'seat_label', 'seat_guid', 'product', 'blocked',
'orderposition', 'cartposition', 'voucher',
)
def prefetch_expanded_data(self, items, request, expand_fields):
if 'orderposition' in expand_fields:
if 'can_view_orders' not in request.eventpermset:
raise PermissionDenied('can_view_orders permission required for expand=orderposition')
prefetch_by_id(items, OrderPosition.objects.prefetch_related('order'), 'orderposition_id', 'orderposition')
if 'cartposition' in expand_fields:
if 'can_view_orders' not in request.eventpermset:
raise PermissionDenied('can_view_orders permission required for expand=cartposition')
prefetch_by_id(items, CartPosition.objects, 'cartposition_id', 'cartposition')
if 'voucher' in expand_fields:
if 'can_view_vouchers' not in request.eventpermset:
raise PermissionDenied('can_view_vouchers permission required for expand=voucher')
prefetch_by_id(items, Voucher.objects, 'voucher_id', 'voucher')
def __init__(self, instance, *args, **kwargs):
if not kwargs.get('data'):
self.prefetch_expanded_data(instance if hasattr(instance, '__iter__') else [instance],
kwargs['context']['request'],
kwargs['context']['expand_fields'])
super().__init__(instance, *args, **kwargs)
if 'orderposition' in self.context['expand_fields']:
from pretix.api.serializers.media import (
NestedOrderPositionSerializer,
)
self.fields['orderposition'] = NestedOrderPositionSerializer(read_only=True, context=self.context['order_context'])
try:
del self.fields['orderposition'].fields['seat']
except KeyError:
pass
if 'cartposition' in self.context['expand_fields']:
from pretix.api.serializers.cart import CartPositionSerializer
self.fields['cartposition'] = CartPositionSerializer(read_only=True)
del self.fields['cartposition'].fields['seat']
if 'voucher' in self.context['expand_fields']:
from pretix.api.serializers.voucher import VoucherSerializer
self.fields['voucher'] = VoucherSerializer(read_only=True)
del self.fields['voucher'].fields['seat']
+1 -11
View File
@@ -76,9 +76,7 @@ class InlineItemVariationSerializer(SalesChannelMigrationMixin, I18nAwareModelSe
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
self.fields['require_membership_types'].queryset = lazy(lambda: self.context['event'].organizer.membership_types.all(), QuerySet) self.fields['require_membership_types'].queryset = lazy(lambda: self.context['event'].organizer.membership_types.all(), QuerySet)
self.fields['limit_sales_channels'].child_relation.queryset = ( self.fields['limit_sales_channels'].child_relation.queryset = lazy(lambda: self.context['event'].organizer.sales_channels.all(), QuerySet)
self.context['event'].organizer.sales_channels.all() if 'event' in self.context else SalesChannel.objects.none()
)
def validate_meta_data(self, value): def validate_meta_data(self, value):
for key in value['meta_data'].keys(): for key in value['meta_data'].keys():
@@ -117,15 +115,11 @@ class ItemVariationSerializer(SalesChannelMigrationMixin, I18nAwareModelSerializ
def create(self, validated_data): def create(self, validated_data):
meta_data = validated_data.pop('meta_data', None) meta_data = validated_data.pop('meta_data', None)
require_membership_types = validated_data.pop('require_membership_types', []) require_membership_types = validated_data.pop('require_membership_types', [])
limit_sales_channels = validated_data.pop('limit_sales_channels', [])
variation = ItemVariation.objects.create(**validated_data) variation = ItemVariation.objects.create(**validated_data)
if require_membership_types: if require_membership_types:
variation.require_membership_types.add(*require_membership_types) variation.require_membership_types.add(*require_membership_types)
if limit_sales_channels:
variation.limit_sales_channels.add(*limit_sales_channels)
# Meta data # Meta data
if meta_data is not None: if meta_data is not None:
for key, value in meta_data.items(): for key, value in meta_data.items():
@@ -290,7 +284,6 @@ class ItemSerializer(SalesChannelMigrationMixin, I18nAwareModelSerializer):
self.fields['require_membership_types'].queryset = self.context['event'].organizer.membership_types.all() self.fields['require_membership_types'].queryset = self.context['event'].organizer.membership_types.all()
self.fields['grant_membership_type'].queryset = self.context['event'].organizer.membership_types.all() self.fields['grant_membership_type'].queryset = self.context['event'].organizer.membership_types.all()
self.fields['limit_sales_channels'].child_relation.queryset = self.context['event'].organizer.sales_channels.all() self.fields['limit_sales_channels'].child_relation.queryset = self.context['event'].organizer.sales_channels.all()
self.fields['variations'].child.fields['limit_sales_channels'].child_relation.queryset = self.context['event'].organizer.sales_channels.all()
def validate(self, data): def validate(self, data):
data = super().validate(data) data = super().validate(data)
@@ -378,13 +371,10 @@ class ItemSerializer(SalesChannelMigrationMixin, I18nAwareModelSerializer):
for variation_data in variations_data: for variation_data in variations_data:
require_membership_types = variation_data.pop('require_membership_types', []) require_membership_types = variation_data.pop('require_membership_types', [])
limit_sales_channels = variation_data.pop('limit_sales_channels', [])
var_meta_data = variation_data.pop('meta_data', {}) var_meta_data = variation_data.pop('meta_data', {})
v = ItemVariation.objects.create(item=item, **variation_data) v = ItemVariation.objects.create(item=item, **variation_data)
if require_membership_types: if require_membership_types:
v.require_membership_types.add(*require_membership_types) v.require_membership_types.add(*require_membership_types)
if limit_sales_channels:
v.limit_sales_channels.add(*limit_sales_channels)
if var_meta_data is not None: if var_meta_data is not None:
for key, value in var_meta_data.items(): for key, value in var_meta_data.items():
+6 -12
View File
@@ -165,7 +165,7 @@ class InlineSeatSerializer(I18nAwareModelSerializer):
class Meta: class Meta:
model = Seat model = Seat
fields = ('id', 'name', 'seat_guid', 'zone_name', 'row_name', 'row_label', 'seat_label', 'seat_number') fields = ('id', 'name', 'seat_guid')
class AnswerSerializer(I18nAwareModelSerializer): class AnswerSerializer(I18nAwareModelSerializer):
@@ -273,15 +273,9 @@ class AnswerSerializer(I18nAwareModelSerializer):
class CheckinSerializer(I18nAwareModelSerializer): class CheckinSerializer(I18nAwareModelSerializer):
device_id = serializers.SlugRelatedField(
source='device',
slug_field='device_id',
read_only=True,
)
class Meta: class Meta:
model = Checkin model = Checkin
fields = ('id', 'datetime', 'list', 'auto_checked_in', 'gate', 'device', 'device_id', 'type') fields = ('id', 'datetime', 'list', 'auto_checked_in', 'gate', 'device', 'type')
class FailedCheckinSerializer(I18nAwareModelSerializer): class FailedCheckinSerializer(I18nAwareModelSerializer):
@@ -591,7 +585,7 @@ class CheckinListOrderPositionSerializer(OrderPositionSerializer):
self.fields['item'] = ItemSerializer(read_only=True, context=self.context) self.fields['item'] = ItemSerializer(read_only=True, context=self.context)
if 'variation' in self.context['expand']: if 'variation' in self.context['expand']:
self.fields['variation'] = InlineItemVariationSerializer(read_only=True, context=self.context) self.fields['variation'] = InlineItemVariationSerializer(read_only=True)
if 'answers.question' in self.context['expand']: if 'answers.question' in self.context['expand']:
self.fields['answers'].child.fields['question'] = QuestionSerializer(read_only=True) self.fields['answers'].child.fields['question'] = QuestionSerializer(read_only=True)
@@ -732,7 +726,7 @@ class OrderSerializer(I18nAwareModelSerializer):
'code', 'event', 'status', 'testmode', 'secret', 'email', 'phone', 'locale', 'datetime', 'expires', 'payment_date', 'code', 'event', 'status', 'testmode', 'secret', 'email', 'phone', 'locale', 'datetime', 'expires', 'payment_date',
'payment_provider', 'fees', 'total', 'comment', 'custom_followup_at', 'invoice_address', 'positions', 'downloads', 'payment_provider', 'fees', 'total', 'comment', 'custom_followup_at', 'invoice_address', 'positions', 'downloads',
'checkin_attention', 'checkin_text', 'last_modified', 'payments', 'refunds', 'require_approval', 'sales_channel', 'checkin_attention', 'checkin_text', 'last_modified', 'payments', 'refunds', 'require_approval', 'sales_channel',
'url', 'customer', 'valid_if_pending', 'api_meta' 'url', 'customer', 'valid_if_pending'
) )
read_only_fields = ( read_only_fields = (
'code', 'status', 'testmode', 'secret', 'datetime', 'expires', 'payment_date', 'code', 'status', 'testmode', 'secret', 'datetime', 'expires', 'payment_date',
@@ -792,7 +786,7 @@ class OrderSerializer(I18nAwareModelSerializer):
# Even though all fields that shouldn't be edited are marked as read_only in the serializer # Even though all fields that shouldn't be edited are marked as read_only in the serializer
# (hopefully), we'll be extra careful here and be explicit about the model fields we update. # (hopefully), we'll be extra careful here and be explicit about the model fields we update.
update_fields = ['comment', 'custom_followup_at', 'checkin_attention', 'checkin_text', 'email', 'locale', update_fields = ['comment', 'custom_followup_at', 'checkin_attention', 'checkin_text', 'email', 'locale',
'phone', 'valid_if_pending', 'api_meta'] 'phone', 'valid_if_pending']
if 'invoice_address' in validated_data: if 'invoice_address' in validated_data:
iadata = validated_data.pop('invoice_address') iadata = validated_data.pop('invoice_address')
@@ -1065,7 +1059,7 @@ class OrderCreateSerializer(I18nAwareModelSerializer):
fields = ('code', 'status', 'testmode', 'email', 'phone', 'locale', 'payment_provider', 'fees', 'comment', 'sales_channel', fields = ('code', 'status', 'testmode', 'email', 'phone', 'locale', 'payment_provider', 'fees', 'comment', 'sales_channel',
'invoice_address', 'positions', 'checkin_attention', 'checkin_text', 'payment_info', 'payment_date', 'invoice_address', 'positions', 'checkin_attention', 'checkin_text', 'payment_info', 'payment_date',
'consume_carts', 'force', 'send_email', 'simulate', 'customer', 'custom_followup_at', 'consume_carts', 'force', 'send_email', 'simulate', 'customer', 'custom_followup_at',
'require_approval', 'valid_if_pending', 'expires', 'api_meta') 'require_approval', 'valid_if_pending', 'expires')
def validate_payment_provider(self, pp): def validate_payment_provider(self, pp):
if pp is None: if pp is None:
-5
View File
@@ -87,7 +87,6 @@ event_router.register(r'invoices', order.InvoiceViewSet)
event_router.register(r'revokedsecrets', order.RevokedSecretViewSet, basename='revokedsecrets') event_router.register(r'revokedsecrets', order.RevokedSecretViewSet, basename='revokedsecrets')
event_router.register(r'blockedsecrets', order.BlockedSecretViewSet, basename='blockedsecrets') event_router.register(r'blockedsecrets', order.BlockedSecretViewSet, basename='blockedsecrets')
event_router.register(r'taxrules', event.TaxRuleViewSet) event_router.register(r'taxrules', event.TaxRuleViewSet)
event_router.register(r'seats', event.SeatViewSet)
event_router.register(r'waitinglistentries', waitinglist.WaitingListViewSet) event_router.register(r'waitinglistentries', waitinglist.WaitingListViewSet)
event_router.register(r'checkinlists', checkin.CheckinListViewSet) event_router.register(r'checkinlists', checkin.CheckinListViewSet)
event_router.register(r'cartpositions', cart.CartPositionViewSet) event_router.register(r'cartpositions', cart.CartPositionViewSet)
@@ -96,9 +95,6 @@ event_router.register(r'exporters', exporters.EventExportersViewSet, basename='e
event_router.register(r'shredders', shredders.EventShreddersViewSet, basename='shredders') event_router.register(r'shredders', shredders.EventShreddersViewSet, basename='shredders')
event_router.register(r'item_meta_properties', event.ItemMetaPropertiesViewSet) event_router.register(r'item_meta_properties', event.ItemMetaPropertiesViewSet)
subevent_router = routers.DefaultRouter()
subevent_router.register(r'seats', event.SeatViewSet)
checkinlist_router = routers.DefaultRouter() checkinlist_router = routers.DefaultRouter()
checkinlist_router.register(r'positions', checkin.CheckinListPositionViewSet, basename='checkinlistpos') checkinlist_router.register(r'positions', checkin.CheckinListPositionViewSet, basename='checkinlistpos')
@@ -136,7 +132,6 @@ urlpatterns = [
re_path(r'^organizers/(?P<organizer>[^/]+)/events/(?P<event>[^/]+)/settings/$', event.EventSettingsView.as_view(), re_path(r'^organizers/(?P<organizer>[^/]+)/events/(?P<event>[^/]+)/settings/$', event.EventSettingsView.as_view(),
name="event.settings"), name="event.settings"),
re_path(r'^organizers/(?P<organizer>[^/]+)/events/(?P<event>[^/]+)/', include(event_router.urls)), re_path(r'^organizers/(?P<organizer>[^/]+)/events/(?P<event>[^/]+)/', include(event_router.urls)),
re_path(r'^organizers/(?P<organizer>[^/]+)/events/(?P<event>[^/]+)/subevents/(?P<subevent>\d+)/', include(subevent_router.urls)),
re_path(r'^organizers/(?P<organizer>[^/]+)/teams/(?P<team>[^/]+)/', include(team_router.urls)), re_path(r'^organizers/(?P<organizer>[^/]+)/teams/(?P<team>[^/]+)/', include(team_router.urls)),
re_path(r'^organizers/(?P<organizer>[^/]+)/events/(?P<event>[^/]+)/items/(?P<item>[^/]+)/', include(item_router.urls)), re_path(r'^organizers/(?P<organizer>[^/]+)/events/(?P<event>[^/]+)/items/(?P<item>[^/]+)/', include(item_router.urls)),
re_path(r'^organizers/(?P<organizer>[^/]+)/events/(?P<event>[^/]+)/questions/(?P<question>[^/]+)/', re_path(r'^organizers/(?P<organizer>[^/]+)/events/(?P<event>[^/]+)/questions/(?P<question>[^/]+)/',
+2 -2
View File
@@ -377,7 +377,7 @@ def _checkin_list_position_queryset(checkinlists, ignore_status=False, ignore_pr
Prefetch( Prefetch(
'positions', 'positions',
OrderPosition.objects.prefetch_related( OrderPosition.objects.prefetch_related(
Prefetch('checkins', queryset=Checkin.objects.select_related('device')), Prefetch('checkins', queryset=Checkin.objects.all()),
'item', 'variation', 'answers', 'answers__options', 'answers__question', 'item', 'variation', 'answers', 'answers__options', 'answers__question',
) )
) )
@@ -406,7 +406,7 @@ def _checkin_list_position_queryset(checkinlists, ignore_status=False, ignore_pr
'item__variations').select_related('item__tax_rule') 'item__variations').select_related('item__tax_rule')
if expand and 'variation' in expand: if expand and 'variation' in expand:
qs = qs.prefetch_related('variation', 'variation__meta_values') qs = qs.prefetch_related('variation')
return qs return qs
+7 -96
View File
@@ -40,22 +40,19 @@ from django.utils.timezone import now
from django_filters.rest_framework import DjangoFilterBackend, FilterSet from django_filters.rest_framework import DjangoFilterBackend, FilterSet
from django_scopes import scopes_disabled from django_scopes import scopes_disabled
from rest_framework import serializers, views, viewsets from rest_framework import serializers, views, viewsets
from rest_framework.exceptions import ( from rest_framework.exceptions import PermissionDenied, ValidationError
NotFound, PermissionDenied, ValidationError,
)
from rest_framework.generics import get_object_or_404
from rest_framework.response import Response from rest_framework.response import Response
from pretix.api.auth.permission import EventCRUDPermission from pretix.api.auth.permission import EventCRUDPermission
from pretix.api.pagination import TotalOrderingFilter from pretix.api.pagination import TotalOrderingFilter
from pretix.api.serializers.event import ( from pretix.api.serializers.event import (
CloneEventSerializer, DeviceEventSettingsSerializer, EventSerializer, CloneEventSerializer, DeviceEventSettingsSerializer, EventSerializer,
EventSettingsSerializer, ItemMetaPropertiesSerializer, SeatSerializer, EventSettingsSerializer, ItemMetaPropertiesSerializer, SubEventSerializer,
SubEventSerializer, TaxRuleSerializer, TaxRuleSerializer,
) )
from pretix.api.views import ConditionalListView from pretix.api.views import ConditionalListView
from pretix.base.models import ( from pretix.base.models import (
CartPosition, Device, Event, ItemMetaProperty, Seat, SeatCategoryMapping, CartPosition, Device, Event, ItemMetaProperty, SeatCategoryMapping,
TaxRule, TeamAPIToken, TaxRule, TeamAPIToken,
) )
from pretix.base.models.event import SubEvent from pretix.base.models.event import SubEvent
@@ -165,13 +162,7 @@ class EventViewSet(viewsets.ModelViewSet):
qs = filter_qs_by_attr(qs, self.request) qs = filter_qs_by_attr(qs, self.request)
if 'with_availability_for' in self.request.GET: if 'with_availability_for' in self.request.GET:
qs = Event.annotated( qs = Event.annotated(qs, channel=self.request.GET.get('with_availability_for'))
qs,
channel=get_object_or_404(
self.request.organizer.sales_channels,
identifier=self.request.GET.get('with_availability_for')
)
)
return qs.prefetch_related( return qs.prefetch_related(
'organizer', 'organizer',
@@ -445,19 +436,13 @@ class SubEventViewSet(ConditionalListView, viewsets.ModelViewSet):
elif self.request.user.is_authenticated: elif self.request.user.is_authenticated:
qs = SubEvent.objects.filter( qs = SubEvent.objects.filter(
event__organizer=self.request.organizer, event__organizer=self.request.organizer,
event__in=self.request.user.get_events_with_any_permission(request=self.request) event__in=self.request.user.get_events_with_any_permission()
) )
qs = filter_qs_by_attr(qs, self.request) qs = filter_qs_by_attr(qs, self.request)
if 'with_availability_for' in self.request.GET: if 'with_availability_for' in self.request.GET:
qs = SubEvent.annotated( qs = SubEvent.annotated(qs, channel=self.request.GET.get('with_availability_for'))
qs,
channel=get_object_or_404(
self.request.organizer.sales_channels,
identifier=self.request.GET.get('with_availability_for')
)
)
return qs.prefetch_related( return qs.prefetch_related(
'event', 'event',
@@ -669,77 +654,3 @@ class EventSettingsView(views.APIView):
'request': request 'request': request
}) })
return Response(s.data) return Response(s.data)
class SeatFilter(FilterSet):
is_available = django_filters.BooleanFilter(method="is_available_qs")
def is_available_qs(self, queryset, name, value):
expr = (
Q(orderposition_id__isnull=True, cartposition_id__isnull=True, voucher_id__isnull=True)
)
if self.request.event.settings.seating_minimal_distance:
expr = expr & Q(has_closeby_taken=False)
if value:
return queryset.filter(expr)
else:
return queryset.exclude(expr)
class Meta:
model = Seat
fields = ('zone_name', 'row_name', 'row_label', 'seat_number', 'seat_label', 'seat_guid', 'blocked',)
class SeatViewSet(ConditionalListView, viewsets.ModelViewSet):
serializer_class = SeatSerializer
queryset = Seat.objects.none()
write_permission = 'can_change_event_settings'
filter_backends = (DjangoFilterBackend, )
filterset_class = SeatFilter
def get_queryset(self):
if self.request.event.has_subevents and 'subevent' in self.request.resolver_match.kwargs:
try:
subevent = self.request.event.subevents.get(pk=self.request.resolver_match.kwargs['subevent'])
except SubEvent.DoesNotExist:
raise NotFound('Subevent not found')
qs = Seat.annotated(
event_id=self.request.event.id,
subevent=subevent,
qs=subevent.seats.all(),
annotate_ids=True,
minimal_distance=self.request.event.settings.seating_minimal_distance,
distance_only_within_row=self.request.event.settings.seating_distance_only_within_row,
)
elif not self.request.event.has_subevents and 'subevent' not in self.request.resolver_match.kwargs:
qs = Seat.annotated(
event_id=self.request.event.id,
subevent=None,
qs=self.request.event.seats.all(),
annotate_ids=True,
minimal_distance=self.request.event.settings.seating_minimal_distance,
distance_only_within_row=self.request.event.settings.seating_distance_only_within_row,
)
else:
raise NotFound('Please use the subevent-specific endpoint' if self.request.event.has_subevents
else 'This event has no subevents')
return qs
def get_serializer_context(self):
ctx = super().get_serializer_context()
ctx['expand_fields'] = self.request.query_params.getlist('expand')
ctx['order_context'] = {
'event': self.request.event,
'pdf_data': None,
}
return ctx
def perform_update(self, serializer):
super().perform_update(serializer)
serializer.instance.event.log_action(
"pretix.event.seats.blocks.changed",
user=self.request.user,
auth=self.request.auth,
data={"seats": [serializer.instance.pk]},
)
-20
View File
@@ -56,17 +56,10 @@ from pretix.base.models import (
) )
from pretix.base.services.quotas import QuotaAvailability from pretix.base.services.quotas import QuotaAvailability
from pretix.helpers.dicts import merge_dicts from pretix.helpers.dicts import merge_dicts
from pretix.helpers.i18n import i18ncomp
with scopes_disabled(): with scopes_disabled():
class ItemFilter(FilterSet): class ItemFilter(FilterSet):
tax_rate = django_filters.CharFilter(method='tax_rate_qs') tax_rate = django_filters.CharFilter(method='tax_rate_qs')
search = django_filters.CharFilter(method='search_qs')
def search_qs(self, queryset, name, value):
return queryset.filter(
Q(internal_name__icontains=value) | Q(name__icontains=i18ncomp(value))
)
def tax_rate_qs(self, queryset, name, value): def tax_rate_qs(self, queryset, name, value):
if value in ("0", "None", "0.00"): if value in ("0", "None", "0.00"):
@@ -78,18 +71,6 @@ with scopes_disabled():
model = Item model = Item
fields = ['active', 'category', 'admission', 'tax_rate', 'free_price'] fields = ['active', 'category', 'admission', 'tax_rate', 'free_price']
class ItemVariationFilter(FilterSet):
search = django_filters.CharFilter(method='search_qs')
def search_qs(self, queryset, name, value):
return queryset.filter(
Q(value__icontains=i18ncomp(value))
)
class Meta:
model = ItemVariation
fields = ['active']
class ItemViewSet(ConditionalListView, viewsets.ModelViewSet): class ItemViewSet(ConditionalListView, viewsets.ModelViewSet):
serializer_class = ItemSerializer serializer_class = ItemSerializer
@@ -159,7 +140,6 @@ class ItemVariationViewSet(viewsets.ModelViewSet):
serializer_class = ItemVariationSerializer serializer_class = ItemVariationSerializer
queryset = ItemVariation.objects.none() queryset = ItemVariation.objects.none()
filter_backends = (DjangoFilterBackend, TotalOrderingFilter,) filter_backends = (DjangoFilterBackend, TotalOrderingFilter,)
filterset_class = ItemVariationFilter
ordering_fields = ('id', 'position') ordering_fields = ('id', 'position')
ordering = ('id',) ordering = ('id',)
permission = None permission = None
+1 -1
View File
@@ -78,7 +78,7 @@ class ReusableMediaViewSet(viewsets.ModelViewSet):
queryset=OrderPosition.objects.select_related( queryset=OrderPosition.objects.select_related(
'order', 'order__event', 'order__event__organizer', 'seat', 'order', 'order__event', 'order__event__organizer', 'seat',
).prefetch_related( ).prefetch_related(
Prefetch('checkins', queryset=Checkin.objects.select_related('device')), Prefetch('checkins', queryset=Checkin.objects.all()),
'answers', 'answers__options', 'answers__question', 'answers', 'answers__options', 'answers__question',
) )
), ),
+10 -16
View File
@@ -49,7 +49,6 @@ from rest_framework.mixins import CreateModelMixin
from rest_framework.permissions import SAFE_METHODS from rest_framework.permissions import SAFE_METHODS
from rest_framework.response import Response from rest_framework.response import Response
from pretix.api.filters import MultipleCharFilter
from pretix.api.models import OAuthAccessToken from pretix.api.models import OAuthAccessToken
from pretix.api.pagination import TotalOrderingFilter from pretix.api.pagination import TotalOrderingFilter
from pretix.api.serializers.order import ( from pretix.api.serializers.order import (
@@ -109,7 +108,6 @@ with scopes_disabled():
status = django_filters.CharFilter(field_name='status', lookup_expr='iexact') status = django_filters.CharFilter(field_name='status', lookup_expr='iexact')
modified_since = django_filters.IsoDateTimeFilter(field_name='last_modified', lookup_expr='gte') modified_since = django_filters.IsoDateTimeFilter(field_name='last_modified', lookup_expr='gte')
created_since = django_filters.IsoDateTimeFilter(field_name='datetime', lookup_expr='gte') created_since = django_filters.IsoDateTimeFilter(field_name='datetime', lookup_expr='gte')
created_before = django_filters.IsoDateTimeFilter(field_name='datetime', lookup_expr='lt')
subevent_after = django_filters.IsoDateTimeFilter(method='subevent_after_qs') subevent_after = django_filters.IsoDateTimeFilter(method='subevent_after_qs')
subevent_before = django_filters.IsoDateTimeFilter(method='subevent_before_qs') subevent_before = django_filters.IsoDateTimeFilter(method='subevent_before_qs')
search = django_filters.CharFilter(method='search_qs') search = django_filters.CharFilter(method='search_qs')
@@ -117,8 +115,6 @@ with scopes_disabled():
variation = django_filters.CharFilter(field_name='all_positions', lookup_expr='variation_id', distinct=True) variation = django_filters.CharFilter(field_name='all_positions', lookup_expr='variation_id', distinct=True)
subevent = django_filters.CharFilter(field_name='all_positions', lookup_expr='subevent_id', distinct=True) subevent = django_filters.CharFilter(field_name='all_positions', lookup_expr='subevent_id', distinct=True)
customer = django_filters.CharFilter(field_name='customer__identifier') customer = django_filters.CharFilter(field_name='customer__identifier')
sales_channel = django_filters.CharFilter(field_name='sales_channel__identifier')
payment_provider = django_filters.CharFilter(method='provider_qs')
class Meta: class Meta:
model = Order model = Order
@@ -142,11 +138,6 @@ with scopes_disabled():
) )
return qs return qs
def provider_qs(self, qs, name, value):
return qs.filter(Exists(
OrderPayment.objects.filter(order=OuterRef('pk'), provider=value)
))
def subevent_before_qs(self, qs, name, value): def subevent_before_qs(self, qs, name, value):
if getattr(self.request, 'event', None): if getattr(self.request, 'event', None):
subevents = self.request.event.subevents subevents = self.request.event.subevents
@@ -258,7 +249,7 @@ class OrderViewSetMixin:
return Prefetch( return Prefetch(
'positions', 'positions',
opq.all().prefetch_related( opq.all().prefetch_related(
Prefetch('checkins', queryset=Checkin.objects.select_related('device')), Prefetch('checkins', queryset=Checkin.objects.all()),
Prefetch('item', queryset=self.request.event.items.prefetch_related( Prefetch('item', queryset=self.request.event.items.prefetch_related(
Prefetch('meta_values', ItemMetaValue.objects.select_related('property'), to_attr='meta_values_cached') Prefetch('meta_values', ItemMetaValue.objects.select_related('property'), to_attr='meta_values_cached')
)), )),
@@ -279,7 +270,7 @@ class OrderViewSetMixin:
return Prefetch( return Prefetch(
'positions', 'positions',
opq.all().prefetch_related( opq.all().prefetch_related(
Prefetch('checkins', queryset=Checkin.objects.select_related('device')), Prefetch('checkins', queryset=Checkin.objects.all()),
'item', 'variation', 'item', 'variation',
Prefetch('answers', queryset=QuestionAnswer.objects.prefetch_related('options', 'question').order_by('question__position')), Prefetch('answers', queryset=QuestionAnswer.objects.prefetch_related('options', 'question').order_by('question__position')),
'seat', 'seat',
@@ -1092,7 +1083,7 @@ class OrderPositionViewSet(viewsets.ModelViewSet):
'item_meta_properties', 'item_meta_properties',
) )
qs = qs.prefetch_related( qs = qs.prefetch_related(
Prefetch('checkins', queryset=Checkin.objects.select_related("device")), Prefetch('checkins', queryset=Checkin.objects.all()),
Prefetch('item', queryset=self.request.event.items.prefetch_related( Prefetch('item', queryset=self.request.event.items.prefetch_related(
Prefetch('meta_values', ItemMetaValue.objects.select_related('property'), Prefetch('meta_values', ItemMetaValue.objects.select_related('property'),
to_attr='meta_values_cached') to_attr='meta_values_cached')
@@ -1111,7 +1102,7 @@ class OrderPositionViewSet(viewsets.ModelViewSet):
Prefetch( Prefetch(
'positions', 'positions',
qs.prefetch_related( qs.prefetch_related(
Prefetch('checkins', queryset=Checkin.objects.select_related('device')), Prefetch('checkins', queryset=Checkin.objects.all()),
Prefetch('item', queryset=self.request.event.items.prefetch_related( Prefetch('item', queryset=self.request.event.items.prefetch_related(
Prefetch('meta_values', ItemMetaValue.objects.select_related('property'), Prefetch('meta_values', ItemMetaValue.objects.select_related('property'),
to_attr='meta_values_cached') to_attr='meta_values_cached')
@@ -1135,7 +1126,7 @@ class OrderPositionViewSet(viewsets.ModelViewSet):
) )
else: else:
qs = qs.prefetch_related( qs = qs.prefetch_related(
Prefetch('checkins', queryset=Checkin.objects.select_related("device")), Prefetch('checkins', queryset=Checkin.objects.all()),
'answers', 'answers__options', 'answers__question', 'answers', 'answers__options', 'answers__question',
).select_related( ).select_related(
'item', 'order', 'order__event', 'order__event__organizer', 'seat' 'item', 'order', 'order__event', 'order__event__organizer', 'seat'
@@ -1826,14 +1817,17 @@ class RefundViewSet(CreateModelMixin, viewsets.ReadOnlyModelViewSet):
with scopes_disabled(): with scopes_disabled():
class InvoiceFilter(FilterSet): class InvoiceFilter(FilterSet):
refers = django_filters.CharFilter(method='refers_qs') refers = django_filters.CharFilter(method='refers_qs')
number = MultipleCharFilter(field_name='nr', lookup_expr='iexact') number = django_filters.CharFilter(method='nr_qs')
order = MultipleCharFilter(field_name='order', lookup_expr='code__iexact') order = django_filters.CharFilter(field_name='order', lookup_expr='code__iexact')
def refers_qs(self, queryset, name, value): def refers_qs(self, queryset, name, value):
return queryset.annotate( return queryset.annotate(
refers_nr=Concat('refers__prefix', 'refers__invoice_no') refers_nr=Concat('refers__prefix', 'refers__invoice_no')
).filter(refers_nr__iexact=value) ).filter(refers_nr__iexact=value)
def nr_qs(self, queryset, name, value):
return queryset.filter(nr__iexact=value)
class Meta: class Meta:
model = Invoice model = Invoice
fields = ['order', 'number', 'is_cancellation', 'refers', 'locale'] fields = ['order', 'number', 'is_cancellation', 'refers', 'locale']
+1 -10
View File
@@ -24,11 +24,10 @@ from decimal import Decimal
import django_filters import django_filters
from django.contrib.auth.hashers import make_password from django.contrib.auth.hashers import make_password
from django.db import transaction from django.db import transaction
from django.db.models import OuterRef, Q, Subquery, Sum from django.db.models import OuterRef, Subquery, Sum
from django.db.models.functions import Coalesce from django.db.models.functions import Coalesce
from django.shortcuts import get_object_or_404 from django.shortcuts import get_object_or_404
from django.utils.functional import cached_property from django.utils.functional import cached_property
from django.utils.timezone import now
from django_filters.rest_framework import DjangoFilterBackend, FilterSet from django_filters.rest_framework import DjangoFilterBackend, FilterSet
from django_scopes import scopes_disabled from django_scopes import scopes_disabled
from rest_framework import mixins, serializers, status, views, viewsets from rest_framework import mixins, serializers, status, views, viewsets
@@ -137,19 +136,11 @@ class SeatingPlanViewSet(viewsets.ModelViewSet):
with scopes_disabled(): with scopes_disabled():
class GiftCardFilter(FilterSet): class GiftCardFilter(FilterSet):
secret = django_filters.CharFilter(field_name='secret', lookup_expr='iexact') secret = django_filters.CharFilter(field_name='secret', lookup_expr='iexact')
expired = django_filters.BooleanFilter(method='expired_qs')
value = django_filters.NumberFilter(field_name='cached_value')
class Meta: class Meta:
model = GiftCard model = GiftCard
fields = ['secret', 'testmode'] fields = ['secret', 'testmode']
def expired_qs(self, qs, name, value):
if value:
return qs.filter(expires__isnull=False, expires__lt=now())
else:
return qs.filter(Q(expires__isnull=True) | Q(expires__gte=now()))
class GiftCardViewSet(viewsets.ModelViewSet): class GiftCardViewSet(viewsets.ModelViewSet):
serializer_class = GiftCardSerializer serializer_class = GiftCardSerializer
-8
View File
@@ -19,8 +19,6 @@
# You should have received a copy of the GNU Affero General Public License along with this program. If not, see # You should have received a copy of the GNU Affero General Public License along with this program. If not, see
# <https://www.gnu.org/licenses/>. # <https://www.gnu.org/licenses/>.
# #
import django_filters
from django_filters.rest_framework import DjangoFilterBackend, FilterSet
from rest_framework import viewsets from rest_framework import viewsets
from pretix.api.models import WebHook from pretix.api.models import WebHook
@@ -28,17 +26,11 @@ from pretix.api.serializers.webhooks import WebHookSerializer
from pretix.helpers.dicts import merge_dicts from pretix.helpers.dicts import merge_dicts
class WebhookFilter(FilterSet):
enabled = django_filters.rest_framework.BooleanFilter()
class WebHookViewSet(viewsets.ModelViewSet): class WebHookViewSet(viewsets.ModelViewSet):
serializer_class = WebHookSerializer serializer_class = WebHookSerializer
queryset = WebHook.objects.none() queryset = WebHook.objects.none()
permission = 'can_change_organizer_settings' permission = 'can_change_organizer_settings'
write_permission = 'can_change_organizer_settings' write_permission = 'can_change_organizer_settings'
filter_backends = (DjangoFilterBackend,)
filterset_class = WebhookFilter
def get_queryset(self): def get_queryset(self):
return self.request.organizer.webhooks.prefetch_related('listeners') return self.request.organizer.webhooks.prefetch_related('listeners')
-15
View File
@@ -126,17 +126,6 @@ class ParametrizedOrderWebhookEvent(ParametrizedWebhookEvent):
} }
class DeletedOrderWebhookEvent(ParametrizedWebhookEvent):
def build_payload(self, logentry: LogEntry):
return {
'notification_id': logentry.pk,
'organizer': logentry.organizer.slug,
'event': logentry.event.slug,
'code': logentry.parsed_data.get("code"),
'action': logentry.action_type,
}
class ParametrizedEventWebhookEvent(ParametrizedWebhookEvent): class ParametrizedEventWebhookEvent(ParametrizedWebhookEvent):
def build_payload(self, logentry: LogEntry): def build_payload(self, logentry: LogEntry):
@@ -308,10 +297,6 @@ def register_default_webhook_events(sender, **kwargs):
'pretix.event.order.denied', 'pretix.event.order.denied',
_('Order denied'), _('Order denied'),
), ),
DeletedOrderWebhookEvent(
'pretix.event.order.deleted',
_('Order deleted'),
),
ParametrizedOrderPositionCheckinWebhookEvent( ParametrizedOrderPositionCheckinWebhookEvent(
'pretix.event.checkin', 'pretix.event.checkin',
_('Ticket checked in'), _('Ticket checked in'),
+1 -63
View File
@@ -32,16 +32,13 @@
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under the License. # License for the specific language governing permissions and limitations under the License.
import string
from collections import OrderedDict from collections import OrderedDict
from importlib import import_module from importlib import import_module
from django import forms from django import forms
from django.conf import settings from django.conf import settings
from django.contrib.auth import authenticate from django.contrib.auth import authenticate
from django.contrib.auth.hashers import check_password, make_password from django.utils.translation import gettext_lazy as _
from django.core.exceptions import ValidationError
from django.utils.translation import gettext_lazy as _, ngettext
def get_auth_backends(): def get_auth_backends():
@@ -163,62 +160,3 @@ class NativeAuthBackend(BaseAuthBackend):
u = authenticate(request=request, email=form_data['email'].lower(), password=form_data['password']) u = authenticate(request=request, email=form_data['email'].lower(), password=form_data['password'])
if u and u.auth_backend == self.identifier: if u and u.auth_backend == self.identifier:
return u return u
class NumericAndAlphabeticPasswordValidator:
def validate(self, password, user=None):
has_numeric = any(c in string.digits for c in password)
has_alpha = any(c in string.ascii_letters for c in password)
if not has_numeric or not has_alpha:
raise ValidationError(
_(
"Your password must contain both numeric and alphabetic characters.",
),
code="password_numeric_and_alphabetic",
)
def get_help_text(self):
return _(
"Your password must contain both numeric and alphabetic characters.",
)
class HistoryPasswordValidator:
def __init__(self, history_length=4):
self.history_length = history_length
def validate(self, password, user=None):
from pretix.base.models import User
if not user or not user.pk or not isinstance(user, User):
return
for hp in user.historic_passwords.order_by("-created")[:self.history_length]:
if check_password(password, hp.password):
raise ValidationError(
ngettext(
"Your password may not be the same as your previous password.",
"Your password may not be the same as one of your %(history_length)s previous passwords.",
self.history_length,
),
code="password_history",
params={"history_length": self.history_length},
)
def get_help_text(self):
return ngettext(
"Your password may not be the same as your previous password.",
"Your password may not be the same as one of your %(history_length)s previous passwords.",
self.history_length,
) % {"history_length": self.history_length}
def password_changed(self, password, user=None):
if not user:
pass
user.historic_passwords.create(password=make_password(password))
user.historic_passwords.filter(
pk__in=user.historic_passwords.order_by("-created")[self.history_length:].values_list("pk", flat=True),
).delete()
+1 -33
View File
@@ -46,8 +46,6 @@ This module contains utilities for implementing OpenID Connect for customer auth
as well as an OpenID Provider (OP). as well as an OpenID Provider (OP).
""" """
pretix_token_endpoint_auth_methods = ['client_secret_basic', 'client_secret_post']
def _urljoin(base, path): def _urljoin(base, path):
if not base.endswith("/"): if not base.endswith("/"):
@@ -129,16 +127,6 @@ def oidc_validate_and_complete_config(config):
fields=", ".join(provider_config.get("claims_supported", [])) fields=", ".join(provider_config.get("claims_supported", []))
)) ))
if "token_endpoint_auth_methods_supported" in provider_config:
token_endpoint_auth_methods_supported = provider_config.get("token_endpoint_auth_methods_supported",
["client_secret_basic"])
if not any(x in pretix_token_endpoint_auth_methods for x in token_endpoint_auth_methods_supported):
raise ValidationError(
_(f'No supported Token Endpoint Auth Methods supported: {token_endpoint_auth_methods_supported}').format(
token_endpoint_auth_methods_supported=", ".join(token_endpoint_auth_methods_supported)
)
)
config['provider_config'] = provider_config config['provider_config'] = provider_config
return config return config
@@ -159,18 +147,6 @@ def oidc_authorize_url(provider, state, redirect_uri):
def oidc_validate_authorization(provider, code, redirect_uri): def oidc_validate_authorization(provider, code, redirect_uri):
endpoint = provider.configuration['provider_config']['token_endpoint'] endpoint = provider.configuration['provider_config']['token_endpoint']
# Wall of shame and RFC ignorant IDPs
if endpoint == 'https://www.linkedin.com/oauth/v2/accessToken':
token_endpoint_auth_method = 'client_secret_post'
else:
token_endpoint_auth_methods = provider.configuration['provider_config'].get(
'token_endpoint_auth_methods_supported', ['client_secret_basic']
)
token_endpoint_auth_method = [
x for x in pretix_token_endpoint_auth_methods if x in token_endpoint_auth_methods
][0]
params = { params = {
# https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.3 # https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.3
# https://openid.net/specs/openid-connect-core-1_0.html#TokenEndpoint # https://openid.net/specs/openid-connect-core-1_0.html#TokenEndpoint
@@ -178,11 +154,6 @@ def oidc_validate_authorization(provider, code, redirect_uri):
'code': code, 'code': code,
'redirect_uri': redirect_uri, 'redirect_uri': redirect_uri,
} }
if token_endpoint_auth_method == 'client_secret_post':
params['client_id'] = provider.configuration['client_id']
params['client_secret'] = provider.configuration['client_secret']
try: try:
resp = requests.post( resp = requests.post(
endpoint, endpoint,
@@ -190,10 +161,7 @@ def oidc_validate_authorization(provider, code, redirect_uri):
headers={ headers={
'Accept': 'application/json', 'Accept': 'application/json',
}, },
auth=( auth=(provider.configuration['client_id'], provider.configuration['client_secret']),
provider.configuration['client_id'],
provider.configuration['client_secret']
) if token_endpoint_auth_method == 'client_secret_basic' else None,
) )
resp.raise_for_status() resp.raise_for_status()
data = resp.json() data = resp.json()
+4 -7
View File
@@ -207,13 +207,10 @@ class ListExporter(BaseExporter):
def get_filename(self): def get_filename(self):
return 'export' return 'export'
def get_csv_encoding(self):
return 'utf-8'
def _render_csv(self, form_data, output_file=None, **kwargs): def _render_csv(self, form_data, output_file=None, **kwargs):
if output_file: if output_file:
if 'b' in output_file.mode: if 'b' in output_file.mode:
output_file = io.TextIOWrapper(output_file, encoding=self.get_csv_encoding(), errors='replace', newline='') output_file = io.TextIOWrapper(output_file, encoding='utf-8', newline='')
writer = csv.writer(output_file, **kwargs) writer = csv.writer(output_file, **kwargs)
total = 0 total = 0
counter = 0 counter = 0
@@ -249,7 +246,7 @@ class ListExporter(BaseExporter):
if counter % max(10, total // 100) == 0: if counter % max(10, total // 100) == 0:
self.progress_callback(counter / total * 100) self.progress_callback(counter / total * 100)
writer.writerow(line) writer.writerow(line)
return self.get_filename() + '.csv', 'text/csv', output.getvalue().encode(self.get_csv_encoding(), errors='replace') return self.get_filename() + '.csv', 'text/csv', output.getvalue().encode("utf-8")
def prepare_xlsx_sheet(self, ws): def prepare_xlsx_sheet(self, ws):
pass pass
@@ -259,7 +256,7 @@ class ListExporter(BaseExporter):
ws = wb.create_sheet() ws = wb.create_sheet()
self.prepare_xlsx_sheet(ws) self.prepare_xlsx_sheet(ws)
try: try:
ws.title = str(self.verbose_name)[:30] ws.title = str(self.verbose_name)
except: except:
pass pass
total = 0 total = 0
@@ -377,7 +374,7 @@ class MultiSheetListExporter(ListExporter):
wb = SafeWorkbook(write_only=True) wb = SafeWorkbook(write_only=True)
n_sheets = len(self.sheets) n_sheets = len(self.sheets)
for i_sheet, (s, l) in enumerate(self.sheets): for i_sheet, (s, l) in enumerate(self.sheets):
ws = wb.create_sheet(str(l)[:30]) ws = wb.create_sheet(str(l))
if hasattr(self, 'prepare_xlsx_sheet_' + s): if hasattr(self, 'prepare_xlsx_sheet_' + s):
getattr(self, 'prepare_xlsx_sheet_' + s)(ws) getattr(self, 'prepare_xlsx_sheet_' + s)(ws)
+2 -5
View File
@@ -560,7 +560,7 @@ class OrderListExporter(MultiSheetListExporter):
), ),
).select_related( ).select_related(
'order', 'order__invoice_address', 'order__customer', 'item', 'variation', 'order', 'order__invoice_address', 'order__customer', 'item', 'variation',
'voucher', 'tax_rule', 'addon_to', 'voucher', 'tax_rule'
).prefetch_related( ).prefetch_related(
'subevent', 'subevent__meta_values', 'subevent', 'subevent__meta_values',
'answers', 'answers__question', 'answers__options' 'answers', 'answers__question', 'answers__options'
@@ -619,7 +619,6 @@ class OrderListExporter(MultiSheetListExporter):
_('Valid until'), _('Valid until'),
_('Order comment'), _('Order comment'),
_('Follow-up date'), _('Follow-up date'),
_('Add-on to position ID'),
] ]
questions = list(Question.objects.filter(event__in=self.events)) questions = list(Question.objects.filter(event__in=self.events))
@@ -653,8 +652,7 @@ class OrderListExporter(MultiSheetListExporter):
_('VAT ID'), _('VAT ID'),
] ]
headers += [ headers += [
_('Sales channel'), _('Sales channel'), _('Order locale'),
_('Order locale'),
_('E-mail address verified'), _('E-mail address verified'),
_('External customer ID'), _('External customer ID'),
_('Check-in lists'), _('Check-in lists'),
@@ -745,7 +743,6 @@ class OrderListExporter(MultiSheetListExporter):
] ]
row.append(order.comment) row.append(order.comment)
row.append(order.custom_followup_at.strftime("%Y-%m-%d") if order.custom_followup_at else "") row.append(order.custom_followup_at.strftime("%Y-%m-%d") if order.custom_followup_at else "")
row.append(op.addon_to.positionid if op.addon_to_id else "")
acache = {} acache = {}
for a in op.answers.all(): for a in op.answers.all():
# We do not want to localize Date, Time and Datetime question answers, as those can lead # We do not want to localize Date, Time and Datetime question answers, as those can lead
+1 -2
View File
@@ -38,7 +38,6 @@ from datetime import datetime
from django import forms from django import forms
from django.utils.formats import get_format from django.utils.formats import get_format
from django.utils.functional import lazy from django.utils.functional import lazy
from django.utils.html import escape
from django.utils.timezone import get_current_timezone, now from django.utils.timezone import get_current_timezone, now
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
@@ -65,7 +64,7 @@ def format_placeholders_help_text(placeholders, event=None):
placeholders = [(k, v.render_sample(event) if event else v) for k, v in placeholders.items()] placeholders = [(k, v.render_sample(event) if event else v) for k, v in placeholders.items()]
placeholders.sort(key=lambda x: x[0]) placeholders.sort(key=lambda x: x[0])
phs = [ phs = [
'<button type="button" class="content-placeholder" title="%s">{%s}</button>' % (escape(_("Sample: %s") % v) if v else "", escape(k)) '<button type="button" class="content-placeholder" title="%s">{%s}</button>' % (_("Sample: %s") % v if v else "", k)
for k, v in placeholders for k, v in placeholders
] ]
return _('Available placeholders: {list}').format( return _('Available placeholders: {list}').format(
+1 -1
View File
@@ -30,7 +30,7 @@ from typing import Tuple
import bleach import bleach
import vat_moss.exchange_rates import vat_moss.exchange_rates
from bidi import get_display from bidi.algorithm import get_display
from django.contrib.staticfiles import finders from django.contrib.staticfiles import finders
from django.db.models import Sum from django.db.models import Sum
from django.dispatch import receiver from django.dispatch import receiver
@@ -50,7 +50,6 @@ class Command(BaseCommand):
def add_arguments(self, parser): def add_arguments(self, parser):
parser.add_argument('--tasks', action='store', type=str, help='Only execute the tasks with this name ' parser.add_argument('--tasks', action='store', type=str, help='Only execute the tasks with this name '
'(dotted path, comma separation)') '(dotted path, comma separation)')
parser.add_argument('--list-tasks', action='store_true', help='Only list all tasks')
parser.add_argument('--exclude', action='store', type=str, help='Exclude the tasks with this name ' parser.add_argument('--exclude', action='store', type=str, help='Exclude the tasks with this name '
'(dotted path, comma separation)') '(dotted path, comma separation)')
@@ -62,9 +61,6 @@ class Command(BaseCommand):
for receiver in periodic_task._live_receivers(self): for receiver in periodic_task._live_receivers(self):
name = f'{receiver.__module__}.{receiver.__name__}' name = f'{receiver.__module__}.{receiver.__name__}'
if options['list_tasks']:
print(name)
continue
if options.get('tasks'): if options.get('tasks'):
if name not in options.get('tasks').split(','): if name not in options.get('tasks').split(','):
continue continue
@@ -1,7 +1,6 @@
# Generated by Django 4.2.8 on 2024-07-01 09:26 # Generated by Django 4.2.8 on 2024-07-01 09:26
from django.db import migrations, models from django.db import migrations, models
import pretix.base.models.orders import pretix.base.models.orders
@@ -0,0 +1,54 @@
# Generated by Django 4.2.8 on 2024-07-01 09:27
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
(
"pretixbase",
"0268_remove_subevent_items_remove_subevent_variations_and_more",
),
]
operations = [
migrations.RunSQL(
"UPDATE pretixbase_order "
"SET organizer_id = (SELECT e.organizer_id FROM pretixbase_event e WHERE e.id = pretixbase_order.event_id) "
"WHERE pretixbase_order.id IN (SELECT id FROM pretixbase_order o2 WHERE o2.organizer_id IS NULL);"
),
migrations.RunSQL(
"UPDATE pretixbase_orderposition "
"SET organizer_id = (SELECT e.organizer_id FROM pretixbase_order o LEFT JOIN pretixbase_event e ON e.id = o.event_id WHERE o.id = pretixbase_orderposition.order_id) "
"WHERE pretixbase_orderposition.id IN (SELECT id FROM pretixbase_orderposition op2 WHERE op2.organizer_id IS NULL);"
),
migrations.AlterField(
model_name="order",
name="organizer",
field=models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="orders",
to="pretixbase.organizer",
),
),
migrations.AlterField(
model_name="order",
name="organizer",
field=models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="orders",
to="pretixbase.organizer",
),
),
migrations.AlterField(
model_name="orderposition",
name="organizer",
field=models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="order_positions",
to="pretixbase.organizer",
),
),
]
@@ -1,18 +0,0 @@
# Generated by Django 4.2.13 on 2024-07-17 14:03
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('pretixbase', '0268_remove_subevent_items_remove_subevent_variations_and_more'),
]
operations = [
migrations.AddField(
model_name='order',
name='api_meta',
field=models.JSONField(default=dict),
),
]
@@ -1,36 +0,0 @@
# Generated by Django 4.2.15 on 2024-09-16 15:10
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("pretixbase", "0269_order_api_meta"),
]
operations = [
migrations.CreateModel(
name="HistoricPassword",
fields=[
(
"id",
models.BigAutoField(
auto_created=True, primary_key=True, serialize=False
),
),
("created", models.DateTimeField(auto_now_add=True)),
("password", models.CharField(max_length=128)),
(
"user",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="historic_passwords",
to=settings.AUTH_USER_MODEL,
),
),
],
),
]
+1 -7
View File
@@ -213,13 +213,7 @@ class DatetimeColumnMixin:
except (ValueError, TypeError): except (ValueError, TypeError):
pass pass
else: else:
try: raise ValidationError(_("Could not parse {value} as a date and time.").format(value=value))
d = datetime.datetime.fromisoformat(value)
if not d.tzinfo:
d = d.replace(tzinfo=self.timezone)
return d
except (ValueError, TypeError):
raise ValidationError(_("Could not parse {value} as a date and time.").format(value=value))
class DecimalColumnMixin: class DecimalColumnMixin:
+2 -20
View File
@@ -40,8 +40,8 @@ from phonenumbers import SUPPORTED_REGIONS
from pretix.base.forms.questions import guess_country from pretix.base.forms.questions import guess_country
from pretix.base.modelimport import ( from pretix.base.modelimport import (
BooleanColumnMixin, DatetimeColumnMixin, DecimalColumnMixin, ImportColumn, DatetimeColumnMixin, DecimalColumnMixin, ImportColumn, SubeventColumnMixin,
SubeventColumnMixin, i18n_flat, i18n_flat,
) )
from pretix.base.models import ( from pretix.base.models import (
Customer, ItemVariation, OrderPosition, Question, QuestionAnswer, Customer, ItemVariation, OrderPosition, Question, QuestionAnswer,
@@ -604,22 +604,6 @@ class Comment(ImportColumn):
order.comment = value or '' order.comment = value or ''
class CheckinAttentionColumn(BooleanColumnMixin, ImportColumn):
identifier = 'checkin_attention'
verbose_name = gettext_lazy('Requires special attention')
def assign(self, value, order, position, invoice_address, **kwargs):
order.checkin_attention = value
class CheckinTextColumn(ImportColumn):
identifier = 'checkin_text'
verbose_name = gettext_lazy('Check-in text')
def assign(self, value, order, position, invoice_address, **kwargs):
order.checkin_text = value
class QuestionColumn(ImportColumn): class QuestionColumn(ImportColumn):
def __init__(self, event, q): def __init__(self, event, q):
self.q = q self.q = q
@@ -758,8 +742,6 @@ def get_order_import_columns(event):
ValidUntil(event), ValidUntil(event),
Locale(event), Locale(event),
Saleschannel(event), Saleschannel(event),
CheckinAttentionColumn(event),
CheckinTextColumn(event),
Expires(event), Expires(event),
Comment(event), Comment(event),
] ]
+4 -4
View File
@@ -28,9 +28,9 @@ from django.utils.translation import gettext as _, gettext_lazy, pgettext_lazy
from pretix.base.modelimport import ( from pretix.base.modelimport import (
BooleanColumnMixin, DatetimeColumnMixin, DecimalColumnMixin, ImportColumn, BooleanColumnMixin, DatetimeColumnMixin, DecimalColumnMixin, ImportColumn,
IntegerColumnMixin, SubeventColumnMixin, i18n_flat, IntegerColumnMixin, i18n_flat,
) )
from pretix.base.models import ItemVariation, Quota, Seat, SubEvent, Voucher from pretix.base.models import ItemVariation, Quota, Seat, Voucher
from pretix.base.signals import voucher_import_columns from pretix.base.signals import voucher_import_columns
@@ -55,11 +55,11 @@ class CodeColumn(ImportColumn):
obj.code = value obj.code = value
class SubeventColumn(SubeventColumnMixin, ImportColumn): class SubeventColumn(ImportColumn):
identifier = 'subevent' identifier = 'subevent'
verbose_name = pgettext_lazy('subevents', 'Date') verbose_name = pgettext_lazy('subevents', 'Date')
def assign(self, value, obj: SubEvent, **kwargs): def assign(self, value, obj: Voucher, **kwargs):
obj.subevent = value obj.subevent = value
-6
View File
@@ -654,9 +654,3 @@ class WebAuthnDevice(Device):
@property @property
def webauthnpubkey(self): def webauthnpubkey(self):
return websafe_decode(self.pub_key) return websafe_decode(self.pub_key)
class HistoricPassword(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE, related_name="historic_passwords")
created = models.DateTimeField(auto_now_add=True)
password = models.CharField(verbose_name=_("Password"), max_length=128)
+3 -3
View File
@@ -102,9 +102,9 @@ class CheckinList(LoggedModel):
auto_checkin_sales_channels = models.ManyToManyField( auto_checkin_sales_channels = models.ManyToManyField(
"SalesChannel", "SalesChannel",
verbose_name=_('Sales channels to automatically check in'), verbose_name=_('Sales channels to automatically check in'),
help_text=_('This option is deprecated and will be removed in the next months. As a replacement, our new plugin ' help_text=_('All items on this check-in list will be automatically marked as checked-in when purchased through '
'"Auto check-in" can be used. When we remove this option, we will automatically migrate your event ' 'any of the selected sales channels. This option can be useful when tickets sold at the box office '
'to use the new plugin.'), 'are not checked again before entry and should be considered validated directly upon purchase.'),
blank=True, blank=True,
) )
rules = models.JSONField(default=dict, blank=True) rules = models.JSONField(default=dict, blank=True)
+41 -18
View File
@@ -60,6 +60,7 @@ from django.urls import reverse
from django.utils.crypto import get_random_string from django.utils.crypto import get_random_string
from django.utils.formats import date_format from django.utils.formats import date_format
from django.utils.functional import cached_property from django.utils.functional import cached_property
from django.utils.html import format_html
from django.utils.timezone import make_aware, now from django.utils.timezone import make_aware, now
from django.utils.translation import gettext, gettext_lazy as _ from django.utils.translation import gettext, gettext_lazy as _
from django_scopes import ScopedManager, scopes_disabled from django_scopes import ScopedManager, scopes_disabled
@@ -179,10 +180,14 @@ class EventMixin:
""" """
tz = tz or self.timezone tz = tz or self.timezone
if (not self.settings.show_date_to and not force_show_end) or not self.date_to: if (not self.settings.show_date_to and not force_show_end) or not self.date_to:
df, dt = self.date_from, self.date_from if as_html:
else: return format_html(
df, dt = self.date_from, self.date_to "<time datetime=\"{}\">{}</time>",
return daterange(df.astimezone(tz), dt.astimezone(tz), as_html) _date(self.date_from.astimezone(tz), "Y-m-d"),
_date(self.date_from.astimezone(tz), "DATE_FORMAT"),
)
return _date(self.date_from.astimezone(tz), "DATE_FORMAT")
return daterange(self.date_from.astimezone(tz), self.date_to.astimezone(tz), as_html)
def get_date_range_display_as_html(self, tz=None, force_show_end=False) -> str: def get_date_range_display_as_html(self, tz=None, force_show_end=False) -> str:
return self.get_date_range_display(tz, force_show_end, as_html=True) return self.get_date_range_display(tz, force_show_end, as_html=True)
@@ -299,13 +304,10 @@ class EventMixin:
return safe_string(json.dumps(eventdict)) return safe_string(json.dumps(eventdict))
@classmethod @classmethod
def annotated(cls, qs, channel, voucher=None): def annotated(cls, qs, channel='web', voucher=None):
# Channel can currently be a SalesChannel or a str, since we need that compatibility, but a SalesChannel from pretix.base.models import Item, ItemVariation, Quota
# makes the query SIGNIFICANTLY faster
from pretix.base.models import Item, ItemVariation, Quota, SalesChannel
assert isinstance(channel, (SalesChannel, str))
assert isinstance(channel, str)
sq_active_item = Item.objects.using(settings.DATABASE_REPLICA).filter_available(channel=channel, voucher=voucher).filter( sq_active_item = Item.objects.using(settings.DATABASE_REPLICA).filter_available(channel=channel, voucher=voucher).filter(
Q(variations__isnull=True) Q(variations__isnull=True)
& Q(quotas__pk=OuterRef('pk')) & Q(quotas__pk=OuterRef('pk'))
@@ -313,9 +315,33 @@ class EventMixin:
items=GroupConcat('pk', delimiter=',') items=GroupConcat('pk', delimiter=',')
).values('items') ).values('items')
sq_active_variation = ItemVariation.objects.filter_available(channel=channel, voucher=voucher).filter( q_variation = (
Q(quotas__pk=OuterRef('pk')) Q(active=True)
).order_by().values_list('quotas__pk').annotate( & Q(Q(all_sales_channels=True) | Q(limit_sales_channels__identifier=channel))
& Q(Q(available_from__isnull=True) | Q(available_from__lte=time_machine_now()))
& Q(Q(available_until__isnull=True) | Q(available_until__gte=time_machine_now()))
& Q(item__active=True)
& Q(Q(item__available_from__isnull=True) | Q(item__available_from__lte=time_machine_now()))
& Q(Q(item__available_until__isnull=True) | Q(item__available_until__gte=time_machine_now()))
& Q(Q(item__category__isnull=True) | Q(item__category__is_addon=False))
& Q(Q(item__all_sales_channels=True) | Q(item__limit_sales_channels__identifier=channel))
& Q(item__require_bundling=False)
& Q(quotas__pk=OuterRef('pk'))
)
if voucher:
if voucher.variation_id:
q_variation &= Q(pk=voucher.variation_id)
elif voucher.item_id:
q_variation &= Q(item_id=voucher.item_id)
elif voucher.quota_id:
q_variation &= Q(quotas__in=[voucher.quota_id])
if not voucher or not voucher.show_hidden_items:
q_variation &= Q(hide_without_voucher=False)
q_variation &= Q(item__hide_without_voucher=False)
sq_active_variation = ItemVariation.objects.filter(q_variation).order_by().values_list('quotas__pk').annotate(
items=GroupConcat('pk', delimiter=',') items=GroupConcat('pk', delimiter=',')
).values('items') ).values('items')
quota_base_qs = Quota.objects.using(settings.DATABASE_REPLICA).filter( quota_base_qs = Quota.objects.using(settings.DATABASE_REPLICA).filter(
@@ -936,7 +962,7 @@ class Event(EventMixin, LoggedModel):
): ):
c_items = list(d.condition_limit_products.all()) c_items = list(d.condition_limit_products.all())
b_items = list(d.benefit_limit_products.all()) b_items = list(d.benefit_limit_products.all())
limit_sales_channels = list(d.limit_sales_channels.all()) limit_sales_channels = list(v.limit_sales_channels.all())
d.pk = None d.pk = None
d.event = self d.event = self
d._prefetched_objects_cache = {} d._prefetched_objects_cache = {}
@@ -1510,11 +1536,8 @@ class SubEvent(EventMixin, LoggedModel):
return qs_annotated return qs_annotated
@classmethod @classmethod
def annotated(cls, qs, channel, voucher=None): def annotated(cls, qs, channel='web', voucher=None):
from .items import SubEventItem, SubEventItemVariation from .items import SubEventItem, SubEventItemVariation
from .organizer import SalesChannel
assert isinstance(channel, (str, SalesChannel))
qs = super().annotated(qs, channel, voucher=voucher) qs = super().annotated(qs, channel, voucher=voucher)
qs = qs.annotate( qs = qs.annotate(
+3 -67
View File
@@ -271,24 +271,16 @@ class SubEventItemVariation(models.Model):
def filter_available(qs, channel='web', voucher=None, allow_addons=False): def filter_available(qs, channel='web', voucher=None, allow_addons=False):
# Channel can currently be a SalesChannel or a str, since we need that compatibility, but a SalesChannel assert isinstance(channel, str)
# makes the query SIGNIFICANTLY faster
from .organizer import SalesChannel
assert isinstance(channel, (SalesChannel, str))
q = ( q = (
# IMPORTANT: If this is updated, also update the ItemVariation query # IMPORTANT: If this is updated, also update the ItemVariation query
# in models/event.py: EventMixin.annotated() # in models/event.py: EventMixin.annotated()
Q(active=True) Q(active=True)
& Q(Q(available_from__isnull=True) | Q(available_from__lte=time_machine_now()) | Q(available_from_mode='info')) & Q(Q(available_from__isnull=True) | Q(available_from__lte=time_machine_now()) | Q(available_from_mode='info'))
& Q(Q(available_until__isnull=True) | Q(available_until__gte=time_machine_now()) | Q(available_until_mode='info')) & Q(Q(available_until__isnull=True) | Q(available_until__gte=time_machine_now()) | Q(available_until_mode='info'))
& Q(Q(all_sales_channels=True) | Q(limit_sales_channels__identifier=channel))
& Q(require_bundling=False) & Q(require_bundling=False)
) )
if isinstance(channel, str):
q &= Q(Q(all_sales_channels=True) | Q(limit_sales_channels__identifier=channel))
else:
q &= Q(Q(all_sales_channels=True) | Q(limit_sales_channels=channel))
if not allow_addons: if not allow_addons:
q &= Q(Q(category__isnull=True) | Q(category__is_addon=False)) q &= Q(Q(category__isnull=True) | Q(category__is_addon=False))
@@ -303,48 +295,6 @@ def filter_available(qs, channel='web', voucher=None, allow_addons=False):
return qs.filter(q) return qs.filter(q)
def filter_variations_available(qs, channel='web', voucher=None, allow_addons=False):
# Channel can currently be a SalesChannel or a str, since we need that compatibility, but a SalesChannel
# makes the query SIGNIFICANTLY faster
from .organizer import SalesChannel
assert isinstance(channel, (SalesChannel, str))
q = (
Q(active=True)
& Q(Q(available_from__isnull=True) | Q(available_from__lte=time_machine_now()))
& Q(Q(available_until__isnull=True) | Q(available_until__gte=time_machine_now()))
& Q(item__active=True)
& Q(Q(item__available_from__isnull=True) | Q(item__available_from__lte=time_machine_now()))
& Q(Q(item__available_until__isnull=True) | Q(item__available_until__gte=time_machine_now()))
& Q(Q(item__category__isnull=True) | Q(item__category__is_addon=False))
& Q(item__require_bundling=False)
)
if isinstance(channel, str):
q &= Q(Q(all_sales_channels=True) | Q(limit_sales_channels__identifier=channel))
q &= Q(Q(item__all_sales_channels=True) | Q(item__limit_sales_channels__identifier=channel))
else:
q &= Q(Q(all_sales_channels=True) | Q(limit_sales_channels=channel))
q &= Q(Q(item__all_sales_channels=True) | Q(item__limit_sales_channels=channel))
if not allow_addons:
q &= Q(Q(item__category__isnull=True) | Q(item__category__is_addon=False))
if voucher:
if voucher.variation_id:
q &= Q(pk=voucher.variation_id)
elif voucher.item_id:
q &= Q(item_id=voucher.item_id)
elif voucher.quota_id:
q &= Q(quotas__in=[voucher.quota_id])
if not voucher or not voucher.show_hidden_items:
q &= Q(hide_without_voucher=False)
q &= Q(item__hide_without_voucher=False)
return qs.filter(q)
class ItemQuerySet(models.QuerySet): class ItemQuerySet(models.QuerySet):
def filter_available(self, channel='web', voucher=None, allow_addons=False): def filter_available(self, channel='web', voucher=None, allow_addons=False):
return filter_available(self, channel, voucher, allow_addons) return filter_available(self, channel, voucher, allow_addons)
@@ -359,20 +309,6 @@ class ItemQuerySetManager(ScopedManager(organizer='event__organizer').__class__)
return filter_available(self.get_queryset(), channel, voucher, allow_addons) return filter_available(self.get_queryset(), channel, voucher, allow_addons)
class ItemVariationQuerySet(models.QuerySet):
def filter_available(self, channel='web', voucher=None, allow_addons=False):
return filter_variations_available(self, channel, voucher, allow_addons)
class ItemVariationQuerySetManager(ScopedManager(organizer='item__event__organizer').__class__):
def __init__(self):
super().__init__()
self._queryset_class = ItemVariationQuerySet
def filter_available(self, channel='web', voucher=None, allow_addons=False):
return filter_variations_available(self.get_queryset(), channel, voucher, allow_addons)
class Item(LoggedModel): class Item(LoggedModel):
""" """
An item is a thing which can be sold. It belongs to an event and may or may not belong to a category. An item is a thing which can be sold. It belongs to an event and may or may not belong to a category.
@@ -1255,7 +1191,7 @@ class ItemVariation(models.Model):
help_text=_('This text will be shown by the check-in app if a ticket of this type is scanned.') help_text=_('This text will be shown by the check-in app if a ticket of this type is scanned.')
) )
objects = ItemVariationQuerySetManager() objects = ScopedManager(organizer='item__event__organizer')
class Meta: class Meta:
verbose_name = _("Product variation") verbose_name = _("Product variation")
-17
View File
@@ -223,8 +223,6 @@ class Order(LockModel, LoggedModel):
"Organizer", "Organizer",
related_name="orders", related_name="orders",
on_delete=models.CASCADE, on_delete=models.CASCADE,
null=True,
blank=True,
) )
event = models.ForeignKey( event = models.ForeignKey(
Event, Event,
@@ -299,11 +297,6 @@ class Order(LockModel, LoggedModel):
verbose_name=_("Meta information"), verbose_name=_("Meta information"),
null=True, blank=True null=True, blank=True
) )
api_meta = models.JSONField(
verbose_name=_("API meta information"),
null=False, blank=True,
default=dict
)
last_modified = models.DateTimeField( last_modified = models.DateTimeField(
auto_now=True, db_index=False auto_now=True, db_index=False
) )
@@ -2422,8 +2415,6 @@ class OrderPosition(AbstractPosition):
"Organizer", "Organizer",
related_name="order_positions", related_name="order_positions",
on_delete=models.CASCADE, on_delete=models.CASCADE,
null=True,
blank=True,
) )
order = models.ForeignKey( order = models.ForeignKey(
Order, Order,
@@ -2835,14 +2826,6 @@ class OrderPosition(AbstractPosition):
(self.order.event.settings.change_allow_user_addons and ItemAddOn.objects.filter(base_item_id__in=[op.item_id for op in positions]).exists()) (self.order.event.settings.change_allow_user_addons and ItemAddOn.objects.filter(base_item_id__in=[op.item_id for op in positions]).exists())
) )
@property
def code(self):
"""
A ticket code which is unique among all events of a single organizer,
built by the order code and the position number.
"""
return '{order_code}-{position}'.format(order_code=self.order.code, position=self.positionid)
class Transaction(models.Model): class Transaction(models.Model):
""" """
+12 -23
View File
@@ -185,7 +185,7 @@ class Seat(models.Model):
@classmethod @classmethod
def annotated(cls, qs, event_id, subevent, ignore_voucher_id=None, minimal_distance=0, def annotated(cls, qs, event_id, subevent, ignore_voucher_id=None, minimal_distance=0,
ignore_order_id=None, ignore_cart_id=None, distance_only_within_row=False, annotate_ids=False): ignore_order_id=None, ignore_cart_id=None, distance_only_within_row=False):
from . import CartPosition, Order, OrderPosition, Voucher from . import CartPosition, Order, OrderPosition, Voucher
vqs = Voucher.objects.filter( vqs = Voucher.objects.filter(
@@ -214,24 +214,17 @@ class Seat(models.Model):
) )
if ignore_cart_id: if ignore_cart_id:
cqs = cqs.exclude(cart_id=ignore_cart_id) cqs = cqs.exclude(cart_id=ignore_cart_id)
if annotate_ids: qs_annotated = qs.annotate(
qs_annotated = qs.annotate( has_order=Exists(
orderposition_id=Subquery(opqs.values('id')), opqs
cartposition_id=Subquery(cqs.values('id')), ),
voucher_id=Subquery(vqs.values('id')), has_cart=Exists(
) cqs
else: ),
qs_annotated = qs.annotate( has_voucher=Exists(
has_order=Exists( vqs
opqs
),
has_cart=Exists(
cqs
),
has_voucher=Exists(
vqs
)
) )
)
if minimal_distance > 0: if minimal_distance > 0:
# TODO: Is there a more performant implementation on PostgreSQL using # TODO: Is there a more performant implementation on PostgreSQL using
@@ -242,11 +235,7 @@ class Seat(models.Model):
Power(F('y') - OuterRef('y'), Value(2), output_field=models.FloatField()) Power(F('y') - OuterRef('y'), Value(2), output_field=models.FloatField())
) )
).filter( ).filter(
( Q(has_order=True) | Q(has_cart=True) | Q(has_voucher=True),
(Q(orderposition_id__isnull=False) | Q(cartposition_id__isnull=False) | Q(voucher_id__isnull=False))
if annotate_ids else
(Q(has_order=True) | Q(has_cart=True) | Q(has_voucher=True))
),
distance__lt=minimal_distance ** 2 distance__lt=minimal_distance ** 2
) )
if distance_only_within_row: if distance_only_within_row:
+5 -15
View File
@@ -29,8 +29,6 @@ from django.core.validators import MaxValueValidator, MinValueValidator
from django.db import models from django.db import models
from django.utils.deconstruct import deconstructible from django.utils.deconstruct import deconstructible
from django.utils.formats import localize from django.utils.formats import localize
from django.utils.functional import lazy
from django.utils.html import format_html
from django.utils.translation import gettext_lazy as _, pgettext from django.utils.translation import gettext_lazy as _, pgettext
from i18nfield.fields import I18nCharField from i18nfield.fields import I18nCharField
from i18nfield.strings import LazyI18nString from i18nfield.strings import LazyI18nString
@@ -122,8 +120,6 @@ EU_CURRENCIES = {
} }
VAT_ID_COUNTRIES = EU_COUNTRIES | {'CH', 'NO'} VAT_ID_COUNTRIES = EU_COUNTRIES | {'CH', 'NO'}
format_html_lazy = lazy(format_html, str)
def is_eu_country(cc): def is_eu_country(cc):
cc = str(cc) cc = str(cc)
@@ -197,17 +193,11 @@ class TaxRule(LoggedModel):
eu_reverse_charge = models.BooleanField( eu_reverse_charge = models.BooleanField(
verbose_name=_("Use EU reverse charge taxation rules"), verbose_name=_("Use EU reverse charge taxation rules"),
default=False, default=False,
help_text=format_html_lazy( help_text=_("Not recommended. Most events will NOT be qualified for reverse charge since the place of "
'<span class="label label-warning" data-toggle="tooltip" title="{}">{}</span> {}', "taxation is the location of the event. This option disables charging VAT for all customers "
_('This feature will be removed in the future as it does not handle VAT for non-business customers in ' "outside the EU and for business customers in different EU countries who entered a valid EU VAT "
'other EU countries in a way that works for all organizers. Use custom rules instead.'), "ID. Only enable this option after consulting a tax counsel. No warranty given for correct tax "
_('DEPRECATED'), "calculation. USE AT YOUR OWN RISK.")
_("Not recommended. Most events will NOT be qualified for reverse charge since the place of "
"taxation is the location of the event. This option disables charging VAT for all customers "
"outside the EU and for business customers in different EU countries who entered a valid EU VAT "
"ID. Only enable this option after consulting a tax counsel. No warranty given for correct tax "
"calculation. USE AT YOUR OWN RISK.")
),
) )
home_country = FastCountryField( home_country = FastCountryField(
verbose_name=_('Merchant country'), verbose_name=_('Merchant country'),
+1 -1
View File
@@ -587,7 +587,7 @@ class BasePaymentProvider:
return rel_date.datetime(self.event).date() return rel_date.datetime(self.event).date()
def _is_available_by_time(self, now_dt=None, cart_id=None, order=None): def _is_available_by_time(self, now_dt=None, cart_id=None, order=None):
now_dt = now_dt or time_machine_now() now_dt = now_dt or now()
tz = ZoneInfo(self.event.settings.timezone) tz = ZoneInfo(self.event.settings.timezone)
try: try:
+9 -48
View File
@@ -49,7 +49,7 @@ from io import BytesIO
import jsonschema import jsonschema
import reportlab.rl_config import reportlab.rl_config
from bidi import get_display from bidi.algorithm import get_display
from django.conf import settings from django.conf import settings
from django.contrib.staticfiles import finders from django.contrib.staticfiles import finders
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
@@ -956,7 +956,7 @@ class Renderer:
) )
canvas.restoreState() canvas.restoreState()
def _text_paragraph(self, op: OrderPosition, order: Order, o: dict, legacy_lineheight=False, override_fontsize=None): def _draw_textarea(self, canvas: Canvas, op: OrderPosition, order: Order, o: dict):
font = o['fontfamily'] font = o['fontfamily']
# Since pdfmetrics.registerFont is global, we want to make sure that no one tries to sneak in a font, they # Since pdfmetrics.registerFont is global, we want to make sure that no one tries to sneak in a font, they
@@ -970,13 +970,12 @@ class Renderer:
if o['italic']: if o['italic']:
font += ' I' font += ' I'
fontsize = override_fontsize if override_fontsize is not None else float(o['fontsize'])
try: try:
ad = getAscentDescent(font, fontsize) ad = getAscentDescent(font, float(o['fontsize']))
except KeyError: # font not known, fall back except KeyError: # font not known, fall back
logger.warning(f'Use of unknown font "{font}"') logger.warning(f'Use of unknown font "{font}"')
font = 'Open Sans' font = 'Open Sans'
ad = getAscentDescent(font, fontsize) ad = getAscentDescent(font, float(o['fontsize']))
align_map = { align_map = {
'left': TA_LEFT, 'left': TA_LEFT,
@@ -986,17 +985,16 @@ class Renderer:
# lineheight display differs from browser canvas. This calc is just empirical values to get # lineheight display differs from browser canvas. This calc is just empirical values to get
# reportlab render similarly to browser canvas. # reportlab render similarly to browser canvas.
# for backwards compatability use „uncorrected“ lineheight of 1.0 instead of 1.15 # for backwards compatability use „uncorrected“ lineheight of 1.0 instead of 1.15
lineheight = float(o['lineheight']) * 1.15 if not legacy_lineheight or 'lineheight' in o else 1.0 lineheight = float(o['lineheight']) * 1.15 if 'lineheight' in o else 1.0
style = ParagraphStyle( style = ParagraphStyle(
name=uuid.uuid4().hex, name=uuid.uuid4().hex,
fontName=font, fontName=font,
fontSize=fontsize, fontSize=float(o['fontsize']),
leading=lineheight * fontsize, leading=lineheight * float(o['fontsize']),
# for backwards compatability use autoLeading if no lineheight is given # for backwards compatability use autoLeading if no lineheight is given
autoLeading='off' if not legacy_lineheight or 'lineheight' in o else 'max', autoLeading='off' if 'lineheight' in o else 'max',
textColor=Color(o['color'][0] / 255, o['color'][1] / 255, o['color'][2] / 255), textColor=Color(o['color'][0] / 255, o['color'][1] / 255, o['color'][2] / 255),
alignment=align_map[o['align']], alignment=align_map[o['align']]
splitLongWords=o.get('splitlongwords', True),
) )
# add an almost-invisible space &hairsp; after hyphens as word-wrap in ReportLab only works on space chars # add an almost-invisible space &hairsp; after hyphens as word-wrap in ReportLab only works on space chars
text = conditional_escape( text = conditional_escape(
@@ -1015,41 +1013,6 @@ class Renderer:
logger.exception('Reshaping/Bidi fixes failed on string {}'.format(repr(text))) logger.exception('Reshaping/Bidi fixes failed on string {}'.format(repr(text)))
p = Paragraph(text, style=style) p = Paragraph(text, style=style)
return p, ad, lineheight
def _draw_textcontainer(self, canvas: Canvas, op: OrderPosition, order: Order, o: dict):
fontsize = float(o['fontsize'])
height = float(o['height']) * mm
width = float(o['width']) * mm
while True:
p, ad, lineheight = self._text_paragraph(op, order, o, override_fontsize=fontsize)
w, h = p.wrapOn(canvas, width, 1000 * mm)
widths = p.getActualLineWidths0()
if not widths:
break
actual_w = max(widths)
if not o.get('autoresize', False) or (h <= height and actual_w <= width) or fontsize <= 1.0:
break
if h > height: # we can do larger steps for height
fontsize -= max(1.0, fontsize * .1)
else:
fontsize -= max(.25, fontsize * .025)
canvas.saveState()
# The ascent/descent offsets here are not really proven to be correct, they're just empirical values to get
# reportlab render similarly to browser canvas.
canvas.translate(float(o['left']) * mm, float(o['bottom']) * mm + height)
canvas.rotate(o.get('rotation', 0) * -1)
if o.get('verticalalign', 'top') == 'top':
p.drawOn(canvas, 0, - h)
elif o.get('verticalalign', 'top') == 'middle':
p.drawOn(canvas, 0, (-height - h) / 2)
elif o.get('verticalalign', 'top') == 'bottom':
p.drawOn(canvas, 0, -height)
canvas.restoreState()
def _draw_textarea(self, canvas: Canvas, op: OrderPosition, order: Order, o: dict):
p, ad, lineheight = self._text_paragraph(op, order, o, legacy_lineheight=True)
w, h = p.wrapOn(canvas, float(o['width']) * mm, 1000 * mm) w, h = p.wrapOn(canvas, float(o['width']) * mm, 1000 * mm)
# p_size = p.wrap(float(o['width']) * mm, 1000 * mm) # p_size = p.wrap(float(o['width']) * mm, 1000 * mm)
canvas.saveState() canvas.saveState()
@@ -1088,8 +1051,6 @@ class Renderer:
self._draw_barcodearea(canvas, op, order, o) self._draw_barcodearea(canvas, op, order, o)
elif o['type'] == "imagearea": elif o['type'] == "imagearea":
self._draw_imagearea(canvas, op, order, o) self._draw_imagearea(canvas, op, order, o)
elif o['type'] == "textcontainer":
self._draw_textcontainer(canvas, op, order, o)
elif o['type'] == "textarea": elif o['type'] == "textarea":
self._draw_textarea(canvas, op, order, o) self._draw_textarea(canvas, op, order, o)
elif o['type'] == "poweredby": elif o['type'] == "poweredby":
+2 -8
View File
@@ -275,7 +275,7 @@ class CartManager:
} }
def __init__(self, event: Event, cart_id: str, sales_channel: SalesChannel, def __init__(self, event: Event, cart_id: str, sales_channel: SalesChannel,
invoice_address: InvoiceAddress=None, widget_data=None, expiry=None): invoice_address: InvoiceAddress=None, widget_data=None):
self.event = event self.event = event
self.cart_id = cart_id self.cart_id = cart_id
self.real_now_dt = now() self.real_now_dt = now()
@@ -287,7 +287,6 @@ class CartManager:
self._variations_cache = {} self._variations_cache = {}
self._seated_cache = {} self._seated_cache = {}
self._expiry = None self._expiry = None
self._explicit_expiry = expiry
self.invoice_address = invoice_address self.invoice_address = invoice_address
self._widget_data = widget_data or {} self._widget_data = widget_data or {}
self._sales_channel = sales_channel self._sales_channel = sales_channel
@@ -306,12 +305,7 @@ class CartManager:
return self._seated_cache[item, subevent] return self._seated_cache[item, subevent]
def _calculate_expiry(self): def _calculate_expiry(self):
if self._explicit_expiry: self._expiry = self.real_now_dt + timedelta(minutes=self.event.settings.get('reservation_time', as_type=int))
self._expiry = self._explicit_expiry
else:
self._expiry = self.real_now_dt + timedelta(
minutes=self.event.settings.get('reservation_time', as_type=int)
)
def _check_presale_dates(self): def _check_presale_dates(self):
if self.event.presale_start and time_machine_now(self.real_now_dt) < self.event.presale_start: if self.event.presale_start and time_machine_now(self.real_now_dt) < self.event.presale_start:
+4 -5
View File
@@ -1154,7 +1154,7 @@ def perform_checkin(op: OrderPosition, clist: CheckinList, given_answers: dict,
) )
@receiver(order_placed, dispatch_uid="legacy_autocheckin_order_placed") @receiver(order_placed, dispatch_uid="autocheckin_order_placed")
def order_placed(sender, **kwargs): def order_placed(sender, **kwargs):
order = kwargs['order'] order = kwargs['order']
event = sender event = sender
@@ -1171,7 +1171,7 @@ def order_placed(sender, **kwargs):
checkin_created.send(event, checkin=ci) checkin_created.send(event, checkin=ci)
@receiver(periodic_task, dispatch_uid="autocheckout_exit_all") @receiver(periodic_task, dispatch_uid="autocheckin_exit_all")
@scopes_disabled() @scopes_disabled()
def process_exit_all(sender, **kwargs): def process_exit_all(sender, **kwargs):
qs = CheckinList.objects.filter( qs = CheckinList.objects.filter(
@@ -1182,11 +1182,10 @@ def process_exit_all(sender, **kwargs):
positions = cl.positions_inside_query(ignore_status=True, at_time=cl.exit_all_at) positions = cl.positions_inside_query(ignore_status=True, at_time=cl.exit_all_at)
for p in positions: for p in positions:
with scope(organizer=cl.event.organizer): with scope(organizer=cl.event.organizer):
ci, created = Checkin.objects.get_or_create( ci = Checkin.objects.create(
position=p, list=cl, auto_checked_in=True, type=Checkin.TYPE_EXIT, datetime=cl.exit_all_at position=p, list=cl, auto_checked_in=True, type=Checkin.TYPE_EXIT, datetime=cl.exit_all_at
) )
if created: checkin_created.send(cl.event, checkin=ci)
checkin_created.send(cl.event, checkin=ci)
d = cl.exit_all_at.astimezone(cl.event.timezone) d = cl.exit_all_at.astimezone(cl.event.timezone)
if cl.event.settings.get(f'autocheckin_dst_hack_{cl.pk}'): # move time back if yesterday was DST switch if cl.event.settings.get(f'autocheckin_dst_hack_{cl.pk}'): # move time back if yesterday was DST switch
d -= timedelta(hours=1) d -= timedelta(hours=1)
+5 -18
View File
@@ -58,7 +58,6 @@ from django.core.mail import (
from django.core.mail.message import SafeMIMEText from django.core.mail.message import SafeMIMEText
from django.db import transaction from django.db import transaction
from django.template.loader import get_template from django.template.loader import get_template
from django.utils.html import escape
from django.utils.timezone import now, override from django.utils.timezone import now, override
from django.utils.translation import gettext as _, pgettext from django.utils.translation import gettext as _, pgettext
from django_scopes import scope, scopes_disabled from django_scopes import scope, scopes_disabled
@@ -110,22 +109,6 @@ def clean_sender_name(sender_name: str) -> str:
return sender_name return sender_name
def prefix_subject(settings_holder, subject, highlight=False):
prefix = settings_holder.settings.get('mail_prefix')
if prefix and prefix.startswith('[') and prefix.endswith(']'):
prefix = prefix[1:-1]
if prefix:
prefix = f"[{prefix}]"
if highlight:
prefix = '<span class="placeholder" title="{}">{}</span>'.format(
_('This prefix has been set in your event or organizer settings.'),
escape(prefix)
)
subject = f"{prefix} {subject}"
return subject
def mail(email: Union[str, Sequence[str]], subject: str, template: Union[str, LazyI18nString], def mail(email: Union[str, Sequence[str]], subject: str, template: Union[str, LazyI18nString],
context: Dict[str, Any] = None, event: Event = None, locale: str = None, order: Order = None, context: Dict[str, Any] = None, event: Event = None, locale: str = None, order: Order = None,
position: OrderPosition = None, *, headers: dict = None, sender: str = None, organizer: Organizer = None, position: OrderPosition = None, *, headers: dict = None, sender: str = None, organizer: Organizer = None,
@@ -257,7 +240,11 @@ def mail(email: Union[str, Sequence[str]], subject: str, template: Union[str, La
and settings_holder.settings.contact_mail and not headers.get('Reply-To'): and settings_holder.settings.contact_mail and not headers.get('Reply-To'):
headers['Reply-To'] = settings_holder.settings.contact_mail headers['Reply-To'] = settings_holder.settings.contact_mail
subject = prefix_subject(settings_holder, subject) prefix = settings_holder.settings.get('mail_prefix')
if prefix and prefix.startswith('[') and prefix.endswith(']'):
prefix = prefix[1:-1]
if prefix:
subject = "[%s] %s" % (prefix, subject)
body_plain += "\r\n\r\n-- \r\n" body_plain += "\r\n\r\n-- \r\n"
+7 -10
View File
@@ -960,7 +960,7 @@ def _get_fees(positions: List[CartPosition], payment_requests: List[dict], addre
def _create_order(event: Event, *, email: str, positions: List[CartPosition], now_dt: datetime, def _create_order(event: Event, *, email: str, positions: List[CartPosition], now_dt: datetime,
payment_requests: List[dict], sales_channel: SalesChannel, locale: str=None, payment_requests: List[dict], sales_channel: SalesChannel, locale: str=None,
address: InvoiceAddress=None, meta_info: dict=None, shown_total=None, address: InvoiceAddress=None, meta_info: dict=None, shown_total=None,
customer=None, valid_if_pending=False, api_meta: dict=None): customer=None, valid_if_pending=False):
payments = [] payments = []
try: try:
@@ -985,7 +985,6 @@ def _create_order(event: Event, *, email: str, positions: List[CartPosition], no
total=total, total=total,
testmode=True if sales_channel.type_instance.testmode_supported and event.testmode else False, testmode=True if sales_channel.type_instance.testmode_supported and event.testmode else False,
meta_info=json.dumps(meta_info or {}), meta_info=json.dumps(meta_info or {}),
api_meta=api_meta or {},
require_approval=require_approval, require_approval=require_approval,
sales_channel=sales_channel, sales_channel=sales_channel,
customer=customer, customer=customer,
@@ -1097,7 +1096,7 @@ def _order_placed_email_attendee(event: Event, order: Order, position: OrderPosi
def _perform_order(event: Event, payment_requests: List[dict], position_ids: List[str], def _perform_order(event: Event, payment_requests: List[dict], position_ids: List[str],
email: str, locale: str, address: int, meta_info: dict=None, sales_channel: str='web', email: str, locale: str, address: int, meta_info: dict=None, sales_channel: str='web',
shown_total=None, customer=None, api_meta: dict=None): shown_total=None, customer=None):
for p in payment_requests: for p in payment_requests:
p['pprov'] = event.get_payment_providers(cached=True)[p['provider']] p['pprov'] = event.get_payment_providers(cached=True)[p['provider']]
if not p['pprov']: if not p['pprov']:
@@ -1201,8 +1200,7 @@ def _perform_order(event: Event, payment_requests: List[dict], position_ids: Lis
sales_channel=sales_channel, sales_channel=sales_channel,
shown_total=shown_total, shown_total=shown_total,
customer=customer, customer=customer,
valid_if_pending=valid_if_pending, valid_if_pending=valid_if_pending
api_meta=api_meta,
) )
try: try:
@@ -2044,7 +2042,7 @@ class OrderChangeManager:
# This also prevents accidental removal through the UI because a hidden product will no longer # This also prevents accidental removal through the UI because a hidden product will no longer
# be part of the input. # be part of the input.
(a.variation and a.variation.unavailability_reason(has_voucher=True, subevent=a.subevent)) (a.variation and a.variation.unavailability_reason(has_voucher=True, subevent=a.subevent))
or (a.variation and not a.variation.all_sales_channels and not a.variation.limit_sales_channels.contains(self.order.sales_channel)) or (a.variation and self.order.sales_channel not in a.variation.sales_channels)
or a.item.unavailability_reason(has_voucher=True, subevent=a.subevent) or a.item.unavailability_reason(has_voucher=True, subevent=a.subevent)
or ( or (
not item.all_sales_channels and not item.all_sales_channels and
@@ -2875,13 +2873,12 @@ class OrderChangeManager:
@app.task(base=ProfiledEventTask, bind=True, max_retries=5, default_retry_delay=1, throws=(OrderError,)) @app.task(base=ProfiledEventTask, bind=True, max_retries=5, default_retry_delay=1, throws=(OrderError,))
def perform_order(self, event: Event, payments: List[dict], positions: List[str], def perform_order(self, event: Event, payments: List[dict], positions: List[str],
email: str=None, locale: str=None, address: int=None, meta_info: dict=None, email: str=None, locale: str=None, address: int=None, meta_info: dict=None,
sales_channel: str='web', shown_total=None, customer=None, override_now_dt: datetime=None, sales_channel: str='web', shown_total=None, customer=None, override_now_dt: datetime=None):
api_meta: dict=None):
with language(locale), time_machine_now_assigned(override_now_dt): with language(locale), time_machine_now_assigned(override_now_dt):
try: try:
try: try:
return _perform_order(event, payments, positions, email, locale, address, meta_info, return _perform_order(event, payments, positions, email, locale, address, meta_info,
sales_channel, shown_total, customer, api_meta) sales_channel, shown_total, customer)
except LockTimeoutException: except LockTimeoutException:
self.retry() self.retry()
except (MaxRetriesExceededError, LockTimeoutException): except (MaxRetriesExceededError, LockTimeoutException):
@@ -3152,7 +3149,7 @@ def signal_listener_issue_memberships(sender: Event, order: Order, **kwargs):
if order.status != Order.STATUS_PAID or not order.customer: if order.status != Order.STATUS_PAID or not order.customer:
return return
for p in order.positions.all(): for p in order.positions.all():
if p.item.grant_membership_type_id and not p.granted_memberships.exists(): if p.item.grant_membership_type_id:
create_membership(order.customer, p) create_membership(order.customer, p)
-1
View File
@@ -105,7 +105,6 @@ def preview(event: int, provider: str):
order = event.orders.create(status=Order.STATUS_PENDING, datetime=now(), order = event.orders.create(status=Order.STATUS_PENDING, datetime=now(),
email='sample@pretix.eu', email='sample@pretix.eu',
locale=event.settings.locale, locale=event.settings.locale,
sales_channel=event.organizer.sales_channels.get(identifier="web"),
expires=now(), code="PREVIEW1234", total=119) expires=now(), code="PREVIEW1234", total=119)
scheme = PERSON_NAME_SCHEMES[event.settings.name_scheme] scheme = PERSON_NAME_SCHEMES[event.settings.name_scheme]
+2 -19
View File
@@ -1295,8 +1295,7 @@ DEFAULTS = {
'form_kwargs': dict( 'form_kwargs': dict(
label=_("Show event times and dates on the ticket shop"), label=_("Show event times and dates on the ticket shop"),
help_text=_("If disabled, no date or time will be shown on the ticket shop's front page. This settings " help_text=_("If disabled, no date or time will be shown on the ticket shop's front page. This settings "
"also affects a few other locations, however it should not be expected that the date of the " "does however not affect the display in other locations."),
"event is shown nowhere to users."),
) )
}, },
'show_date_to': { 'show_date_to': {
@@ -1479,10 +1478,6 @@ DEFAULTS = {
min_value=1, min_value=1,
required=True, required=True,
widget=forms.NumberInput(), widget=forms.NumberInput(),
help_text=_('With an increased limit, a customer may request more than one ticket for a specific product '
'using the same, unique email address. However, regardless of this setting, they will need to '
'fill the waiting list form multiple times if they want more than one ticket, as every entry only '
'grants one single ticket at a time.'),
) )
}, },
'show_checkin_number_user': { 'show_checkin_number_user': {
@@ -3364,9 +3359,7 @@ Your {organizer} team""")) # noqa: W291
}, },
'seating_allow_blocked_seats_for_channel': { 'seating_allow_blocked_seats_for_channel': {
'default': [], 'default': [],
'type': list, 'type': list
'serializer_class': serializers.ListField,
'serializer_kwargs': lambda: dict(child=serializers.CharField()),
}, },
'seating_distance_within_row': { 'seating_distance_within_row': {
'default': 'False', 'default': 'False',
@@ -3804,16 +3797,6 @@ def validate_event_settings(event, settings_dict):
'payment_term_last': _('The last payment date cannot be before the end of presale.') 'payment_term_last': _('The last payment date cannot be before the end of presale.')
}) })
if settings_dict.get('seating_allow_blocked_seats_for_channel'):
allowed_channels = set(event.organizer.sales_channels.values_list("identifier", flat=True))
for channel in settings_dict['seating_allow_blocked_seats_for_channel']:
if channel not in allowed_channels:
raise ValidationError({
'seating_allow_blocked_seats_for_channel': _('The value "{identifier}" is not a valid sales channel.').format(
identifier=channel
)
})
if isinstance(event, Event): if isinstance(event, Event):
validate_event_settings.send(sender=event, settings_dict=settings_dict) validate_event_settings.send(sender=event, settings_dict=settings_dict)
+2 -13
View File
@@ -30,9 +30,7 @@ from celery import states
from celery.result import AsyncResult from celery.result import AsyncResult
from django.conf import settings from django.conf import settings
from django.contrib import messages from django.contrib import messages
from django.core.exceptions import ( from django.core.exceptions import PermissionDenied, ValidationError
BadRequest, PermissionDenied, ValidationError,
)
from django.core.files.uploadedfile import UploadedFile from django.core.files.uploadedfile import UploadedFile
from django.db import transaction from django.db import transaction
from django.http import HttpResponse, JsonResponse, QueryDict from django.http import HttpResponse, JsonResponse, QueryDict
@@ -133,8 +131,6 @@ class AsyncMixin:
return data return data
def get_result(self, request): def get_result(self, request):
if not request.GET.get('async_id'):
raise BadRequest("No async_id given")
res = AsyncResult(request.GET.get('async_id')) res = AsyncResult(request.GET.get('async_id'))
if 'ajax' in self.request.GET: if 'ajax' in self.request.GET:
return JsonResponse(self._return_ajax_result(res, timeout=0.25)) return JsonResponse(self._return_ajax_result(res, timeout=0.25))
@@ -144,12 +140,7 @@ class AsyncMixin:
return self.success(res.info) return self.success(res.info)
else: else:
return self.error(res.info) return self.error(res.info)
state, info = res.state, res.info return render(request, 'pretixpresale/waiting.html')
return render(request, 'pretixpresale/waiting.html', {
'started': state in ('PROGRESS', 'STARTED'),
'percentage': info.get('value', 0) if isinstance(info, dict) else 0,
'steps': info.get('steps', []) if isinstance(info, dict) else None,
})
def success(self, value): def success(self, value):
smes = self.get_success_message(value) smes = self.get_success_message(value)
@@ -217,8 +208,6 @@ class AsyncAction(AsyncMixin):
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
if 'async_id' in request.GET and settings.HAS_CELERY: if 'async_id' in request.GET and settings.HAS_CELERY:
if not request.GET.get('async_id'):
raise BadRequest("No async_id given")
return self.get_result(request) return self.get_result(request)
return self.http_method_not_allowed(request) return self.http_method_not_allowed(request)
+2 -2
View File
@@ -1143,12 +1143,12 @@ class MailSettingsForm(FormPlaceholderMixin, SettingsForm):
widget=I18nTextInput, widget=I18nTextInput,
) )
mail_subject_order_incomplete_payment = I18nFormField( mail_subject_order_incomplete_payment = I18nFormField(
label=_("Subject (if an incomplete payment was received)"), label=_("Subject"),
required=False, required=False,
widget=I18nTextInput, widget=I18nTextInput,
) )
mail_text_order_incomplete_payment = I18nFormField( mail_text_order_incomplete_payment = I18nFormField(
label=_("Text (if an incomplete payment was received)"), label=_("Text"),
required=False, required=False,
widget=I18nMarkdownTextarea, widget=I18nMarkdownTextarea,
help_text=_("This email only applies to payment methods that can receive incomplete payments, " help_text=_("This email only applies to payment methods that can receive incomplete payments, "
+11 -89
View File
@@ -48,7 +48,6 @@ from django.utils.formats import date_format, localize
from django.utils.functional import cached_property from django.utils.functional import cached_property
from django.utils.timezone import get_current_timezone, make_aware, now from django.utils.timezone import get_current_timezone, make_aware, now
from django.utils.translation import gettext, gettext_lazy as _, pgettext_lazy from django.utils.translation import gettext, gettext_lazy as _, pgettext_lazy
from django_countries.fields import CountryField
from django_scopes.forms import SafeModelChoiceField from django_scopes.forms import SafeModelChoiceField
from pretix.base.forms.widgets import ( from pretix.base.forms.widgets import (
@@ -61,7 +60,6 @@ from pretix.base.models import (
SubEvent, SubEventMetaValue, Team, TeamAPIToken, TeamInvite, Voucher, SubEvent, SubEventMetaValue, Team, TeamAPIToken, TeamInvite, Voucher,
) )
from pretix.base.signals import register_payment_providers from pretix.base.signals import register_payment_providers
from pretix.control.forms import SplitDateTimeField
from pretix.control.forms.widgets import Select2, Select2ItemVarQuota from pretix.control.forms.widgets import Select2, Select2ItemVarQuota
from pretix.control.signals import order_search_filter_q from pretix.control.signals import order_search_filter_q
from pretix.helpers.countries import CachedCountries from pretix.helpers.countries import CachedCountries
@@ -69,7 +67,7 @@ from pretix.helpers.database import (
get_deterministic_ordering, rolledback_transaction, get_deterministic_ordering, rolledback_transaction,
) )
from pretix.helpers.dicts import move_to_end from pretix.helpers.dicts import move_to_end
from pretix.helpers.i18n import get_format_without_seconds, i18ncomp from pretix.helpers.i18n import i18ncomp
PAYMENT_PROVIDERS = [] PAYMENT_PROVIDERS = []
@@ -689,71 +687,11 @@ class EventOrderExpertFilterForm(EventOrderFilterForm):
) )
self.fields['quota'].widget.choices = self.fields['quota'].choices self.fields['quota'].widget.choices = self.fields['quota'].choices
for q in self.event.questions.all(): for q in self.event.questions.all():
kwargs = { self.fields['question_{}'.format(q.pk)] = forms.CharField(
"label": q.question, label=q.question,
"required": False, required=False,
} help_text=_('Exact matches only')
fname = 'question_{}'.format(q.pk) )
if q.type == Question.TYPE_NUMBER:
self.fields[fname] = forms.DecimalField(
help_text=_('Exact matches only'),
**kwargs,
)
elif q.type == Question.TYPE_BOOLEAN:
self.fields[fname] = forms.ChoiceField(
choices=(
("", ""),
("True", _("Yes")),
("False", _("No")),
),
**kwargs,
)
elif q.type in (Question.TYPE_CHOICE, Question.TYPE_CHOICE_MULTIPLE):
self.fields[fname] = forms.ModelChoiceField(
queryset=q.options,
widget=forms.Select,
to_field_name='identifier',
empty_label='',
**kwargs,
)
elif q.type == Question.TYPE_COUNTRYCODE:
self.fields[fname] = CountryField(
countries=CachedCountries,
blank=True, null=True, blank_label=' ',
).formfield(
**kwargs,
widget=forms.Select,
empty_label=' ',
)
elif q.type == Question.TYPE_DATE:
self.fields[fname] = forms.DateField(
widget=DatePickerWidget(),
help_text=_('Exact matches only'),
**kwargs,
)
elif q.type == Question.TYPE_TIME:
self.fields[fname] = forms.TimeField(
widget=TimePickerWidget(time_format=get_format_without_seconds('TIME_INPUT_FORMATS')),
help_text=_('Exact matches only'),
**kwargs,
)
elif q.type == Question.TYPE_DATETIME:
self.fields[fname] = SplitDateTimeField(
widget=SplitDateTimePickerWidget(
time_format=get_format_without_seconds('TIME_INPUT_FORMATS'),
min_date=q.valid_datetime_min,
max_date=q.valid_datetime_max
),
help_text=_('Exact matches only'),
**kwargs,
)
elif q.type == Question.TYPE_FILE:
continue
else:
self.fields[fname] = forms.CharField(
help_text=_('Exact matches only'),
**kwargs,
)
def filter_qs(self, qs): def filter_qs(self, qs):
fdata = self.cleaned_data fdata = self.cleaned_data
@@ -849,24 +787,11 @@ class EventOrderExpertFilterForm(EventOrderFilterForm):
).distinct() ).distinct()
for q in self.event.questions.all(): for q in self.event.questions.all():
if fdata.get(f'question_{q.pk}'): if fdata.get(f'question_{q.pk}'):
if q.type == Question.TYPE_BOOLEAN: answers = QuestionAnswer.objects.filter(
answers = QuestionAnswer.objects.filter( question_id=q.pk,
question_id=q.pk, orderposition__order_id=OuterRef('pk'),
orderposition__order_id=OuterRef('pk'), answer__iexact=fdata.get(f'question_{q.pk}')
answer__exact=fdata.get(f'question_{q.pk}') )
)
elif q.type in (Question.TYPE_CHOICE, Question.TYPE_CHOICE_MULTIPLE):
answers = QuestionAnswer.objects.filter(
question_id=q.pk,
orderposition__order_id=OuterRef('pk'),
options=fdata.get(f'question_{q.pk}')
)
else:
answers = QuestionAnswer.objects.filter(
question_id=q.pk,
orderposition__order_id=OuterRef('pk'),
answer__iexact=fdata.get(f'question_{q.pk}')
)
qs = qs.annotate(**{f'q_{q.pk}': Exists(answers)}).filter(**{f'q_{q.pk}': True}) qs = qs.annotate(**{f'q_{q.pk}': Exists(answers)}).filter(**{f'q_{q.pk}': True})
return qs return qs
@@ -2652,9 +2577,6 @@ class DeviceFilterForm(FilterForm):
if fdata.get('gate'): if fdata.get('gate'):
qs = qs.filter(gate=fdata['gate']) qs = qs.filter(gate=fdata['gate'])
if fdata.get('software_brand'):
qs = qs.filter(software_brand=fdata['software_brand'])
if fdata.get('state') == 'active': if fdata.get('state') == 'active':
qs = qs.filter(revoked=False) qs = qs.filter(revoked=False)
elif fdata.get('state') == 'revoked': elif fdata.get('state') == 'revoked':
+12 -10
View File
@@ -40,6 +40,7 @@ from urllib.parse import urlencode
from django import forms from django import forms
from django.conf import settings from django.conf import settings
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.core.files.uploadedfile import UploadedFile
from django.db.models import Max from django.db.models import Max
from django.forms.formsets import DELETION_FIELD_NAME from django.forms.formsets import DELETION_FIELD_NAME
from django.urls import reverse from django.urls import reverse
@@ -62,9 +63,9 @@ from pretix.base.models import (
from pretix.base.models.items import ItemAddOn, ItemBundle, ItemMetaValue from pretix.base.models.items import ItemAddOn, ItemBundle, ItemMetaValue
from pretix.base.signals import item_copy_data from pretix.base.signals import item_copy_data
from pretix.control.forms import ( from pretix.control.forms import (
ButtonGroupRadioSelect, ExtFileField, ItemMultipleChoiceField, ButtonGroupRadioSelect, ItemMultipleChoiceField,
SalesChannelCheckboxSelectMultiple, SplitDateTimeField, SalesChannelCheckboxSelectMultiple, SizeValidationMixin,
SplitDateTimePickerWidget, SplitDateTimeField, SplitDateTimePickerWidget,
) )
from pretix.control.forms.widgets import Select2, Select2ItemVarMulti from pretix.control.forms.widgets import Select2, Select2ItemVarMulti
from pretix.helpers.models import modelcopy from pretix.helpers.models import modelcopy
@@ -561,13 +562,6 @@ class TicketNullBooleanSelect(forms.NullBooleanSelect):
class ItemUpdateForm(I18nModelForm): class ItemUpdateForm(I18nModelForm):
picture = ExtFileField(
label=_('Product picture'),
ext_whitelist=settings.FILE_UPLOAD_EXTENSIONS_IMAGE,
max_size=settings.FILE_UPLOAD_MAX_SIZE_IMAGE,
required=False,
)
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
self.fields['tax_rule'].queryset = self.instance.event.tax_rules.all() self.fields['tax_rule'].queryset = self.instance.event.tax_rules.all()
@@ -757,6 +751,14 @@ class ItemUpdateForm(I18nModelForm):
return d return d
def clean_picture(self):
value = self.cleaned_data.get('picture')
if isinstance(value, UploadedFile) and value.size > settings.FILE_UPLOAD_MAX_SIZE_IMAGE:
raise forms.ValidationError(_("Please do not upload files larger than {size}!").format(
size=SizeValidationMixin._sizeof_fmt(settings.FILE_UPLOAD_MAX_SIZE_IMAGE)
))
return value
class Meta: class Meta:
model = Item model = Item
localized_fields = '__all__' localized_fields = '__all__'
+2 -9
View File
@@ -58,8 +58,7 @@ from pretix.api.models import WebHook
from pretix.api.webhooks import get_all_webhook_events from pretix.api.webhooks import get_all_webhook_events
from pretix.base.customersso.oidc import oidc_validate_and_complete_config from pretix.base.customersso.oidc import oidc_validate_and_complete_config
from pretix.base.forms import ( from pretix.base.forms import (
SECRET_REDACTED, I18nMarkdownTextarea, I18nModelForm, PlaceholderValidator, I18nMarkdownTextarea, I18nModelForm, PlaceholderValidator, SettingsForm,
SecretKeySettingsField, SettingsForm,
) )
from pretix.base.forms.questions import ( from pretix.base.forms.questions import (
NamePartsFormField, WrappedPhoneNumberPrefixWidget, get_country_by_locale, NamePartsFormField, WrappedPhoneNumberPrefixWidget, get_country_by_locale,
@@ -959,7 +958,7 @@ class SSOProviderForm(I18nModelForm):
label=pgettext_lazy('sso_oidc', 'Client ID'), label=pgettext_lazy('sso_oidc', 'Client ID'),
required=False, required=False,
) )
config_oidc_client_secret = SecretKeySettingsField( config_oidc_client_secret = forms.CharField(
label=pgettext_lazy('sso_oidc', 'Client secret'), label=pgettext_lazy('sso_oidc', 'Client secret'),
required=False, required=False,
) )
@@ -1016,13 +1015,7 @@ class SSOProviderForm(I18nModelForm):
if self.instance and self.instance.method == method: if self.instance and self.instance.method == method:
f.initial = self.instance.configuration.get(suffix) f.initial = self.instance.configuration.get(suffix)
def _unmask_secret_fields(self):
for k, v in self.cleaned_data.items():
if isinstance(self.fields.get(k), SecretKeySettingsField) and self.cleaned_data.get(k) == SECRET_REDACTED:
self.cleaned_data[k] = self.fields[k].initial
def clean(self): def clean(self):
self._unmask_secret_fields()
data = self.cleaned_data data = self.cleaned_data
if not data.get("method"): if not data.get("method"):
return data return data
-8
View File
@@ -98,14 +98,6 @@ class ControlFieldRenderer(FieldRenderer):
attrs = '' attrs = ''
return '<div class="{klass}"{attrs}>{html}</div>'.format(klass=self.get_form_group_class(), html=html, attrs=attrs) return '<div class="{klass}"{attrs}>{html}</div>'.format(klass=self.get_form_group_class(), html=html, attrs=attrs)
def wrap_widget(self, html):
if isinstance(self.widget, CheckboxInput):
css_class = "checkbox"
if self.field.field.disabled:
css_class += " disabled"
html = f'<div class="{css_class}">{html}</div>'
return html
class ControlFieldWithVisibilityRenderer(ControlFieldRenderer): class ControlFieldWithVisibilityRenderer(ControlFieldRenderer):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
+2 -9
View File
@@ -49,7 +49,6 @@ from pretix.base.forms import (
I18nModelForm, MarkdownTextarea, PlaceholderValidator, I18nModelForm, MarkdownTextarea, PlaceholderValidator,
) )
from pretix.base.forms.widgets import format_placeholders_help_text from pretix.base.forms.widgets import format_placeholders_help_text
from pretix.base.i18n import language
from pretix.base.models import Item, Voucher from pretix.base.models import Item, Voucher
from pretix.control.forms import SplitDateTimeField, SplitDateTimePickerWidget from pretix.control.forms import SplitDateTimeField, SplitDateTimePickerWidget
from pretix.control.forms.widgets import Select2, Select2ItemVarQuota from pretix.control.forms.widgets import Select2, Select2ItemVarQuota
@@ -290,9 +289,8 @@ class VoucherBulkForm(VoucherForm):
) )
}), }),
required=False, required=False,
help_text=_('You can either supply a list of email addresses with one email address per line, or the contents ' help_text=_('You can either supply a list of email addresses with one email address per line, or a CSV file with a title column '
'of a CSV file with a title column and one or more of the columns "email", "number", "name", ' 'and one or more of the columns "email", "number", "name", or "tag".')
'or "tag".')
) )
Recipient = namedtuple('Recipient', 'email number name tag') Recipient = namedtuple('Recipient', 'email number name tag')
@@ -334,11 +332,6 @@ class VoucherBulkForm(VoucherForm):
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
self._set_field_placeholders('send_subject', ['event', 'name']) self._set_field_placeholders('send_subject', ['event', 'name'])
self._set_field_placeholders('send_message', ['event', 'voucher_list', 'name']) self._set_field_placeholders('send_message', ['event', 'voucher_list', 'name'])
with language(self.instance.event.settings.locale, self.instance.event.settings.region):
for f in ("send_subject", "send_message"):
self.fields[f].initial = str(self.fields[f].initial)
if 'seat' in self.fields: if 'seat' in self.fields:
self.fields['seats'] = forms.CharField( self.fields['seats'] = forms.CharField(
label=_("Specific seat IDs"), label=_("Specific seat IDs"),
@@ -372,19 +372,6 @@
</div> </div>
{% bootstrap_field sform.waiting_list_enabled layout="control" %} {% bootstrap_field sform.waiting_list_enabled layout="control" %}
{% bootstrap_field sform.waiting_list_auto layout="control" %} {% bootstrap_field sform.waiting_list_auto layout="control" %}
<div class="form-group">
<label class="control-label col-md-3">
{% trans "Waiting customers" %}
</label>
<div class="col-md-9 static-form-row">
<p>
<a href="{% url "control:event.orders.waitinglist" event=request.event.slug organizer=request.organizer.slug %}#tab-0-1-open"
target="_blank">
{% trans "Manage waiting list" %}
</a>
</p>
</div>
</div>
{% bootstrap_field sform.waiting_list_hours layout="control" %} {% bootstrap_field sform.waiting_list_hours layout="control" %}
{% bootstrap_field sform.waiting_list_auto_disable layout="control" %} {% bootstrap_field sform.waiting_list_auto_disable layout="control" %}
{% bootstrap_field sform.waiting_list_names_asked_required layout="control" %} {% bootstrap_field sform.waiting_list_names_asked_required layout="control" %}
@@ -41,7 +41,7 @@
{% bootstrap_field form.eu_reverse_charge layout="control" %} {% bootstrap_field form.eu_reverse_charge layout="control" %}
{% bootstrap_field form.home_country layout="control" %} {% bootstrap_field form.home_country layout="control" %}
{% bootstrap_field form.keep_gross_if_rate_changes layout="control" %} {% bootstrap_field form.keep_gross_if_rate_changes layout="control" %}
<h3>{% trans "Custom rules" %}</h3> <h3>{% trans "Custom taxation rules" %}</h3>
<div class="alert alert-warning"> <div class="alert alert-warning">
{% blocktrans trimmed %} {% blocktrans trimmed %}
These settings are intended for professional users with very specific taxation situations. These settings are intended for professional users with very specific taxation situations.
@@ -133,18 +133,12 @@
{% endif %} {% endif %}
{{ i.default_price|money:request.event.currency }} {{ i.default_price|money:request.event.currency }}
{% if i.original_price %}<strike class="text-muted">{{ i.original_price|money:request.event.currency }}</strike>{% endif %} {% if i.original_price %}<strike class="text-muted">{{ i.original_price|money:request.event.currency }}</strike>{% endif %}
{% if i.tax_rule %} {% if i.tax_rule and i.default_price %}
<br/> <br/>
<small class="text-muted"> <small class="text-muted">
{% if not i.tax_rule.price_includes_tax %} {% blocktrans trimmed with rate=i.tax_rule.rate|floatformat:-2 taxname=i.tax_rule.name|default:s_taxes %}
{% blocktrans trimmed with rate=i.tax_rule.rate|floatformat:-2 taxname=i.tax_rule.name %} incl. {{ rate }}% {{ taxname }}
<strong>plus</strong> {{ rate }}% {{ taxname }} {% endblocktrans %}
{% endblocktrans %}
{% else %}
{% blocktrans trimmed with rate=i.tax_rule.rate|floatformat:-2 taxname=i.tax_rule.name|default:s_taxes %}
incl. {{ rate }}% {{ taxname }}
{% endblocktrans %}
{% endif %}
</small> </small>
{% endif %} {% endif %}
</td> </td>
@@ -151,12 +151,6 @@
</div> </div>
<div class="col-sm-4"> <div class="col-sm-4">
{% bootstrap_field position.form.itemvar layout='inline' %} {% bootstrap_field position.form.itemvar layout='inline' %}
{% if position.granted_memberships.all %}
<span class="text-muted">
<span class="fa fa-warning text-warning" aria-hidden="true"></span>
{% trans "The sale of this position created a membership. Changing the product here will not affect the membership. Memberships can be managed in the customer account." %}
</span>
{% endif %}
</div> </div>
</div> </div>
@@ -260,12 +254,6 @@
{% trans "" %} {% trans "" %}
</div> </div>
{% bootstrap_field position.form.valid_until layout='inline' %} {% bootstrap_field position.form.valid_until layout='inline' %}
{% if position.granted_memberships.all %}
<span class="text-muted">
<span class="fa fa-warning text-warning" aria-hidden="true"></span>
{% trans "The sale of this position created a membership. Changing the validity of the ticket here will not affect the membership. Memberships can be managed in the customer account." %}
</span>
{% endif %}
</div> </div>
</div> </div>
@@ -102,24 +102,16 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for t in tokens %} {% for t in team.active_tokens %}
<tr> <tr>
<td {% if not t.active %}class="text-muted"{% endif %}> <td>
{% if not t.active %}
<del>
{% endif %}
{{ t.name }} {{ t.name }}
{% if not t.active %}
</del>
{% endif %}
</td> </td>
<td class="text-right flip"> <td class="text-right flip">
{% if t.active %} <button type="submit" name="remove-token" value="{{ t.id }}"
<button type="submit" name="remove-token" value="{{ t.id }}" class="btn btn-danger btn-sm btn-block">
class="btn btn-danger btn-sm btn-block"> <i class="fa fa-times"></i> {% trans "Remove" %}
<i class="fa fa-times"></i> {% trans "Remove" %} </button>
</button>
{% endif %}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
@@ -177,7 +177,7 @@
{% if name %} {% if name %}
<div class="row control-group pdf-info"> <div class="row control-group pdf-info">
<div class="col-sm-12"> <div class="col-sm-12">
<label for="pdf-info-name">{% trans "Layout name" %}</label><br> <label>{% trans "Layout name" %}</label><br>
<input type="text" id="pdf-info-name" class="input-block-level form-control" name="name" value="{{ name }}"> <input type="text" id="pdf-info-name" class="input-block-level form-control" name="name" value="{{ name }}">
</div> </div>
</div> </div>
@@ -185,11 +185,11 @@
<div class="row control-group pdf-info"> <div class="row control-group pdf-info">
<hr/> <hr/>
<div class="col-sm-6"> <div class="col-sm-6">
<label for="pdf-info-width">{% trans "Width (mm)" %}</label><br> <label>{% trans "Width (mm)" %}</label><br>
<input type="number" id="pdf-info-width" class="input-block-level form-control"> <input type="number" id="pdf-info-width" class="input-block-level form-control">
</div> </div>
<div class="col-sm-6"> <div class="col-sm-6">
<label for="pdf-info-height">{% trans "Height (mm)" %}</label><br> <label>{% trans "Height (mm)" %}</label><br>
<input type="number" id="pdf-info-height" class="input-block-level form-control"> <input type="number" id="pdf-info-height" class="input-block-level form-control">
</div> </div>
</div> </div>
@@ -227,7 +227,7 @@
<div class="row control-group pdf-info"> <div class="row control-group pdf-info">
<hr/> <hr/>
<div class="col-sm-12"> <div class="col-sm-12">
<label for="pdf-info-locale">{% trans "Preferred language" %}</label><br> <label>{% trans "Preferred language" %}</label><br>
<select class="form-control" id="pdf-info-locale"> <select class="form-control" id="pdf-info-locale">
<option value="">{% trans "Order locale" %}</option> <option value="">{% trans "Order locale" %}</option>
{% for l in locales %} {% for l in locales %}
@@ -238,7 +238,7 @@
</div> </div>
<div class="row control-group poweredby"> <div class="row control-group poweredby">
<div class="col-sm-12"> <div class="col-sm-12">
<label for="toolbox-poweredby-style">{% trans "Style" %}</label><br> <label>{% trans "Style" %}</label><br>
<select class="input-block-level form-control" id="toolbox-poweredby-style"> <select class="input-block-level form-control" id="toolbox-poweredby-style">
<option value="dark">{% trans "Dark" %}</option> <option value="dark">{% trans "Dark" %}</option>
<option value="white">{% trans "Light" %}</option> <option value="white">{% trans "Light" %}</option>
@@ -247,7 +247,7 @@
</div> </div>
<div class="row control-group imagecontent"> <div class="row control-group imagecontent">
<div class="col-sm-12"> <div class="col-sm-12">
<label for="toolbox-imagecontent">{% trans "Image content" %}</label><br> <label>{% trans "Image content" %}</label><br>
<select class="input-block-level form-control" id="toolbox-imagecontent"> <select class="input-block-level form-control" id="toolbox-imagecontent">
<option value="">{% trans "Empty" %}</option> <option value="">{% trans "Empty" %}</option>
{% for varname, var in images.items %} {% for varname, var in images.items %}
@@ -258,7 +258,7 @@
</div> </div>
<div class="row control-group text textcontent"> <div class="row control-group text textcontent">
<div class="col-sm-12"> <div class="col-sm-12">
<label for="toolbox-content">{% trans "Content" %}</label><br> <label>{% trans "Content" %}</label><br>
<select class="input-block-level form-control" id="toolbox-content"> <select class="input-block-level form-control" id="toolbox-content">
{% for varname, var in variables.items %} {% for varname, var in variables.items %}
{% if not var.hidden %} {% if not var.hidden %}
@@ -293,31 +293,31 @@
<div class="row control-group position"> <div class="row control-group position">
<hr/> <hr/>
<div class="col-sm-6"> <div class="col-sm-6">
<label for="toolbox-position-x">{% trans "x (mm)" %}</label><br> <label>{% trans "x (mm)" %}</label><br>
<input type="number" value="13" class="input-block-level form-control" step="0.01" <input type="number" value="13" class="input-block-level form-control" step="0.01"
id="toolbox-position-x"> id="toolbox-position-x">
</div> </div>
<div class="col-sm-6"> <div class="col-sm-6">
<label for="toolbox-position-y">{% trans "y (mm)" %}</label><br> <label>{% trans "y (mm)" %}</label><br>
<input type="number" value="13" class="input-block-level form-control" step="0.01" <input type="number" value="13" class="input-block-level form-control" step="0.01"
id="toolbox-position-y"> id="toolbox-position-y">
</div> </div>
</div> </div>
<div class="row control-group rectsize"> <div class="row control-group rectsize">
<div class="col-sm-6"> <div class="col-sm-6">
<label for="toolbox-width">{% trans "Width (mm)" %}</label><br> <label>{% trans "Width (mm)" %}</label><br>
<input type="number" value="13" class="input-block-level form-control" step="0.01" <input type="number" value="13" class="input-block-level form-control" step="0.01"
id="toolbox-width"> id="toolbox-width">
</div> </div>
<div class="col-sm-6"> <div class="col-sm-6">
<label for="toolbox-height">{% trans "Height (mm)" %}</label><br> <label>{% trans "Height (mm)" %}</label><br>
<input type="number" value="13" class="input-block-level form-control" step="0.01" <input type="number" value="13" class="input-block-level form-control" step="0.01"
id="toolbox-height"> id="toolbox-height">
</div> </div>
</div> </div>
<div class="row control-group squaresize poweredby"> <div class="row control-group squaresize poweredby">
<div class="col-sm-12"> <div class="col-sm-12">
<label for="toolbox-squaresize">{% trans "Size (mm)" %}</label><br> <label>{% trans "Size (mm)" %}</label><br>
<input type="number" value="13" class="input-block-level form-control" step="0.01" <input type="number" value="13" class="input-block-level form-control" step="0.01"
id="toolbox-squaresize"> id="toolbox-squaresize">
</div> </div>
@@ -335,13 +335,13 @@
</div> </div>
</div> </div>
<div class="row control-group text"> <div class="row control-group text">
<div class="col-sm-6 textarea"> <div class="col-sm-6">
<label for="toolbox-textwidth">{% trans "Width (mm)" %}</label><br> <label>{% trans "Width (mm)" %}</label><br>
<input type="number" value="13" class="input-block-level form-control" step="0.01" <input type="number" value="13" class="input-block-level form-control" step="0.01"
id="toolbox-textwidth"> id="toolbox-textwidth">
</div> </div>
<div class="col-sm-6"> <div class="col-sm-6">
<label for="toolbox-textrotation">{% trans "Rotation (°)" %}</label><br> <label>{% trans "Rotation (°)" %}</label><br>
<input type="number" value="0" class="input-block-level form-control" step="0.1" <input type="number" value="0" class="input-block-level form-control" step="0.1"
id="toolbox-textrotation"> id="toolbox-textrotation">
</div> </div>
@@ -349,7 +349,7 @@
<div class="row control-group text"> <div class="row control-group text">
<hr/> <hr/>
<div class="col-sm-12"> <div class="col-sm-12">
<label for="toolbox-fontfamily">{% trans "Font" %}</label><br> <label>{% trans "Font" %}</label><br>
<select class="input-block-level form-control" id="toolbox-fontfamily"> <select class="input-block-level form-control" id="toolbox-fontfamily">
<option>Open Sans</option> <option>Open Sans</option>
{% for family in fonts.keys %} {% for family in fonts.keys %}
@@ -360,50 +360,43 @@
</div> </div>
<div class="row control-group text"> <div class="row control-group text">
<div class="col-sm-6"> <div class="col-sm-6">
<label for="toolbox-fontsize">{% trans "Font size (pt)" %}</label><br> <label>{% trans "Font size (pt)" %}</label><br>
<input type="number" value="13" class="input-block-level form-control" step="0.1" <input type="number" value="13" class="input-block-level form-control" step="0.1"
id="toolbox-fontsize"> id="toolbox-fontsize">
</div> </div>
<div class="col-sm-6"> <div class="col-sm-6">
<label for="toolbox-lineheight">{% trans "Line height" %}</label><br> <label>{% trans "Line height" %}</label><br>
<input type="number" value="1" class="input-block-level form-control" step="0.1" <input type="number" value="1" class="input-block-level form-control" step="0.1"
id="toolbox-lineheight"> id="toolbox-lineheight">
</div> </div>
</div> </div>
<div class="row control-group text"> <div class="row control-group text">
<div class="col-sm-6"> <div class="col-sm-6">
<label for="toolbox-col">{% trans "Text color" %}</label><br> <label>{% trans "Text color" %}</label><br>
<div class="input-group"> <input type="text" value="#000000" class="input-block-level form-control colorpickerfield"
<input type="text" value="#000000" class="input-block-level form-control colorpickerfield" id="toolbox-col">
id="toolbox-col">
<span class="input-group-addon contrast-icon">
</span>
</div>
</div> </div>
<div class="col-sm-6"> <div class="col-sm-6">
<label>&nbsp;</label><br> <label>&nbsp;</label><br>
<div class="btn-group btn-group-justified" role="group"> <div class="btn-group btn-group-justified" role="group">
<div class="btn-group text" role="group"> <div class="btn-group" role="group">
<button type="button" class="btn btn-default toggling" data-action="bold"> <button type="button" class="btn btn-default toggling" data-action="bold">
<span class="fa fa-bold"></span> <span class="fa fa-bold"></span>
</button> </button>
</div> </div>
<div class="btn-group text" role="group"> <div class="btn-group" role="group">
<button type="button" class="btn btn-default toggling" data-action="italic"> <button type="button" class="btn btn-default toggling" data-action="italic">
<span class="fa fa-italic"></span> <span class="fa fa-italic"></span>
</button> </button>
</div> </div>
<div class="btn-group textarea" role="group"> <div class="btn-group" role="group">
<button type="button" class="btn btn-default toggling" data-action="downward" <button type="button" class="btn btn-default toggling" data-action="downward"
data-toggle="tooltip" title="{% trans "Flow multiple lines downward from specified position" %}"> data-toggle="tooltip" title="{% trans "Flow multiple lines downward from specified position" %}">
<span class="fa fa-caret-square-o-down"></span> <span class="fa fa-caret-square-o-down"></span>
</button> </button>
</div> </div>
</div> </div>
</div> <label>&nbsp;</label><br>
</div>
<div class="row control-group text">
<div class="col-sm-6">
<div class="btn-group btn-group-justified" id="toolbox-align"> <div class="btn-group btn-group-justified" id="toolbox-align">
<div class="btn-group" role="group"> <div class="btn-group" role="group">
<button type="button" class="btn btn-default option toggling" data-action="left"> <button type="button" class="btn btn-default option toggling" data-action="left">
@@ -422,45 +415,6 @@
</div> </div>
</div> </div>
</div> </div>
<div class="col-sm-6">
<div class="textcontainer">
<div class="btn-group btn-group-justified" id="toolbox-verticalalign">
<div class="btn-group" role="group">
<button type="button" class="btn btn-default option toggling" data-action="top">
<span class="fa fa-toggle-down"></span>
</button>
</div>
<div class="btn-group" role="group">
<button type="button" class="btn btn-default option toggling" data-action="middle">
<span class="fa fa-sort"></span>
</button>
</div>
<div class="btn-group" role="group">
<button type="button" class="btn btn-default option toggling" data-action="bottom">
<span class="fa fa-toggle-up"></span>
</button>
</div>
</div>
</div>
</div>
</div>
<div class="row control-group textcontainer">
<div class="col-sm-6">
<div class="btn-group btn-group-justified">
<div class="btn-group textcontainer" role="group">
<button type="button" class="btn btn-default toggling" data-action="autoresize"
data-toggle="tooltip" title="{% trans "Automatically reduce font size to fit content" %}">
<span class="fa fa-text-height"></span>
</button>
</div>
<div class="btn-group textcontainer" role="group">
<button type="button" class="btn btn-default toggling" data-action="splitlongwords"
data-toggle="tooltip" title="{% trans "Allow long words to be split (preview is not accurate)" %}">
<span class="fa fa-scissors fa-rotate-90"></span>
</button>
</div>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
@@ -469,13 +423,9 @@
{% trans "Add a new object" %} {% trans "Add a new object" %}
</div> </div>
<div class="panel-body add-buttons"> <div class="panel-body add-buttons">
<button class="btn btn-default btn-block" id="editor-add-textcontainer" disabled>
<span class="fa fa-font"></span>
{% trans "Text box" %}
</button>
<button class="btn btn-default btn-block" id="editor-add-text" disabled> <button class="btn btn-default btn-block" id="editor-add-text" disabled>
<span class="fa fa-font"></span> <span class="fa fa-font"></span>
{% trans "Text (deprecated)" %} {% trans "Text" %}
</button> </button>
<button class="btn btn-default btn-block" id="editor-add-qrcode" data-content="secret" disabled> <button class="btn btn-default btn-block" id="editor-add-qrcode" data-content="secret" disabled>
<span class="fa fa-qrcode"></span> <span class="fa fa-qrcode"></span>
@@ -506,6 +456,7 @@
</button> </button>
</div> </div>
</div> </div>
<form method="post" action="" id="preview-form" target="_blank"> <form method="post" action="" id="preview-form" target="_blank">
<div class="form-group submit-group"> <div class="form-group submit-group">
{% csrf_token %} {% csrf_token %}
@@ -521,13 +472,6 @@
</button> </button>
</div> </div>
</form> </form>
<p>&nbsp;</p>
<div class="alert alert-info" id="version-notice">
{% blocktrans trimmed with print_version="2.18" scan_version="1.22" %}
This layout uses new features. If you print from your device, make sure you use pretixPRINT version
{{ print_version }} (or newer) or pretixSCAN Desktop version {{ scan_version }} (or newer).
{% endblocktrans %}
</div>
</div> </div>
</div> </div>
<script type="text/plain" id="schema-url">{% static "schema/pdf-layout.schema.json" %}</script> <script type="text/plain" id="schema-url">{% static "schema/pdf-layout.schema.json" %}</script>
@@ -5,13 +5,7 @@
{% load urlreplace %} {% load urlreplace %}
{% block title %}{% trans "Waiting list" %}{% endblock %} {% block title %}{% trans "Waiting list" %}{% endblock %}
{% block content %} {% block content %}
<h1> <h1>{% trans "Waiting list" %}</h1>
{% trans "Waiting list" %}
<a href="{% url "control:event.settings" event=request.event.slug organizer=request.organizer.slug %}#waiting-list-open" class="btn btn-default">
<span class="fa fa-cog"></span>
{% trans "Settings" %}
</a>
</h1>
{% if not request.event.settings.waiting_list_enabled %} {% if not request.event.settings.waiting_list_enabled %}
<div class="alert alert-danger"> <div class="alert alert-danger">
{% trans "The waiting list is disabled, so if the event is sold out, people cannot add themselves to this list. If you want to enable it, go to the event settings." %} {% trans "The waiting list is disabled, so if the event is sold out, people cannot add themselves to this list. If you want to enable it, go to the event settings." %}
@@ -63,7 +57,7 @@
{% for se in request.event.subevents.all %} {% for se in request.event.subevents.all %}
<option value="{{ se.id }}" <option value="{{ se.id }}"
{% if request.GET.subevent|add:0 == se.id %}selected="selected"{% endif %}> {% if request.GET.subevent|add:0 == se.id %}selected="selected"{% endif %}>
{{ se }} {{ se.name }} {{ se.get_date_range_display }}
</option> </option>
{% endfor %} {% endfor %}
</select> </select>
@@ -125,7 +119,7 @@
{% for se in request.event.subevents.all %} {% for se in request.event.subevents.all %}
<option value="{{ se.id }}" <option value="{{ se.id }}"
{% if request.GET.subevent|add:0 == se.id %}selected="selected"{% endif %}> {% if request.GET.subevent|add:0 == se.id %}selected="selected"{% endif %}>
{{ se }} {{ se.name }} {{ se.get_date_range_display }}
</option> </option>
{% endfor %} {% endfor %}
</select> </select>
@@ -201,7 +195,7 @@
{% endif %} {% endif %}
</td> </td>
{% if request.event.has_subevents %} {% if request.event.has_subevents %}
<td>{{ e.subevent }}</td> <td>{{ e.subevent.name }} {{ e.subevent.get_date_range_display }}</td>
{% endif %} {% endif %}
<td> <td>
{{ e.created|date:"SHORT_DATETIME_FORMAT" }} {{ e.created|date:"SHORT_DATETIME_FORMAT" }}
+5 -7
View File
@@ -62,7 +62,6 @@ from django.http import (
from django.shortcuts import get_object_or_404, redirect from django.shortcuts import get_object_or_404, redirect
from django.urls import reverse from django.urls import reverse
from django.utils.functional import cached_property from django.utils.functional import cached_property
from django.utils.html import escape
from django.utils.http import url_has_allowed_host_and_scheme from django.utils.http import url_has_allowed_host_and_scheme
from django.utils.timezone import now from django.utils.timezone import now
from django.utils.translation import gettext, gettext_lazy as _, gettext_noop from django.utils.translation import gettext, gettext_lazy as _, gettext_noop
@@ -99,7 +98,6 @@ from ...base.i18n import language
from ...base.models.items import ( from ...base.models.items import (
Item, ItemCategory, ItemMetaProperty, Question, Quota, Item, ItemCategory, ItemMetaProperty, Question, Quota,
) )
from ...base.services.mail import prefix_subject
from ...base.settings import LazyI18nStringList from ...base.settings import LazyI18nStringList
from ...helpers.compat import CompatDeleteView from ...helpers.compat import CompatDeleteView
from ...helpers.format import format_map from ...helpers.format import format_map
@@ -402,7 +400,7 @@ class EventPlugins(EventSettingsViewMixin, EventPermissionRequiredMixin, Templat
if key.startswith("plugin:"): if key.startswith("plugin:"):
module = key.split(":")[1] module = key.split(":")[1]
if value == "enable" and module in plugins_available: if value == "enable" and module in plugins_available:
if getattr(plugins_available[module], 'restricted', False): if getattr(plugins_available[module].app, 'restricted', False):
if module not in request.event.settings.allowed_restricted_plugins: if module not in request.event.settings.allowed_restricted_plugins:
continue continue
@@ -728,7 +726,7 @@ class MailSettingsPreview(EventPermissionRequiredMixin, View):
else: else:
ctx[p.identifier] = '<span class="placeholder" title="{}">{}</span>'.format( ctx[p.identifier] = '<span class="placeholder" title="{}">{}</span>'.format(
_('This value will be replaced based on dynamic parameters.'), _('This value will be replaced based on dynamic parameters.'),
escape(s) s
) )
return ctx return ctx
@@ -748,9 +746,9 @@ class MailSettingsPreview(EventPermissionRequiredMixin, View):
with language(self.supported_locale[idx], self.request.event.settings.region): with language(self.supported_locale[idx], self.request.event.settings.region):
try: try:
if k.startswith('mail_subject_'): if k.startswith('mail_subject_'):
msgs[self.supported_locale[idx]] = prefix_subject(self.request.event, format_map( msgs[self.supported_locale[idx]] = format_map(
bleach.clean(v), self.placeholders(preview_item), raise_on_missing=True bleach.clean(v), self.placeholders(preview_item), raise_on_missing=True
), highlight=True) )
else: else:
msgs[self.supported_locale[idx]] = markdown_compile_email( msgs[self.supported_locale[idx]] = markdown_compile_email(
format_map(v, self.placeholders(preview_item), raise_on_missing=True) format_map(v, self.placeholders(preview_item), raise_on_missing=True)
@@ -778,7 +776,7 @@ class MailSettingsRendererPreview(MailSettingsPreview):
def placeholders(self, item): def placeholders(self, item):
ctx = {} ctx = {}
for p in get_available_placeholders(self.request.event, MailSettingsForm.base_context[item]).values(): for p in get_available_placeholders(self.request.event, MailSettingsForm.base_context[item]).values():
ctx[p.identifier] = escape(str(p.render_sample(self.request.event))) ctx[p.identifier] = str(p.render_sample(self.request.event))
return ctx return ctx
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
+1 -1
View File
@@ -103,7 +103,7 @@ class ItemList(ListView):
def get_queryset(self): def get_queryset(self):
return Item.objects.filter( return Item.objects.filter(
event=self.request.event event=self.request.event
).select_related("tax_rule").annotate( ).annotate(
var_count=Count('variations') var_count=Count('variations')
).prefetch_related("category", "limit_sales_channels").order_by( ).prefetch_related("category", "limit_sales_channels").order_by(
F('category__position').asc(nulls_first=True), F('category__position').asc(nulls_first=True),
+5 -12
View File
@@ -62,9 +62,8 @@ from django.urls import reverse
from django.utils import formats from django.utils import formats
from django.utils.formats import date_format, get_format from django.utils.formats import date_format, get_format
from django.utils.functional import cached_property from django.utils.functional import cached_property
from django.utils.html import conditional_escape, escape from django.utils.html import conditional_escape
from django.utils.http import url_has_allowed_host_and_scheme from django.utils.http import url_has_allowed_host_and_scheme
from django.utils.safestring import mark_safe
from django.utils.timezone import make_aware, now from django.utils.timezone import make_aware, now
from django.utils.translation import gettext, gettext_lazy as _, ngettext from django.utils.translation import gettext, gettext_lazy as _, ngettext
from django.views.generic import ( from django.views.generic import (
@@ -95,9 +94,7 @@ from pretix.base.services.invoices import (
invoice_qualified, regenerate_invoice, invoice_qualified, regenerate_invoice,
) )
from pretix.base.services.locking import LockTimeoutException from pretix.base.services.locking import LockTimeoutException
from pretix.base.services.mail import ( from pretix.base.services.mail import SendMailException, render_mail
SendMailException, prefix_subject, render_mail,
)
from pretix.base.services.orders import ( from pretix.base.services.orders import (
OrderChangeManager, OrderError, approve_order, cancel_order, deny_order, OrderChangeManager, OrderError, approve_order, cancel_order, deny_order,
extend_order, mark_order_expired, mark_order_refunded, extend_order, mark_order_expired, mark_order_refunded,
@@ -1903,7 +1900,7 @@ class OrderChange(OrderView):
positions = list(self.order.positions.select_related( positions = list(self.order.positions.select_related(
'item', 'item__tax_rule', 'used_membership', 'used_membership__membership_type', 'tax_rule', 'item', 'item__tax_rule', 'used_membership', 'used_membership__membership_type', 'tax_rule',
'seat', 'subevent', 'seat', 'subevent',
).prefetch_related('granted_memberships')) ))
for p in positions: for p in positions:
p.form = OrderPositionChangeForm(prefix='op-{}'.format(p.pk), instance=p, items=self.items, p.form = OrderPositionChangeForm(prefix='op-{}'.format(p.pk), instance=p, items=self.items,
initial={'seat': p.seat.seat_guid if p.seat else None}, initial={'seat': p.seat.seat_guid if p.seat else None},
@@ -2307,9 +2304,7 @@ class OrderSendMail(EventPermissionRequiredMixin, OrderViewMixin, FormView):
email_content = render_mail(email_template, email_context) email_content = render_mail(email_template, email_context)
if self.request.POST.get('action') == 'preview': if self.request.POST.get('action') == 'preview':
self.preview_output = { self.preview_output = {
'subject': mark_safe(_('Subject: {subject}').format( 'subject': _('Subject: {subject}').format(subject=email_subject),
subject=prefix_subject(order.event, escape(email_subject), highlight=True)
)),
'html': markdown_compile_email(email_content) 'html': markdown_compile_email(email_content)
} }
return self.get(self.request, *self.args, **self.kwargs) return self.get(self.request, *self.args, **self.kwargs)
@@ -2374,9 +2369,7 @@ class OrderPositionSendMail(OrderSendMail):
email_content = render_mail(email_template, email_context) email_content = render_mail(email_template, email_context)
if self.request.POST.get('action') == 'preview': if self.request.POST.get('action') == 'preview':
self.preview_output = { self.preview_output = {
'subject': mark_safe(_('Subject: {subject}').format( 'subject': _('Subject: {subject}').format(subject=email_subject),
subject=prefix_subject(position.order.event, escape(email_subject), highlight=True))
),
'html': markdown_compile_email(email_content) 'html': markdown_compile_email(email_content)
} }
return self.get(self.request, *self.args, **self.kwargs) return self.get(self.request, *self.args, **self.kwargs)
+11 -25
View File
@@ -90,7 +90,7 @@ from pretix.base.models.orders import CancellationRequest
from pretix.base.models.organizer import SalesChannel, TeamAPIToken from pretix.base.models.organizer import SalesChannel, TeamAPIToken
from pretix.base.payment import PaymentException from pretix.base.payment import PaymentException
from pretix.base.services.export import multiexport, scheduled_organizer_export from pretix.base.services.export import multiexport, scheduled_organizer_export
from pretix.base.services.mail import SendMailException, mail, prefix_subject from pretix.base.services.mail import SendMailException, mail
from pretix.base.signals import register_multievent_data_exporters from pretix.base.signals import register_multievent_data_exporters
from pretix.base.templatetags.rich_text import markdown_compile_email from pretix.base.templatetags.rich_text import markdown_compile_email
from pretix.base.views.tasks import AsyncAction from pretix.base.views.tasks import AsyncAction
@@ -351,11 +351,8 @@ class MailSettingsPreview(OrganizerPermissionRequiredMixin, View):
if idx in self.supported_locale: if idx in self.supported_locale:
with language(self.supported_locale[idx], self.request.organizer.settings.region): with language(self.supported_locale[idx], self.request.organizer.settings.region):
if k.startswith('mail_subject_'): if k.startswith('mail_subject_'):
msgs[self.supported_locale[idx]] = prefix_subject( msgs[self.supported_locale[idx]] = format_map(bleach.clean(v),
self.request.organizer, self.placeholders(preview_item))
format_map(bleach.clean(v), self.placeholders(preview_item)),
highlight=True,
)
else: else:
msgs[self.supported_locale[idx]] = markdown_compile_email( msgs[self.supported_locale[idx]] = markdown_compile_email(
format_map(v, self.placeholders(preview_item)) format_map(v, self.placeholders(preview_item))
@@ -686,24 +683,14 @@ class TeamDeleteView(OrganizerDetailViewMixin, OrganizerPermissionRequiredMixin,
try: try:
self.object.log_action('pretix.team.deleted', user=self.request.user) self.object.log_action('pretix.team.deleted', user=self.request.user)
self.object.delete() self.object.delete()
except ProtectedError as e: except ProtectedError:
is_logs = any(isinstance(e, LogEntry) for e in e.protected_objects) messages.error(
if is_logs: self.request,
messages.error( _(
self.request, 'The team could not be deleted as some constraints (e.g. data created by '
_( 'plug-ins) do not allow it.'
"The team could not be deleted because the team or one of its API tokens is part of "
"historical audit logs."
)
)
else:
messages.error(
self.request,
_(
'The team could not be deleted as some constraints (e.g. data created by '
'plug-ins) do not allow it.'
)
) )
)
return redirect(success_url) return redirect(success_url)
messages.success(request, _('The selected team has been deleted.')) messages.success(request, _('The selected team has been deleted.'))
@@ -733,7 +720,6 @@ class TeamMemberView(OrganizerDetailViewMixin, OrganizerPermissionRequiredMixin,
ctx = super().get_context_data(**kwargs) ctx = super().get_context_data(**kwargs)
ctx['add_form'] = self.add_form ctx['add_form'] = self.add_form
ctx['add_token_form'] = self.add_token_form ctx['add_token_form'] = self.add_token_form
ctx['tokens'] = self.object.tokens.order_by("-active", "name", "pk")
return ctx return ctx
def _send_invite(self, instance): def _send_invite(self, instance):
@@ -3175,7 +3161,7 @@ class ChannelUpdateView(OrganizerDetailViewMixin, OrganizerPermissionRequiredMix
} }
def form_valid(self, form): def form_valid(self, form):
if form.has_changed(): if form.has_changed() or self.formset.has_changed():
self.object.log_action('pretix.saleschannel.changed', user=self.request.user, data={ self.object.log_action('pretix.saleschannel.changed', user=self.request.user, data={
k: getattr(self.object, k) k: getattr(self.object, k)
for k in form.changed_data for k in form.changed_data
+3 -8
View File
@@ -50,7 +50,7 @@ from django.http import (
from django.shortcuts import redirect, render from django.shortcuts import redirect, render
from django.urls import resolve, reverse from django.urls import resolve, reverse
from django.utils.functional import cached_property from django.utils.functional import cached_property
from django.utils.html import escape, format_html from django.utils.html import format_html
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
from django.utils.timezone import now from django.utils.timezone import now
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
@@ -64,7 +64,6 @@ from pretix.base.models import (
CartPosition, LogEntry, Voucher, WaitingListEntry, CartPosition, LogEntry, Voucher, WaitingListEntry,
) )
from pretix.base.models.vouchers import generate_codes from pretix.base.models.vouchers import generate_codes
from pretix.base.services.mail import prefix_subject
from pretix.base.services.vouchers import vouchers_send from pretix.base.services.vouchers import vouchers_send
from pretix.base.templatetags.rich_text import markdown_compile_email from pretix.base.templatetags.rich_text import markdown_compile_email
from pretix.base.views.tasks import AsyncFormView from pretix.base.views.tasks import AsyncFormView
@@ -563,7 +562,7 @@ class VoucherBulkMailPreview(EventPermissionRequiredMixin, View):
else: else:
ctx[p.identifier] = '<span class="placeholder" title="{}">{}</span>'.format( ctx[p.identifier] = '<span class="placeholder" title="{}">{}</span>'.format(
_('This value will be replaced based on dynamic parameters.'), _('This value will be replaced based on dynamic parameters.'),
escape(s) s
) )
return self.SafeDict(ctx) return self.SafeDict(ctx)
@@ -573,11 +572,7 @@ class VoucherBulkMailPreview(EventPermissionRequiredMixin, View):
return HttpResponseBadRequest(_('invalid item')) return HttpResponseBadRequest(_('invalid item'))
msgs = {} msgs = {}
if "subject" in preview_item: if "subject" in preview_item:
msgs["all"] = prefix_subject( msgs["all"] = format_map(bleach.clean(request.POST.get(preview_item, "")), self.placeholders(preview_item))
self.request.event,
format_map(bleach.clean(request.POST.get(preview_item, "")), self.placeholders(preview_item)),
highlight=True
)
else: else:
msgs["all"] = markdown_compile_email( msgs["all"] = markdown_compile_email(
format_map(request.POST.get(preview_item), self.placeholders(preview_item)) format_map(request.POST.get(preview_item), self.placeholders(preview_item))
+2 -2
View File
@@ -53,14 +53,14 @@ def daterange(df, dt, as_html=False):
if lng.startswith("de"): if lng.startswith("de"):
if df.year == dt.year and df.month == dt.month and df.day == dt.day: if df.year == dt.year and df.month == dt.month and df.day == dt.day:
return format_html(base_format, _date(df, "D, j. F Y")) return format_html(base_format, _date(df, "j. F Y"))
elif df.year == dt.year and df.month == dt.month: elif df.year == dt.year and df.month == dt.month:
return format_html(base_format, _date(df, "j."), "", _date(dt, "j. F Y")) return format_html(base_format, _date(df, "j."), "", _date(dt, "j. F Y"))
elif df.year == dt.year: elif df.year == dt.year:
return format_html(base_format, _date(df, "j. F"), " ", _date(dt, "j. F Y")) return format_html(base_format, _date(df, "j. F"), " ", _date(dt, "j. F Y"))
elif lng.startswith("en"): elif lng.startswith("en"):
if df.year == dt.year and df.month == dt.month and df.day == dt.day: if df.year == dt.year and df.month == dt.month and df.day == dt.day:
return format_html(base_format, _date(df, "D, N jS, Y")) return format_html(base_format, _date(df, "N jS, Y"))
elif df.year == dt.year and df.month == dt.month: elif df.year == dt.year and df.month == dt.month:
return format_html(base_format, _date(df, "N jS"), " ", _date(dt, "jS, Y")) return format_html(base_format, _date(df, "N jS"), " ", _date(dt, "jS, Y"))
elif df.year == dt.year: elif df.year == dt.year:
File diff suppressed because it is too large Load Diff
+33 -37
View File
@@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-08-27 13:34+0000\n" "POT-Creation-Date: 2024-06-24 08:20+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -543,56 +543,52 @@ msgctxt "entry_status"
msgid "absent" msgid "absent"
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/editor.js:171 #: pretix/static/pretixcontrol/js/ui/editor.js:72
msgid "Check-in QR" msgid "Check-in QR"
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/editor.js:543 #: pretix/static/pretixcontrol/js/ui/editor.js:387
msgid "The PDF background file could not be loaded for the following reason:" msgid "The PDF background file could not be loaded for the following reason:"
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/editor.js:894 #: pretix/static/pretixcontrol/js/ui/editor.js:656
msgid "Group of objects" msgid "Group of objects"
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/editor.js:899 #: pretix/static/pretixcontrol/js/ui/editor.js:661
msgid "Text object (deprecated)" msgid "Text object"
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/editor.js:901 #: pretix/static/pretixcontrol/js/ui/editor.js:663
msgid "Text box"
msgstr ""
#: pretix/static/pretixcontrol/js/ui/editor.js:903
msgid "Barcode area" msgid "Barcode area"
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/editor.js:905 #: pretix/static/pretixcontrol/js/ui/editor.js:665
msgid "Image area" msgid "Image area"
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/editor.js:907 #: pretix/static/pretixcontrol/js/ui/editor.js:667
msgid "Powered by pretix" msgid "Powered by pretix"
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/editor.js:909 #: pretix/static/pretixcontrol/js/ui/editor.js:669
msgid "Object" msgid "Object"
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/editor.js:913 #: pretix/static/pretixcontrol/js/ui/editor.js:673
msgid "Ticket design" msgid "Ticket design"
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/editor.js:1250 #: pretix/static/pretixcontrol/js/ui/editor.js:972
msgid "Saving failed." msgid "Saving failed."
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/editor.js:1319 #: pretix/static/pretixcontrol/js/ui/editor.js:1041
#: pretix/static/pretixcontrol/js/ui/editor.js:1370 #: pretix/static/pretixcontrol/js/ui/editor.js:1091
msgid "Error while uploading your PDF file, please try again." msgid "Error while uploading your PDF file, please try again."
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/editor.js:1353 #: pretix/static/pretixcontrol/js/ui/editor.js:1074
msgid "Do you really want to leave the editor without saving your changes?" msgid "Do you really want to leave the editor without saving your changes?"
msgstr "" msgstr ""
@@ -608,54 +604,54 @@ msgstr ""
msgid "Unknown error." msgid "Unknown error."
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/main.js:318 #: pretix/static/pretixcontrol/js/ui/main.js:313
msgid "Your color has great contrast and is very easy to read!" msgid "Your color has great contrast and is very easy to read!"
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/main.js:322 #: pretix/static/pretixcontrol/js/ui/main.js:317
msgid "Your color has decent contrast and is probably good-enough to read!" msgid "Your color has decent contrast and is probably good-enough to read!"
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/main.js:326 #: pretix/static/pretixcontrol/js/ui/main.js:321
msgid "" msgid ""
"Your color has bad contrast for text on white background, please choose a " "Your color has bad contrast for text on white background, please choose a "
"darker shade." "darker shade."
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/main.js:491 #: pretix/static/pretixcontrol/js/ui/main.js:475
#: pretix/static/pretixcontrol/js/ui/main.js:511 #: pretix/static/pretixcontrol/js/ui/main.js:495
msgid "Search query" msgid "Search query"
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/main.js:509 #: pretix/static/pretixcontrol/js/ui/main.js:493
msgid "All" msgid "All"
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/main.js:510 #: pretix/static/pretixcontrol/js/ui/main.js:494
msgid "None" msgid "None"
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/main.js:514 #: pretix/static/pretixcontrol/js/ui/main.js:498
msgid "Selected only" msgid "Selected only"
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/main.js:847 #: pretix/static/pretixcontrol/js/ui/main.js:828
msgid "Enter page number between 1 and %(max)s." msgid "Enter page number between 1 and %(max)s."
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/main.js:850 #: pretix/static/pretixcontrol/js/ui/main.js:831
msgid "Invalid page number." msgid "Invalid page number."
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/main.js:1008 #: pretix/static/pretixcontrol/js/ui/main.js:989
msgid "Use a different name internally" msgid "Use a different name internally"
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/main.js:1048 #: pretix/static/pretixcontrol/js/ui/main.js:1029
msgid "Click to close" msgid "Click to close"
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/main.js:1123 #: pretix/static/pretixcontrol/js/ui/main.js:1104
msgid "You have unsaved changes!" msgid "You have unsaved changes!"
msgstr "" msgstr ""
@@ -705,20 +701,20 @@ msgstr ""
msgid "Please enter the amount the organizer can keep." msgid "Please enter the amount the organizer can keep."
msgstr "" msgstr ""
#: pretix/static/pretixpresale/js/ui/main.js:449 #: pretix/static/pretixpresale/js/ui/main.js:444
msgid "Please enter a quantity for one of the ticket types." msgid "Please enter a quantity for one of the ticket types."
msgstr "" msgstr ""
#: pretix/static/pretixpresale/js/ui/main.js:485 #: pretix/static/pretixpresale/js/ui/main.js:480
msgid "required" msgid "required"
msgstr "" msgstr ""
#: pretix/static/pretixpresale/js/ui/main.js:588 #: pretix/static/pretixpresale/js/ui/main.js:583
#: pretix/static/pretixpresale/js/ui/main.js:607 #: pretix/static/pretixpresale/js/ui/main.js:602
msgid "Time zone:" msgid "Time zone:"
msgstr "" msgstr ""
#: pretix/static/pretixpresale/js/ui/main.js:598 #: pretix/static/pretixpresale/js/ui/main.js:593
msgid "Your local time:" msgid "Your local time:"
msgstr "" msgstr ""
File diff suppressed because it is too large Load Diff
+33 -41
View File
@@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-08-27 13:34+0000\n" "POT-Creation-Date: 2024-06-24 08:20+0000\n"
"PO-Revision-Date: 2021-09-15 11:22+0000\n" "PO-Revision-Date: 2021-09-15 11:22+0000\n"
"Last-Translator: Mohamed Tawfiq <mtawfiq@wafyapp.com>\n" "Last-Translator: Mohamed Tawfiq <mtawfiq@wafyapp.com>\n"
"Language-Team: Arabic <https://translate.pretix.eu/projects/pretix/pretix-js/" "Language-Team: Arabic <https://translate.pretix.eu/projects/pretix/pretix-js/"
@@ -573,60 +573,52 @@ msgctxt "entry_status"
msgid "absent" msgid "absent"
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/editor.js:171 #: pretix/static/pretixcontrol/js/ui/editor.js:72
msgid "Check-in QR" msgid "Check-in QR"
msgstr "QR الدخول" msgstr "QR الدخول"
#: pretix/static/pretixcontrol/js/ui/editor.js:543 #: pretix/static/pretixcontrol/js/ui/editor.js:387
msgid "The PDF background file could not be loaded for the following reason:" msgid "The PDF background file could not be loaded for the following reason:"
msgstr "لا يمكن تحميل ملف PDF الخلفية للأسباب التالية:" msgstr "لا يمكن تحميل ملف PDF الخلفية للأسباب التالية:"
#: pretix/static/pretixcontrol/js/ui/editor.js:894 #: pretix/static/pretixcontrol/js/ui/editor.js:656
msgid "Group of objects" msgid "Group of objects"
msgstr "مجموعة من العناصر" msgstr "مجموعة من العناصر"
#: pretix/static/pretixcontrol/js/ui/editor.js:899 #: pretix/static/pretixcontrol/js/ui/editor.js:661
#, fuzzy msgid "Text object"
#| msgid "Text object"
msgid "Text object (deprecated)"
msgstr "عنصر نص" msgstr "عنصر نص"
#: pretix/static/pretixcontrol/js/ui/editor.js:901 #: pretix/static/pretixcontrol/js/ui/editor.js:663
#, fuzzy
#| msgid "Text object"
msgid "Text box"
msgstr "عنصر نص"
#: pretix/static/pretixcontrol/js/ui/editor.js:903
msgid "Barcode area" msgid "Barcode area"
msgstr "منطقة باركود" msgstr "منطقة باركود"
#: pretix/static/pretixcontrol/js/ui/editor.js:905 #: pretix/static/pretixcontrol/js/ui/editor.js:665
msgid "Image area" msgid "Image area"
msgstr "منطقة صورة" msgstr "منطقة صورة"
#: pretix/static/pretixcontrol/js/ui/editor.js:907 #: pretix/static/pretixcontrol/js/ui/editor.js:667
msgid "Powered by pretix" msgid "Powered by pretix"
msgstr "مدعوم من pretix" msgstr "مدعوم من pretix"
#: pretix/static/pretixcontrol/js/ui/editor.js:909 #: pretix/static/pretixcontrol/js/ui/editor.js:669
msgid "Object" msgid "Object"
msgstr "عنصر" msgstr "عنصر"
#: pretix/static/pretixcontrol/js/ui/editor.js:913 #: pretix/static/pretixcontrol/js/ui/editor.js:673
msgid "Ticket design" msgid "Ticket design"
msgstr "تصميم التذكرة" msgstr "تصميم التذكرة"
#: pretix/static/pretixcontrol/js/ui/editor.js:1250 #: pretix/static/pretixcontrol/js/ui/editor.js:972
msgid "Saving failed." msgid "Saving failed."
msgstr "فشلت عملية الحفظ." msgstr "فشلت عملية الحفظ."
#: pretix/static/pretixcontrol/js/ui/editor.js:1319 #: pretix/static/pretixcontrol/js/ui/editor.js:1041
#: pretix/static/pretixcontrol/js/ui/editor.js:1370 #: pretix/static/pretixcontrol/js/ui/editor.js:1091
msgid "Error while uploading your PDF file, please try again." msgid "Error while uploading your PDF file, please try again."
msgstr "حصل خطأ أثناء رفع ملف PDF الخاص بك، يرجى المحاولة مرة أخرى." msgstr "حصل خطأ أثناء رفع ملف PDF الخاص بك، يرجى المحاولة مرة أخرى."
#: pretix/static/pretixcontrol/js/ui/editor.js:1353 #: pretix/static/pretixcontrol/js/ui/editor.js:1074
msgid "Do you really want to leave the editor without saving your changes?" msgid "Do you really want to leave the editor without saving your changes?"
msgstr "هل تريد أن تغادر المحرر دون حفظ التعديلات؟" msgstr "هل تريد أن تغادر المحرر دون حفظ التعديلات؟"
@@ -642,54 +634,54 @@ msgstr "توليد الرسائل …"
msgid "Unknown error." msgid "Unknown error."
msgstr "خطأ غير معروف." msgstr "خطأ غير معروف."
#: pretix/static/pretixcontrol/js/ui/main.js:318 #: pretix/static/pretixcontrol/js/ui/main.js:313
msgid "Your color has great contrast and is very easy to read!" msgid "Your color has great contrast and is very easy to read!"
msgstr "اللون يتمتع بتباين كبير وتسهل قراءته!" msgstr "اللون يتمتع بتباين كبير وتسهل قراءته!"
#: pretix/static/pretixcontrol/js/ui/main.js:322 #: pretix/static/pretixcontrol/js/ui/main.js:317
msgid "Your color has decent contrast and is probably good-enough to read!" msgid "Your color has decent contrast and is probably good-enough to read!"
msgstr "اللون يحظى بتباين معقول ويمكن أن يكون مناسب للقراءة!" msgstr "اللون يحظى بتباين معقول ويمكن أن يكون مناسب للقراءة!"
#: pretix/static/pretixcontrol/js/ui/main.js:326 #: pretix/static/pretixcontrol/js/ui/main.js:321
msgid "" msgid ""
"Your color has bad contrast for text on white background, please choose a " "Your color has bad contrast for text on white background, please choose a "
"darker shade." "darker shade."
msgstr "تباين اللون سيئ للخلفية البيضاء، الرجاء اختيار لون غامق." msgstr "تباين اللون سيئ للخلفية البيضاء، الرجاء اختيار لون غامق."
#: pretix/static/pretixcontrol/js/ui/main.js:491 #: pretix/static/pretixcontrol/js/ui/main.js:475
#: pretix/static/pretixcontrol/js/ui/main.js:511 #: pretix/static/pretixcontrol/js/ui/main.js:495
msgid "Search query" msgid "Search query"
msgstr "البحث في الاستفسارات" msgstr "البحث في الاستفسارات"
#: pretix/static/pretixcontrol/js/ui/main.js:509 #: pretix/static/pretixcontrol/js/ui/main.js:493
msgid "All" msgid "All"
msgstr "الكل" msgstr "الكل"
#: pretix/static/pretixcontrol/js/ui/main.js:510 #: pretix/static/pretixcontrol/js/ui/main.js:494
msgid "None" msgid "None"
msgstr "لا شيء" msgstr "لا شيء"
#: pretix/static/pretixcontrol/js/ui/main.js:514 #: pretix/static/pretixcontrol/js/ui/main.js:498
msgid "Selected only" msgid "Selected only"
msgstr "المختارة فقط" msgstr "المختارة فقط"
#: pretix/static/pretixcontrol/js/ui/main.js:847 #: pretix/static/pretixcontrol/js/ui/main.js:828
msgid "Enter page number between 1 and %(max)s." msgid "Enter page number between 1 and %(max)s."
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/main.js:850 #: pretix/static/pretixcontrol/js/ui/main.js:831
msgid "Invalid page number." msgid "Invalid page number."
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/main.js:1008 #: pretix/static/pretixcontrol/js/ui/main.js:989
msgid "Use a different name internally" msgid "Use a different name internally"
msgstr "قم باستخدم اسم مختلف داخليا" msgstr "قم باستخدم اسم مختلف داخليا"
#: pretix/static/pretixcontrol/js/ui/main.js:1048 #: pretix/static/pretixcontrol/js/ui/main.js:1029
msgid "Click to close" msgid "Click to close"
msgstr "اضغط لاغلاق الصفحة" msgstr "اضغط لاغلاق الصفحة"
#: pretix/static/pretixcontrol/js/ui/main.js:1123 #: pretix/static/pretixcontrol/js/ui/main.js:1104
msgid "You have unsaved changes!" msgid "You have unsaved changes!"
msgstr "لم تقم بحفظ التعديلات!" msgstr "لم تقم بحفظ التعديلات!"
@@ -753,20 +745,20 @@ msgstr "ستسترد %(currency)%(amount)"
msgid "Please enter the amount the organizer can keep." msgid "Please enter the amount the organizer can keep."
msgstr "الرجاء إدخال المبلغ الذي يمكن للمنظم الاحتفاظ به." msgstr "الرجاء إدخال المبلغ الذي يمكن للمنظم الاحتفاظ به."
#: pretix/static/pretixpresale/js/ui/main.js:449 #: pretix/static/pretixpresale/js/ui/main.js:444
msgid "Please enter a quantity for one of the ticket types." msgid "Please enter a quantity for one of the ticket types."
msgstr "الرجاء إدخال عدد لأحد أنواع التذاكر." msgstr "الرجاء إدخال عدد لأحد أنواع التذاكر."
#: pretix/static/pretixpresale/js/ui/main.js:485 #: pretix/static/pretixpresale/js/ui/main.js:480
msgid "required" msgid "required"
msgstr "مطلوب" msgstr "مطلوب"
#: pretix/static/pretixpresale/js/ui/main.js:588 #: pretix/static/pretixpresale/js/ui/main.js:583
#: pretix/static/pretixpresale/js/ui/main.js:607 #: pretix/static/pretixpresale/js/ui/main.js:602
msgid "Time zone:" msgid "Time zone:"
msgstr "المنطقة الزمنية:" msgstr "المنطقة الزمنية:"
#: pretix/static/pretixpresale/js/ui/main.js:598 #: pretix/static/pretixpresale/js/ui/main.js:593
msgid "Your local time:" msgid "Your local time:"
msgstr "التوقيت المحلي:" msgstr "التوقيت المحلي:"
File diff suppressed because it is too large Load Diff
+33 -37
View File
@@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-08-27 13:34+0000\n" "POT-Creation-Date: 2024-06-24 08:20+0000\n"
"PO-Revision-Date: 2020-12-19 07:00+0000\n" "PO-Revision-Date: 2020-12-19 07:00+0000\n"
"Last-Translator: albert <albert.serra.monner@gmail.com>\n" "Last-Translator: albert <albert.serra.monner@gmail.com>\n"
"Language-Team: Catalan <https://translate.pretix.eu/projects/pretix/pretix-" "Language-Team: Catalan <https://translate.pretix.eu/projects/pretix/pretix-"
@@ -544,56 +544,52 @@ msgctxt "entry_status"
msgid "absent" msgid "absent"
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/editor.js:171 #: pretix/static/pretixcontrol/js/ui/editor.js:72
msgid "Check-in QR" msgid "Check-in QR"
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/editor.js:543 #: pretix/static/pretixcontrol/js/ui/editor.js:387
msgid "The PDF background file could not be loaded for the following reason:" msgid "The PDF background file could not be loaded for the following reason:"
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/editor.js:894 #: pretix/static/pretixcontrol/js/ui/editor.js:656
msgid "Group of objects" msgid "Group of objects"
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/editor.js:899 #: pretix/static/pretixcontrol/js/ui/editor.js:661
msgid "Text object (deprecated)" msgid "Text object"
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/editor.js:901 #: pretix/static/pretixcontrol/js/ui/editor.js:663
msgid "Text box"
msgstr ""
#: pretix/static/pretixcontrol/js/ui/editor.js:903
msgid "Barcode area" msgid "Barcode area"
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/editor.js:905 #: pretix/static/pretixcontrol/js/ui/editor.js:665
msgid "Image area" msgid "Image area"
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/editor.js:907 #: pretix/static/pretixcontrol/js/ui/editor.js:667
msgid "Powered by pretix" msgid "Powered by pretix"
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/editor.js:909 #: pretix/static/pretixcontrol/js/ui/editor.js:669
msgid "Object" msgid "Object"
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/editor.js:913 #: pretix/static/pretixcontrol/js/ui/editor.js:673
msgid "Ticket design" msgid "Ticket design"
msgstr "Disseny del tiquet" msgstr "Disseny del tiquet"
#: pretix/static/pretixcontrol/js/ui/editor.js:1250 #: pretix/static/pretixcontrol/js/ui/editor.js:972
msgid "Saving failed." msgid "Saving failed."
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/editor.js:1319 #: pretix/static/pretixcontrol/js/ui/editor.js:1041
#: pretix/static/pretixcontrol/js/ui/editor.js:1370 #: pretix/static/pretixcontrol/js/ui/editor.js:1091
msgid "Error while uploading your PDF file, please try again." msgid "Error while uploading your PDF file, please try again."
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/editor.js:1353 #: pretix/static/pretixcontrol/js/ui/editor.js:1074
msgid "Do you really want to leave the editor without saving your changes?" msgid "Do you really want to leave the editor without saving your changes?"
msgstr "" msgstr ""
@@ -609,54 +605,54 @@ msgstr ""
msgid "Unknown error." msgid "Unknown error."
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/main.js:318 #: pretix/static/pretixcontrol/js/ui/main.js:313
msgid "Your color has great contrast and is very easy to read!" msgid "Your color has great contrast and is very easy to read!"
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/main.js:322 #: pretix/static/pretixcontrol/js/ui/main.js:317
msgid "Your color has decent contrast and is probably good-enough to read!" msgid "Your color has decent contrast and is probably good-enough to read!"
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/main.js:326 #: pretix/static/pretixcontrol/js/ui/main.js:321
msgid "" msgid ""
"Your color has bad contrast for text on white background, please choose a " "Your color has bad contrast for text on white background, please choose a "
"darker shade." "darker shade."
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/main.js:491 #: pretix/static/pretixcontrol/js/ui/main.js:475
#: pretix/static/pretixcontrol/js/ui/main.js:511 #: pretix/static/pretixcontrol/js/ui/main.js:495
msgid "Search query" msgid "Search query"
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/main.js:509 #: pretix/static/pretixcontrol/js/ui/main.js:493
msgid "All" msgid "All"
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/main.js:510 #: pretix/static/pretixcontrol/js/ui/main.js:494
msgid "None" msgid "None"
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/main.js:514 #: pretix/static/pretixcontrol/js/ui/main.js:498
msgid "Selected only" msgid "Selected only"
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/main.js:847 #: pretix/static/pretixcontrol/js/ui/main.js:828
msgid "Enter page number between 1 and %(max)s." msgid "Enter page number between 1 and %(max)s."
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/main.js:850 #: pretix/static/pretixcontrol/js/ui/main.js:831
msgid "Invalid page number." msgid "Invalid page number."
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/main.js:1008 #: pretix/static/pretixcontrol/js/ui/main.js:989
msgid "Use a different name internally" msgid "Use a different name internally"
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/main.js:1048 #: pretix/static/pretixcontrol/js/ui/main.js:1029
msgid "Click to close" msgid "Click to close"
msgstr "" msgstr ""
#: pretix/static/pretixcontrol/js/ui/main.js:1123 #: pretix/static/pretixcontrol/js/ui/main.js:1104
msgid "You have unsaved changes!" msgid "You have unsaved changes!"
msgstr "" msgstr ""
@@ -710,22 +706,22 @@ msgstr ""
msgid "Please enter the amount the organizer can keep." msgid "Please enter the amount the organizer can keep."
msgstr "" msgstr ""
#: pretix/static/pretixpresale/js/ui/main.js:449 #: pretix/static/pretixpresale/js/ui/main.js:444
msgid "Please enter a quantity for one of the ticket types." msgid "Please enter a quantity for one of the ticket types."
msgstr "" msgstr ""
#: pretix/static/pretixpresale/js/ui/main.js:485 #: pretix/static/pretixpresale/js/ui/main.js:480
#, fuzzy #, fuzzy
#| msgid "Cart expired" #| msgid "Cart expired"
msgid "required" msgid "required"
msgstr "Cistella expirada" msgstr "Cistella expirada"
#: pretix/static/pretixpresale/js/ui/main.js:588 #: pretix/static/pretixpresale/js/ui/main.js:583
#: pretix/static/pretixpresale/js/ui/main.js:607 #: pretix/static/pretixpresale/js/ui/main.js:602
msgid "Time zone:" msgid "Time zone:"
msgstr "" msgstr ""
#: pretix/static/pretixpresale/js/ui/main.js:598 #: pretix/static/pretixpresale/js/ui/main.js:593
msgid "Your local time:" msgid "Your local time:"
msgstr "" msgstr ""

Some files were not shown because too many files have changed in this diff Show More