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
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user