mirror of
https://github.com/pretix/pretix.git
synced 2026-05-04 15:04:03 +00:00
Fixed minor documentation errors and mistakes (#151)
This commit is contained in:
committed by
Raphael Michel
parent
f779b70deb
commit
bfc721978d
@@ -42,7 +42,7 @@ class BaseExporter:
|
||||
@property
|
||||
def export_form_fields(self) -> dict:
|
||||
"""
|
||||
When the event's administrator administrator visits the export page, this method
|
||||
When the event's administrator visits the export page, this method
|
||||
is called to return the configuration fields available.
|
||||
|
||||
It should therefore return a dictionary where the keys should be field names and
|
||||
|
||||
@@ -33,7 +33,7 @@ class I18nModelForm(six.with_metaclass(ModelFormMetaclass, BaseI18nModelForm)):
|
||||
"""
|
||||
This is a modified version of Django's ModelForm which differs from ModelForm in
|
||||
only one way: The constructor takes one additional optional argument ``event``
|
||||
which may be given an `Event` instance. If given, this instance is used to select
|
||||
expecting an `Event` instance. If given, this instance is used to select
|
||||
the visible languages in all I18nFormFields of the form. If not given, all languages
|
||||
will be displayed.
|
||||
"""
|
||||
@@ -83,7 +83,7 @@ class I18nInlineFormSet(BaseInlineFormSet):
|
||||
|
||||
class SettingsForm(forms.Form):
|
||||
"""
|
||||
This form is meant to be used for modifying Event- or OrganizerSettings. It takes
|
||||
This form is meant to be used for modifying EventSettings or OrganizerSettings. It takes
|
||||
care of loading the current values of the fields and saving the field inputs to the
|
||||
settings storage. It also deals with setting the available languages for internationalized
|
||||
fields.
|
||||
|
||||
@@ -17,7 +17,7 @@ class LoginForm(forms.Form):
|
||||
password = forms.CharField(label=_("Password"), widget=forms.PasswordInput)
|
||||
|
||||
error_messages = {
|
||||
'invalid_login': _("Please enter a correct e-mail address and password."),
|
||||
'invalid_login': _("Please enter a correct email address and password."),
|
||||
'inactive': _("This account is inactive.")
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ class LoginForm(forms.Form):
|
||||
|
||||
class RegistrationForm(forms.Form):
|
||||
error_messages = {
|
||||
'duplicate_email': _("You already registered with that e-mail address, please use the login form."),
|
||||
'duplicate_email': _("You already registered with that email address, please use the login form."),
|
||||
'pw_mismatch': _("Please enter the same password twice"),
|
||||
}
|
||||
email = forms.EmailField(
|
||||
|
||||
@@ -24,7 +24,7 @@ class LazyI18nString:
|
||||
|
||||
:param data: If this is a dictionary, it is expected to map language codes to translations.
|
||||
If this is a string that can be parsed as JSON, it will be parsed and used as such a dictionary.
|
||||
If this is anything else, it will be casted to a string and used for all languages.
|
||||
If this is anything else, it will be cast to a string and used for all languages.
|
||||
"""
|
||||
self.data = data
|
||||
if isinstance(self.data, str) and self.data is not None:
|
||||
|
||||
@@ -36,14 +36,12 @@ class User(AbstractBaseUser, PermissionsMixin, LoggingMixin):
|
||||
"""
|
||||
This is the user model used by pretix for authentication.
|
||||
|
||||
:param email: The user's e-mail address, used for identification.
|
||||
:param email: The user's email address, used for identification.
|
||||
:type email: str
|
||||
:param givenname: The user's given name. May be empty or null.
|
||||
:type givenname: str
|
||||
:param familyname: The user's given name. May be empty or null.
|
||||
:type familyname: str
|
||||
:param givenname: The user's given name. May be empty or null.
|
||||
:type givenname: str
|
||||
:param is_active: Whether this user account is activated.
|
||||
:type is_active: bool
|
||||
:param is_staff: ``True`` for system operators.
|
||||
@@ -98,7 +96,7 @@ class User(AbstractBaseUser, PermissionsMixin, LoggingMixin):
|
||||
|
||||
* Given name
|
||||
* Family name
|
||||
* E-mail address
|
||||
* Email address
|
||||
"""
|
||||
if self.givenname:
|
||||
return self.givenname
|
||||
|
||||
@@ -27,7 +27,7 @@ class Event(LoggedModel):
|
||||
|
||||
:param organizer: The organizer this event belongs to
|
||||
:type organizer: Organizer
|
||||
:param name: This events full title
|
||||
:param name: This event's full title
|
||||
:type name: str
|
||||
:param slug: A short, alphanumeric, all-lowercase name for use in URLs. The slug has to
|
||||
be unique among the events of the same organizer.
|
||||
@@ -42,7 +42,7 @@ class Event(LoggedModel):
|
||||
:type date_to: datetime
|
||||
:param presale_start: No tickets will be sold before this date.
|
||||
:type presale_start: datetime
|
||||
:param presale_end: No tickets will be sold before this date.
|
||||
:param presale_end: No tickets will be sold after this date.
|
||||
:type presale_end: datetime
|
||||
:param plugins: A comma-separated list of plugin names that are active for this
|
||||
event.
|
||||
@@ -110,14 +110,14 @@ class Event(LoggedModel):
|
||||
|
||||
def clean(self):
|
||||
if self.presale_start and self.presale_end and self.presale_start > self.presale_end:
|
||||
raise ValidationError({'presale_end': _('The end of the presale period has to be later than it\'s start.')})
|
||||
raise ValidationError({'presale_end': _('The end of the presale period has to be later than its start.')})
|
||||
if self.date_from and self.date_to and self.date_from > self.date_to:
|
||||
raise ValidationError({'date_to': _('The end of the event has to be later than it\'s start.')})
|
||||
raise ValidationError({'date_to': _('The end of the event has to be later than its start.')})
|
||||
super().clean()
|
||||
|
||||
def get_plugins(self) -> "list[str]":
|
||||
"""
|
||||
Get the names of the plugins activated for this event as a list.
|
||||
Returns the names of the plugins activated for this event as a list.
|
||||
"""
|
||||
if self.plugins is None:
|
||||
return []
|
||||
@@ -160,7 +160,7 @@ class Event(LoggedModel):
|
||||
@cached_property
|
||||
def settings(self) -> SettingsProxy:
|
||||
"""
|
||||
Returns an object representing this event's settings
|
||||
Returns an object representing this event's settings.
|
||||
"""
|
||||
try:
|
||||
return SettingsProxy(self, type=EventSetting, parent=self.organizer)
|
||||
@@ -184,7 +184,7 @@ class Event(LoggedModel):
|
||||
|
||||
def lock(self):
|
||||
"""
|
||||
Returns a contextmanager that can be used to lock an event for bookings
|
||||
Returns a contextmanager that can be used to lock an event for bookings.
|
||||
"""
|
||||
from pretix.base.services import locking
|
||||
|
||||
@@ -205,12 +205,12 @@ class Event(LoggedModel):
|
||||
|
||||
class EventPermission(models.Model):
|
||||
"""
|
||||
The relation between an Event and an User who has permissions to
|
||||
The relation between an Event and a User who has permissions to
|
||||
access an event.
|
||||
|
||||
:param event: The event this refers to
|
||||
:param event: The event this permission refers to
|
||||
:type event: Event
|
||||
:param user: The user these permission set applies to
|
||||
:param user: The user this permission set applies to
|
||||
:type user: User
|
||||
:param can_change_settings: If ``True``, the user can change all basic settings for this event.
|
||||
:type can_change_settings: bool
|
||||
|
||||
@@ -19,19 +19,30 @@ def invoice_filename(instance, filename: str) -> str:
|
||||
class Invoice(models.Model):
|
||||
"""
|
||||
Represents an invoice that is issued because of an order. Because invoices are legally required
|
||||
not to change, this object duplicates a log of data (e.g. the invoice address).
|
||||
not to change, this object duplicates a lot of data (e.g. the invoice address).
|
||||
|
||||
:param order: The associated order
|
||||
:type order: Order
|
||||
:param event: The event this belongs to (for convenience)
|
||||
:type event: Event
|
||||
:param invoice_no: The human-readable, event-unique invoice number
|
||||
:type invoice_no: int
|
||||
:param is_cancellation: Whether or not this is a cancellation instead of an invoice
|
||||
:param refers: A link to another invoice this invoice referse to, e.g. the cancelled invoice in an cancellation
|
||||
:type is_cancellation: bool
|
||||
:param refers: A link to another invoice this invoice refers to, e.g. the cancelled invoice in a cancellation
|
||||
:type refers: Invoice
|
||||
:param invoice_from: The sender address
|
||||
:type invoice_from: str
|
||||
:param invoice_to: The receiver address
|
||||
:type invoice_to: str
|
||||
:param date: The invoice date
|
||||
:type date: date
|
||||
:param locale: The locale in which the invoice should be printed
|
||||
:type locale: str
|
||||
:param additional_text: Additional text for the invoice
|
||||
:type additional_text: str
|
||||
:param file: The filename of the rendered invoice
|
||||
:type file: File
|
||||
"""
|
||||
order = models.ForeignKey('Order', related_name='invoices', db_index=True)
|
||||
event = models.ForeignKey('Event', related_name='invoices', db_index=True)
|
||||
@@ -47,7 +58,7 @@ class Invoice(models.Model):
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
if not self.order:
|
||||
raise ValueError('Any invoice needs to be connected to an order')
|
||||
raise ValueError('Every invoice needs to be connected to an order')
|
||||
if not self.event:
|
||||
self.event = self.order.event
|
||||
if not self.invoice_no:
|
||||
@@ -65,7 +76,7 @@ class Invoice(models.Model):
|
||||
@property
|
||||
def number(self):
|
||||
"""
|
||||
Returns the invoice number in a human-readable way with the event slug prepended.
|
||||
Returns the invoice number in a human-readable string with the event slug prepended.
|
||||
"""
|
||||
return '%s-%05d' % (self.event.slug.upper(), self.invoice_no)
|
||||
|
||||
@@ -75,13 +86,18 @@ class Invoice(models.Model):
|
||||
|
||||
class InvoiceLine(models.Model):
|
||||
"""
|
||||
One position listed on an invoice.
|
||||
One position listed on an Invoice.
|
||||
|
||||
:param invoice: The invoice this belongs to
|
||||
:type invoice: Invoice
|
||||
:param description: The item description
|
||||
:type description: str
|
||||
:param gross_value: The gross value
|
||||
:type gross_value: decimal.Decimal
|
||||
:param tax_value: The included tax (as an absolute value)
|
||||
:type tax_value: decimal.Decimal
|
||||
:param tax_rate: The applied tax rate in percent
|
||||
:type tax_rate: decimal.Decimal
|
||||
"""
|
||||
invoice = models.ForeignKey('Invoice', related_name='lines')
|
||||
description = models.TextField()
|
||||
|
||||
@@ -20,7 +20,7 @@ class ItemCategory(LoggedModel):
|
||||
"""
|
||||
Items can be sorted into these categories.
|
||||
|
||||
:param event: The event this belongs to
|
||||
:param event: The event this category belongs to
|
||||
:type event: Event
|
||||
:param name: The name of this category
|
||||
:type name: str
|
||||
@@ -81,13 +81,13 @@ 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.
|
||||
Items are often also called 'products' but are named 'items' internally due to historic reasons.
|
||||
|
||||
:param event: The event this belongs to.
|
||||
:param event: The event this item belongs to
|
||||
:type event: Event
|
||||
:param category: The category this belongs to. May be null.
|
||||
:type category: ItemCategory
|
||||
:param name: The name of this item:
|
||||
:param name: The name of this item
|
||||
:type name: str
|
||||
:param active: Whether this item is being sold
|
||||
:param active: Whether this item is being sold.
|
||||
:type active: bool
|
||||
:param description: A short description
|
||||
:type description: str
|
||||
@@ -97,7 +97,7 @@ class Item(LoggedModel):
|
||||
:type tax_rate: decimal.Decimal
|
||||
:param admission: ``True``, if this item allows persons to enter the event (as opposed to e.g. merchandise)
|
||||
:type admission: bool
|
||||
:param picture: A product picture to be shown next to the product description.
|
||||
:param picture: A product picture to be shown next to the product description
|
||||
:type picture: File
|
||||
:param available_from: The date this product goes on sale
|
||||
:type available_from: datetime
|
||||
@@ -235,7 +235,8 @@ class ItemVariation(models.Model):
|
||||
:param item: The item this variation belongs to
|
||||
:type item: Item
|
||||
:param value: A string defining this variation
|
||||
:param active: Whether this value is to be sold.
|
||||
:type value: str
|
||||
:param active: Whether this variation is being sold.
|
||||
:type active: bool
|
||||
:param default_price: This variation's default price
|
||||
:type default_price: decimal.Decimal
|
||||
@@ -299,7 +300,7 @@ class ItemVariation(models.Model):
|
||||
class Question(LoggedModel):
|
||||
"""
|
||||
A question is an input field that can be used to extend a ticket
|
||||
by custom information, e.g. "Attendee age". A question can allow one o several
|
||||
by custom information, e.g. "Attendee age". A question can allow one of several
|
||||
input types, currently:
|
||||
|
||||
* a number (``TYPE_NUMBER``)
|
||||
@@ -387,11 +388,11 @@ class Quota(LoggedModel):
|
||||
"""
|
||||
A quota is a "pool of tickets". It is there to limit the number of items
|
||||
of a certain type to be sold. For example, you could have a quota of 500
|
||||
applied to all your items (because you only have that much space in your
|
||||
building), and also a quota of 100 applied to the VIP tickets for
|
||||
exclusivity. In this case, no more than 500 tickets will be sold in total
|
||||
and no more than 100 of them will be VIP tickets (but 450 normal and 50
|
||||
VIP tickets will be fine).
|
||||
applied to all of your items (because you only have that much space in your
|
||||
venue), and also a quota of 100 applied to the VIP tickets for exclusivity.
|
||||
In this case, no more than 500 tickets will be sold in total and no more
|
||||
than 100 of them will be VIP tickets (but 450 normal and 50 VIP tickets
|
||||
will be fine).
|
||||
|
||||
As always, a quota can not only be tied to an item, but also to specific
|
||||
variations.
|
||||
@@ -400,19 +401,19 @@ class Quota(LoggedModel):
|
||||
anything with quotas. This might confuse you otherwise.
|
||||
http://docs.pretix.eu/en/latest/development/concepts.html#restriction-by-number
|
||||
|
||||
The AVAILABILITY_* constants represent various states of an quota allowing
|
||||
its items/variations being for sale.
|
||||
The AVAILABILITY_* constants represent various states of a quota allowing
|
||||
its items/variations to be up for sale.
|
||||
|
||||
AVAILABILITY_OK
|
||||
This item is available for sale.
|
||||
|
||||
AVAILABILITY_RESERVED
|
||||
This item is currently not available for sale, because all available
|
||||
This item is currently not available for sale because all available
|
||||
items are in people's shopping carts. It might become available
|
||||
again if those people do not proceed with checkout.
|
||||
again if those people do not proceed to the checkout.
|
||||
|
||||
AVAILABILITY_ORDERED
|
||||
This item is currently not availalbe for sale, because all available
|
||||
This item is currently not availalbe for sale because all available
|
||||
items are ordered. It might become available again if those people
|
||||
do not pay.
|
||||
|
||||
@@ -422,7 +423,7 @@ class Quota(LoggedModel):
|
||||
:param event: The event this belongs to
|
||||
:type event: Event
|
||||
:param name: This quota's name
|
||||
:type str:
|
||||
:type name: str
|
||||
:param size: The number of items in this quota
|
||||
:type size: int
|
||||
:param items: The set of :py:class:`Item` objects this quota applies to
|
||||
|
||||
@@ -10,12 +10,13 @@ class LogEntry(models.Model):
|
||||
relation to an arbitrary database object.
|
||||
|
||||
:param datatime: The timestamp of the logged action
|
||||
:type datetime: datetime
|
||||
:param user: The user that performed the action
|
||||
:type user: User
|
||||
:param action_type: The type of action that has been performed. This is
|
||||
used to look up the renderer used to describe the action in a human-
|
||||
readable way. This should be some namespaced value using dotted
|
||||
notationto avaoid duplicates, e.g.
|
||||
notation to avoid duplicates, e.g.
|
||||
``"pretix.plugins.banktransfer.incoming_transfer"``.
|
||||
:type action_type: str
|
||||
:param data: Arbitrary data that can be used by the log action renderer
|
||||
|
||||
@@ -27,17 +27,18 @@ def generate_position_secret():
|
||||
class Order(LoggedModel):
|
||||
"""
|
||||
An order is created when a user clicks 'buy' on his cart. It holds
|
||||
several OrderPositions and is connected to an user. It has an
|
||||
several OrderPositions and is connected to a user. It has an
|
||||
expiration date: If items run out of capacity, orders which are over
|
||||
their expiration date might be cancelled.
|
||||
|
||||
An order -- like all objects -- has an ID, which is globally unique,
|
||||
but also a code, which is shorter and easier to memorize, but only
|
||||
unique among a single conference.
|
||||
unique within a single conference.
|
||||
|
||||
:param code: In addition to the ID, which is globally unique, every
|
||||
order has an order code, which is shorter and easier to
|
||||
memorize, but is only unique among a single conference.
|
||||
memorize, but is only unique within a single conference.
|
||||
:type code: str
|
||||
:param status: The status of this order. One of:
|
||||
|
||||
* ``STATUS_PENDING``
|
||||
@@ -46,7 +47,7 @@ class Order(LoggedModel):
|
||||
* ``STATUS_CANCELLED``
|
||||
* ``STATUS_REFUNDED``
|
||||
|
||||
:param event: The event this belongs to
|
||||
:param event: The event this order belongs to
|
||||
:type event: Event
|
||||
:param email: The email of the person who ordered this
|
||||
:type email: str
|
||||
@@ -56,15 +57,15 @@ class Order(LoggedModel):
|
||||
:type secret: str
|
||||
:param datetime: The datetime of the order placement
|
||||
:type datetime: datetime
|
||||
:param expires: The date until this order has to be paid to guarantee the
|
||||
:param expires: The date until this order has to be paid to guarantee the fulfillment
|
||||
:type expires: datetime
|
||||
:param payment_date: The date of the payment completion (null, if not yet paid).
|
||||
:param payment_date: The date of the payment completion (null if not yet paid)
|
||||
:type payment_date: datetime
|
||||
:param payment_provider: The payment provider selected by the user
|
||||
:type payment_provider: str
|
||||
:param payment_fee: The payment fee calculated at checkout time
|
||||
:type payment_fee: decimal.Decimal
|
||||
:param payment_fee_tax_value: The absolute amound of tax included in the payment fee
|
||||
:param payment_fee_tax_value: The absolute amount of tax included in the payment fee
|
||||
:type payment_fee_tax_value: decimal.Decimal
|
||||
:param payment_fee_tax_rate: The tax rate applied to the payment fee (in percent)
|
||||
:type payment_fee_tax_rate: decimal.Decimal
|
||||
@@ -161,7 +162,7 @@ class Order(LoggedModel):
|
||||
@property
|
||||
def full_code(self):
|
||||
"""
|
||||
A order code which is unique among all events of a single organizer,
|
||||
An order code which is unique among all events of a single organizer,
|
||||
built by contatenating the event slug and the order code.
|
||||
"""
|
||||
return self.event.slug.upper() + self.code
|
||||
@@ -198,9 +199,9 @@ class Order(LoggedModel):
|
||||
@property
|
||||
def can_modify_answers(self) -> bool:
|
||||
"""
|
||||
Is ``True`` if the user can change the question answers / attendee names that are
|
||||
``True`` if the user can change the question answers / attendee names that are
|
||||
related to the order. This checks order status and modification deadlines. It also
|
||||
returns ``False``, if there are no questions that can be answered.
|
||||
returns ``False`` if there are no questions that can be answered.
|
||||
"""
|
||||
if self.status not in (Order.STATUS_PENDING, Order.STATUS_PAID, Order.STATUS_EXPIRED):
|
||||
return False
|
||||
@@ -323,7 +324,7 @@ class AbstractPosition(models.Model):
|
||||
|
||||
:param item: The selected item
|
||||
:type item: Item
|
||||
:param variation: The selected ItemVariation or null, if the item has no properties
|
||||
:param variation: The selected ItemVariation or null, if the item has no variations
|
||||
:type variation: ItemVariation
|
||||
:param datetime: The datetime this item was put into the cart
|
||||
:type datetime: datetime
|
||||
@@ -404,11 +405,11 @@ class AbstractPosition(models.Model):
|
||||
|
||||
class OrderPosition(AbstractPosition):
|
||||
"""
|
||||
An OrderPosition is one line of an order, representing one ordered items
|
||||
An OrderPosition is one line of an order, representing one ordered item
|
||||
of a specified type (or variation). This has all properties of
|
||||
AbstractPosition.
|
||||
|
||||
:param order: The order this is a part of
|
||||
:param order: The order this position is a part of
|
||||
:type order: Order
|
||||
"""
|
||||
order = models.ForeignKey(
|
||||
@@ -470,7 +471,7 @@ class OrderPosition(AbstractPosition):
|
||||
|
||||
class CartPosition(AbstractPosition):
|
||||
"""
|
||||
A cart position is similar to a order line, except that it is not
|
||||
A cart position is similar to an order line, except that it is not
|
||||
yet part of a binding order but just placed by some user in his or
|
||||
her cart. It therefore normally has a much shorter expiration time
|
||||
than an ordered position, but still blocks an item in the quota pool
|
||||
|
||||
@@ -73,7 +73,7 @@ class Organizer(LoggedModel):
|
||||
|
||||
class OrganizerPermission(models.Model):
|
||||
"""
|
||||
The relation between an Organizer and an User who has permissions to
|
||||
The relation between an Organizer and a User who has permissions to
|
||||
access an organizer profile.
|
||||
|
||||
:param organizer: The organizer this relation refers to
|
||||
|
||||
@@ -21,23 +21,33 @@ def generate_code():
|
||||
|
||||
class Voucher(LoggedModel):
|
||||
"""
|
||||
Represents a voucher. A voucher can reserve ticket quota or allow special prices.
|
||||
A Voucher can reserve ticket quota or allow special prices.
|
||||
|
||||
:param event: The event this voucher is valid for
|
||||
:type event: Event
|
||||
:param code: The secret voucher code
|
||||
:type code: str
|
||||
:param redeemed: Whether or not this voucher has already been redeemed
|
||||
:type redeemed: bool
|
||||
:param valid_until: The expiration date of this voucher (optional)
|
||||
:type valid_until: datetime
|
||||
:param block_quota: If set to true, this voucher will reserve quota for its holder
|
||||
:type block_quota: bool
|
||||
:param allow_ignore_quota: If set to true, this voucher can be redeemed even if the event is sold out
|
||||
:type allow_ignore_quota: bool
|
||||
:param price: If set, the voucher will allow the sale of associated items for this price
|
||||
:type price: decimal.Decimal
|
||||
:param item: If set, the item to sell
|
||||
:type item: Item
|
||||
:param variation: If set, the variation to sell
|
||||
:type variation: ItemVariation
|
||||
:param quota: If set, the quota to choose an item from
|
||||
:type quota: Quota
|
||||
|
||||
Various constraints apply:
|
||||
|
||||
* You can either select a quota or an item and you need to select one of those
|
||||
* If you select an item that as variations but not select a variation, you cannot set block_quota
|
||||
* You need to either select a quota or an item
|
||||
* If you select an item that has variations but do not select a variation, you cannot set block_quota
|
||||
"""
|
||||
event = models.ForeignKey(
|
||||
Event,
|
||||
|
||||
@@ -35,7 +35,7 @@ class BasePaymentProvider:
|
||||
@property
|
||||
def is_enabled(self) -> bool:
|
||||
"""
|
||||
Returns, whether or whether not this payment provider is enabled.
|
||||
Returns whether or whether not this payment provider is enabled.
|
||||
By default, this is determined by the value of the ``_enabled`` setting.
|
||||
"""
|
||||
return self.settings.get('_enabled', as_type=bool)
|
||||
@@ -78,7 +78,7 @@ class BasePaymentProvider:
|
||||
@property
|
||||
def settings_form_fields(self) -> dict:
|
||||
"""
|
||||
When the event's administrator administrator visits the event configuration
|
||||
When the event's administrator visits the event configuration
|
||||
page, this method is called to return the configuration fields available.
|
||||
|
||||
It should therefore return a dictionary where the keys should be (unprefixed)
|
||||
@@ -138,7 +138,7 @@ class BasePaymentProvider:
|
||||
|
||||
def settings_content_render(self, request: HttpRequest) -> str:
|
||||
"""
|
||||
When the event's administrator administrator visits the event configuration
|
||||
When the event's administrator visits the event configuration
|
||||
page, this method is called. It may return HTML containing additional information
|
||||
that is displayed below the form fields configured in ``settings_form_fields``.
|
||||
"""
|
||||
@@ -188,12 +188,12 @@ class BasePaymentProvider:
|
||||
def payment_form_render(self, request: HttpRequest) -> str:
|
||||
"""
|
||||
When the user selects this provider as his prefered payment method,
|
||||
he will be shown the HTML you return from this method.
|
||||
they will be shown the HTML you return from this method.
|
||||
|
||||
The default implementation will call :py:meth:`checkout_form`
|
||||
and render the returned form. If your payment method doesn't require
|
||||
the user to fill out form fields, you should just return a paragraph
|
||||
of explainatory text.
|
||||
of explanatory text.
|
||||
"""
|
||||
form = self.payment_form(request)
|
||||
template = get_template('pretixpresale/event/checkout_payment_form_default.html')
|
||||
@@ -202,25 +202,25 @@ class BasePaymentProvider:
|
||||
|
||||
def checkout_confirm_render(self, request) -> str:
|
||||
"""
|
||||
If the user successfully filled in his payment data, he will be redirected
|
||||
If the user has successfully filled in his payment data, they will be redirected
|
||||
to a confirmation page which lists all details of his order for a final review.
|
||||
This method should return the HTML which should be displayed inside the
|
||||
'Payment' box on this page.
|
||||
|
||||
In most cases, this should include a short summary of the user's input and
|
||||
a short explaination on how the payment process will continue.
|
||||
a short explanation on how the payment process will continue.
|
||||
"""
|
||||
raise NotImplementedError() # NOQA
|
||||
|
||||
def checkout_prepare(self, request: HttpRequest, cart: Dict[str, Any]) -> "bool|str":
|
||||
"""
|
||||
Will be called after the user selected this provider as his payment method.
|
||||
Will be called after the user selects this provider as his payment method.
|
||||
If you provided a form to the user to enter payment data, this method should
|
||||
at least store the user's input into his session.
|
||||
|
||||
This method should return ``False``, if the user's input was invalid, ``True``
|
||||
This method should return ``False`` if the user's input was invalid, ``True``
|
||||
if the input was valid and the frontend should continue with default behaviour
|
||||
or a string containing an URL, if the user should be redirected somewhere else.
|
||||
or a string containing a URL if the user should be redirected somewhere else.
|
||||
|
||||
On errors, you should use Django's message framework to display an error message
|
||||
to the user (or the normal form validation error messages).
|
||||
@@ -261,17 +261,17 @@ class BasePaymentProvider:
|
||||
def payment_is_valid_session(self, request: HttpRequest) -> bool:
|
||||
"""
|
||||
This is called at the time the user tries to place the order. It should return
|
||||
``True``, if the user's session is valid and all data your payment provider requires
|
||||
``True`` if the user's session is valid and all data your payment provider requires
|
||||
in future steps is present.
|
||||
"""
|
||||
raise NotImplementedError() # NOQA
|
||||
|
||||
def payment_perform(self, request: HttpRequest, order: Order) -> str:
|
||||
"""
|
||||
After the user confirmed his purchase, this method will be called to complete
|
||||
the payment process. This is the place to actually move the money, if applicable.
|
||||
After the user has confirmed their purchase, this method will be called to complete
|
||||
the payment process. This is the place to actually move the money if applicable.
|
||||
If you need any special behaviour, you can return a string
|
||||
containing an URL the user will be redirected to. If you are done with your process
|
||||
containing the URL the user will be redirected to. If you are done with your process
|
||||
you should return the user to the order's detail page.
|
||||
|
||||
If the payment is completed, you should call ``pretix.base.services.orders.mark_order_paid(order, provider, info)``
|
||||
@@ -293,9 +293,9 @@ class BasePaymentProvider:
|
||||
|
||||
def order_pending_mail_render(self, order: Order) -> str:
|
||||
"""
|
||||
After the user submitted his order, he or she will receive a confirmation
|
||||
e-mail. You can return a string from this method if you want to add additional
|
||||
information to this e-mail.
|
||||
After the user has submitted their order, they will receive a confirmation
|
||||
email. You can return a string from this method if you want to add additional
|
||||
information to this email.
|
||||
|
||||
:param order: The order object
|
||||
"""
|
||||
@@ -342,7 +342,7 @@ class BasePaymentProvider:
|
||||
|
||||
def order_paid_render(self, request: HttpRequest, order: Order) -> str:
|
||||
"""
|
||||
Will be called if the user views the detail page of an paid order which is
|
||||
Will be called if the user views the detail page of a paid order which is
|
||||
associated with this payment provider.
|
||||
|
||||
It should return HTML code which should be displayed to the user or None,
|
||||
@@ -385,14 +385,14 @@ class BasePaymentProvider:
|
||||
"""
|
||||
Will be called if the event administrator confirms the refund.
|
||||
|
||||
This should transfer the money back (if possible). You can return an URL the
|
||||
This should transfer the money back (if possible). You can return the URL the
|
||||
user should be redirected to if you need special behaviour or None to continue
|
||||
with default behaviour.
|
||||
|
||||
On failure, you should use Django's message framework to display an error message
|
||||
to the user.
|
||||
|
||||
The default implementation sets the Orders state to refunded and shows a success
|
||||
The default implementation sets the Order's state to refunded and shows a success
|
||||
message.
|
||||
|
||||
:param request: The HTTP request
|
||||
@@ -446,14 +446,14 @@ class FreeOrderProvider(BasePaymentProvider):
|
||||
"""
|
||||
Will be called if the event administrator confirms the refund.
|
||||
|
||||
This should transfer the money back (if possible). You can return an URL the
|
||||
This should transfer the money back (if possible). You can return the URL the
|
||||
user should be redirected to if you need special behaviour or None to continue
|
||||
with default behaviour.
|
||||
|
||||
On failure, you should use Django's message framework to display an error message
|
||||
to the user.
|
||||
|
||||
The default implementation sets the Orders state to refunded and shows a success
|
||||
The default implementation sets the Order's state to refunded and shows a success
|
||||
message.
|
||||
|
||||
:param request: The HTTP request
|
||||
|
||||
@@ -23,24 +23,24 @@ def mail(email: str, subject: str, template: str,
|
||||
"""
|
||||
Sends out an email to a user. The mail will be sent synchronously or asynchronously depending on the installation.
|
||||
|
||||
:param email: The e-mail address of the recipient.
|
||||
:param email: The email address of the recipient
|
||||
|
||||
:param subject: The e-mail subject. Should be localized to the recipients's locale or a lazy object that will be
|
||||
:param subject: The email subject. Should be localized to the recipients's locale or a lazy object that will be
|
||||
localized by being casted to a string.
|
||||
|
||||
:param template: The filename of a template to be used. It will be rendered with the locale given in the locale
|
||||
argument and the context given in the next argument. Alternatively, you can pass a LazyI18nString and
|
||||
``context`` will be used as the argument to a Python ``.format()`` call on the template.
|
||||
|
||||
:param context: The context for rendering the template (see ``template`` parameter).
|
||||
:param context: The context for rendering the template (see ``template`` parameter)
|
||||
|
||||
:param event: The event this email is related to (optional). If set, this will be used to determine the sender,
|
||||
a possible prefix for the subject and the SMTP server that should be used to send this email.
|
||||
|
||||
:param locale: The locale to be used while evaluating the subject and the template.
|
||||
:param locale: The locale to be used while evaluating the subject and the template
|
||||
|
||||
:return: ``False`` on obvious, immediate failures, ``True`` otherwise. ``True`` does not necessarily mean that
|
||||
the email has been sent, just that it has been queued by the e-mail backend.
|
||||
the email has been sent, just that it has been queued by the email backend.
|
||||
"""
|
||||
with language(locale):
|
||||
if isinstance(template, LazyI18nString):
|
||||
@@ -61,7 +61,7 @@ def mail(email: str, subject: str, template: str,
|
||||
|
||||
body += "\r\n\r\n----\r\n"
|
||||
body += _(
|
||||
"You are receiving this e-mail because you placed an order for {event}."
|
||||
"You are receiving this email because you placed an order for {event}."
|
||||
).format(event=event.name)
|
||||
body += "\r\n"
|
||||
return mail_send([email], subject, body, sender, event.id if event else None)
|
||||
@@ -79,7 +79,7 @@ def mail_send(to: str, subject: str, body: str, sender: str, event: int=None) ->
|
||||
backend.send_messages([email])
|
||||
return True
|
||||
except Exception:
|
||||
logger.exception('Error sending e-mail')
|
||||
logger.exception('Error sending email')
|
||||
return False
|
||||
|
||||
|
||||
|
||||
@@ -115,6 +115,6 @@ periodic_task = django.dispatch.Signal()
|
||||
This is a regular django signal (no pretix event signal) that we send out every
|
||||
time the periodic task cronjob runs. This interval is not sharply defined, it can
|
||||
be everything between a minute and a day. The actions you perform should be
|
||||
idempotent, i.e. it should not make a difference if this is send out more often
|
||||
idempotent, i.e. it should not make a difference if this is sent out more often
|
||||
than expected.
|
||||
"""
|
||||
|
||||
@@ -24,7 +24,7 @@ class BaseTicketOutput:
|
||||
@property
|
||||
def is_enabled(self) -> bool:
|
||||
"""
|
||||
Returns, whether or whether not this output is enabled.
|
||||
Returns whether or whether not this output is enabled.
|
||||
By default, this is determined by the value of the ``_enabled`` setting.
|
||||
"""
|
||||
return self.settings.get('_enabled', as_type=bool)
|
||||
@@ -57,7 +57,7 @@ class BaseTicketOutput:
|
||||
@property
|
||||
def settings_form_fields(self) -> dict:
|
||||
"""
|
||||
When the event's administrator administrator visits the event configuration
|
||||
When the event's administrator visits the event configuration
|
||||
page, this method is called to return the configuration fields available.
|
||||
|
||||
It should therefore return a dictionary where the keys should be (unprefixed)
|
||||
@@ -95,7 +95,7 @@ class BaseTicketOutput:
|
||||
|
||||
def settings_content_render(self, request: HttpRequest) -> str:
|
||||
"""
|
||||
When the event's administrator administrator visits the event configuration
|
||||
When the event's administrator visits the event configuration
|
||||
page, this method is called. It may return HTML containing additional information
|
||||
that is displayed below the form fields configured in ``settings_form_fields``.
|
||||
"""
|
||||
|
||||
@@ -276,7 +276,7 @@ class MailSettingsForm(SettingsForm):
|
||||
)
|
||||
mail_from = forms.EmailField(
|
||||
label=_("Sender address"),
|
||||
help_text=_("Sender address for outgoing e-mails")
|
||||
help_text=_("Sender address for outgoing emails")
|
||||
)
|
||||
mail_text_order_placed = I18nFormField(
|
||||
label=_("Placed order"),
|
||||
|
||||
@@ -17,8 +17,8 @@ html_head = EventPluginSignal(
|
||||
)
|
||||
"""
|
||||
This signal allows you to put code inside the HTML ``<head>`` tag
|
||||
of every page in the backend. You will get the request as a keyword argument
|
||||
``request`` and can return plain HTML.
|
||||
of every page in the backend. You will get the request as the keyword argument
|
||||
``request`` and are expected to return plain HTML.
|
||||
|
||||
As with all plugin signals, the ``sender`` keyword argument will contain the event.
|
||||
"""
|
||||
@@ -46,7 +46,7 @@ event_dashboard_widgets = EventPluginSignal(
|
||||
providing_args=[]
|
||||
)
|
||||
"""
|
||||
This signal is sent out to include widgets to the event dashboard. Receivers
|
||||
This signal is sent out to include widgets in the event dashboard. Receivers
|
||||
should return a list of dictionaries, where each dictionary can have the keys:
|
||||
|
||||
* content (str, containing HTML)
|
||||
@@ -62,7 +62,7 @@ user_dashboard_widgets = Signal(
|
||||
providing_args=['user']
|
||||
)
|
||||
"""
|
||||
This signal is sent out to include widgets to the personal user dashboard. Receivers
|
||||
This signal is sent out to include widgets in the personal user dashboard. Receivers
|
||||
should return a list of dictionaries, where each dictionary can have the keys:
|
||||
|
||||
* content (str, containing HTML)
|
||||
@@ -90,7 +90,7 @@ voucher_form_class = EventPluginSignal(
|
||||
"""
|
||||
This signal allows you to replace the form class that is used for modifying vouchers.
|
||||
You will receive the default form class (or the class set by a previous plugin) in the
|
||||
``cls`` argument such that you can inherit from it.
|
||||
``cls`` argument so that you can inherit from it.
|
||||
|
||||
As with all plugin signals, the ``sender`` keyword argument will contain the event.
|
||||
"""
|
||||
|
||||
@@ -28,6 +28,7 @@ def eventreverse(obj, name, kwargs=None):
|
||||
|
||||
:param obj: An ``Event`` or ``Organizer`` object
|
||||
:param name: The name of the URL route
|
||||
:type name: str
|
||||
:param kwargs: A dictionary of additional keyword arguments that should be used. You do not
|
||||
need to provide the organizer or event slug here, it will be added automatically as
|
||||
needed.
|
||||
|
||||
@@ -178,12 +178,12 @@ class QuestionsStep(QuestionsViewMixin, CartMixin, TemplateFlowStep):
|
||||
emailval = EmailValidator()
|
||||
if 'email' not in request.session:
|
||||
if warn:
|
||||
messages.warning(request, _('Please enter a valid e-mail address.'))
|
||||
messages.warning(request, _('Please enter a valid email address.'))
|
||||
return False
|
||||
emailval(request.session.get('email'))
|
||||
except ValidationError:
|
||||
if warn:
|
||||
messages.warning(request, _('Please enter a valid e-mail address.'))
|
||||
messages.warning(request, _('Please enter a valid email address.'))
|
||||
return False
|
||||
|
||||
for cp in self.positions:
|
||||
|
||||
@@ -5,8 +5,8 @@ html_head = EventPluginSignal(
|
||||
)
|
||||
"""
|
||||
This signal allows you to put code inside the HTML ``<head>`` tag
|
||||
of every page in the frontend. You will get the request as a keyword argument
|
||||
``request`` and can return plain HTML.
|
||||
of every page in the frontend. You will get the request as the keyword argument
|
||||
``request`` and are expected to return plain HTML.
|
||||
|
||||
As with all plugin signals, the ``sender`` keyword argument will contain the event.
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user