django_program.registration.conditions

Discount and condition engine for conference registration.

Architecture

This module implements a composable condition/discount system that controls product eligibility and automatic price reductions. It replaces symposion’s InheritanceManager-based approach with a cleaner abstract-base + concrete-model pattern.

Design decisions:

  1. Abstract bases, concrete conditions. ConditionBase and DiscountEffect are abstract Django models. Each concrete condition (e.g. SpeakerCondition) inherits both and lives in its own database table. No InheritanceManager, no polymorphic queries on a shared table.

  2. Evaluation via ``ConditionEvaluator`` service. The evaluator queries each concrete condition table in priority order, checks evaluate() against the current user/conference context, then calls calculate_discount() for matching items. This keeps model code thin and orchestration testable.

  3. Priority-based, first-match-per-item. Conditions are ordered by priority (lower = first). For each cart item, the first matching condition wins unless the engine is explicitly configured for stacking (future work).

  4. Condition discounts apply before voucher discounts. The cart pricing pipeline applies condition-based discounts first, then voucher discounts on the remainder.

  5. Admin-friendly. Each condition type has its own ModelAdmin with relevant filters and M2M widgets.

Condition types

  • TimeOrStockLimitCondition – active within a time window and/or stock cap.

  • SpeakerCondition – auto-applies to users linked to a Pretalx Speaker.

  • GroupMemberCondition – applies to members of specified Django auth groups.

  • IncludedProductCondition – unlocks when user has purchased enabling products.

  • DiscountForProduct – direct discount on specific products (time/stock limited).

  • DiscountForCategory – percentage discount on ticket types and/or add-ons.

Classes

ConditionBase

Abstract base for all conditions that gate product eligibility or discounts.

DiscountEffect

Abstract base for discount effects that reduce price.

DiscountForCategory

Percentage discount on all products in specified categories.

DiscountForProduct

Direct discount on specific products, optionally time/stock limited.

GroupMemberCondition

Applies to members of specific Django auth groups.

IncludedProductCondition

Unlocks discount on target products when user has purchased enabling products.

SpeakerCondition

Auto-applies to users linked to a Pretalx Speaker.

TimeOrStockLimitCondition

Condition met when within a time window and/or stock limit.

class django_program.registration.conditions.ConditionBase[source]

Bases: Model

Abstract base for all conditions that gate product eligibility or discounts.

Subclasses implement evaluate() to determine whether the condition is met for a given user in a conference context.

conference

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

description

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

is_active

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

priority

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

created_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

updated_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class Meta[source]

Bases: object

abstract = False
ordering = ['priority', 'name']
conference_id
get_next_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=True, **kwargs)
get_next_by_updated_at(*, field=<django.db.models.fields.DateTimeField: updated_at>, is_next=True, **kwargs)
get_previous_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=False, **kwargs)
get_previous_by_updated_at(*, field=<django.db.models.fields.DateTimeField: updated_at>, is_next=False, **kwargs)
class django_program.registration.conditions.DiscountEffect[source]

Bases: Model

Abstract base for discount effects that reduce price.

Provides the discount calculation logic shared by all condition types that can produce a price reduction.

class DiscountType[source]

Bases: TextChoices

The type of discount to apply.

PERCENTAGE = 'percentage'
FIXED_AMOUNT = 'fixed_amount'
__new__(value)
discount_type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

discount_value

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

max_quantity

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

applicable_ticket_types

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

applicable_addons

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

class Meta[source]

Bases: object

abstract = False
calculate_discount(unit_price, quantity)[source]

Calculate the discount amount for the given price and quantity.

Parameters:
  • unit_price (Decimal) – The per-unit price of the item.

  • quantity (int) – The number of items.

Return type:

Decimal

Returns:

The total discount amount (always non-negative).

get_discount_type_display(*, field=<django.db.models.fields.CharField: discount_type>)
class django_program.registration.conditions.TimeOrStockLimitCondition[source]

Bases: ConditionBase, DiscountEffect

Condition met when within a time window and/or stock limit.

Use this for early-bird discounts, flash sales, or any promotion with a defined start/end time and optional usage cap.

start_time

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

end_time

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

limit

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

times_used

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

evaluate(user, conference)[source]

Return True if within the time window and stock has not been exhausted.

Parameters:
  • user (auth.User) – The authenticated user (unused for this condition type).

  • conference (object) – The conference context (unused, already filtered by FK).

Return type:

bool

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

applicable_addons

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

applicable_ticket_types

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

conference

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

conference_id
created_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

description

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

discount_type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

discount_value

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_discount_type_display(*, field=<django.db.models.fields.CharField: discount_type>)
get_next_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=True, **kwargs)
get_next_by_updated_at(*, field=<django.db.models.fields.DateTimeField: updated_at>, is_next=True, **kwargs)
get_previous_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=False, **kwargs)
get_previous_by_updated_at(*, field=<django.db.models.fields.DateTimeField: updated_at>, is_next=False, **kwargs)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

is_active

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

max_quantity

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
priority

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

updated_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class django_program.registration.conditions.SpeakerCondition[source]

Bases: ConditionBase, DiscountEffect

Auto-applies to users linked to a Pretalx Speaker.

Checks whether the user has a Speaker record in the pretalx app for the same conference, optionally filtering by presenter/copresenter role.

is_presenter

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

is_copresenter

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

evaluate(user, conference)[source]

Return True if the user is linked to a Speaker for this conference.

Pretalx has no explicit primary/copresenter role, so any linked speaker qualifies when either flag is set. When both flags are True, any speaker qualifies. When only is_presenter is True, any speaker on at least one talk qualifies. When only is_copresenter is True, the speaker must appear on a talk with at least one other speaker.

Parameters:
  • user (auth.User) – The authenticated user to check.

  • conference (object) – The conference context.

Return type:

bool

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

applicable_addons

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

applicable_ticket_types

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

conference

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

conference_id
created_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

description

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

discount_type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

discount_value

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_discount_type_display(*, field=<django.db.models.fields.CharField: discount_type>)
get_next_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=True, **kwargs)
get_next_by_updated_at(*, field=<django.db.models.fields.DateTimeField: updated_at>, is_next=True, **kwargs)
get_previous_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=False, **kwargs)
get_previous_by_updated_at(*, field=<django.db.models.fields.DateTimeField: updated_at>, is_next=False, **kwargs)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

is_active

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

max_quantity

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
priority

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

updated_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class django_program.registration.conditions.GroupMemberCondition[source]

Bases: ConditionBase, DiscountEffect

Applies to members of specific Django auth groups.

Useful for staff discounts, volunteer pricing, or any role-based discount controlled via Django’s built-in group system.

groups

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

evaluate(user, conference)[source]

Return True if the user belongs to at least one of the configured groups.

Parameters:
  • user (auth.User) – The authenticated user to check.

  • conference (object) – The conference context (unused, already filtered by FK).

Return type:

bool

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

applicable_addons

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

applicable_ticket_types

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

conference

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

conference_id
created_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

description

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

discount_type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

discount_value

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_discount_type_display(*, field=<django.db.models.fields.CharField: discount_type>)
get_next_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=True, **kwargs)
get_next_by_updated_at(*, field=<django.db.models.fields.DateTimeField: updated_at>, is_next=True, **kwargs)
get_previous_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=False, **kwargs)
get_previous_by_updated_at(*, field=<django.db.models.fields.DateTimeField: updated_at>, is_next=False, **kwargs)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

is_active

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

max_quantity

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
priority

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

updated_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class django_program.registration.conditions.IncludedProductCondition[source]

Bases: ConditionBase, DiscountEffect

Unlocks discount on target products when user has purchased enabling products.

For example, purchasing a “Tutorial” ticket could unlock a discount on the “Tutorial Lunch” add-on.

enabling_ticket_types

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

evaluate(user, conference)[source]

Return True if the user has purchased at least one enabling ticket type.

Parameters:
  • user (auth.User) – The authenticated user to check.

  • conference (object) – The conference context.

Return type:

bool

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

applicable_addons

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

applicable_ticket_types

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

conference

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

conference_id
created_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

description

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

discount_type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

discount_value

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_discount_type_display(*, field=<django.db.models.fields.CharField: discount_type>)
get_next_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=True, **kwargs)
get_next_by_updated_at(*, field=<django.db.models.fields.DateTimeField: updated_at>, is_next=True, **kwargs)
get_previous_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=False, **kwargs)
get_previous_by_updated_at(*, field=<django.db.models.fields.DateTimeField: updated_at>, is_next=False, **kwargs)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

is_active

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

max_quantity

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
priority

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

updated_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class django_program.registration.conditions.DiscountForProduct[source]

Bases: ConditionBase, DiscountEffect

Direct discount on specific products, optionally time/stock limited.

Unlike other conditions, this evaluates to True for all users as long as the time window and stock limit are satisfied. Use applicable_ticket_types and applicable_addons to control which products receive the discount.

start_time

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

end_time

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

limit

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

times_used

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

evaluate(user, conference)[source]

Return True if within the time window and stock has not been exhausted.

Parameters:
  • user (auth.User) – The authenticated user (unused for product discounts).

  • conference (object) – The conference context (unused, already filtered by FK).

Return type:

bool

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

applicable_addons

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

applicable_ticket_types

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

conference

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

conference_id
created_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

description

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

discount_type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

discount_value

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_discount_type_display(*, field=<django.db.models.fields.CharField: discount_type>)
get_next_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=True, **kwargs)
get_next_by_updated_at(*, field=<django.db.models.fields.DateTimeField: updated_at>, is_next=True, **kwargs)
get_previous_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=False, **kwargs)
get_previous_by_updated_at(*, field=<django.db.models.fields.DateTimeField: updated_at>, is_next=False, **kwargs)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

is_active

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

max_quantity

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
priority

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

updated_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class django_program.registration.conditions.DiscountForCategory[source]

Bases: ConditionBase

Percentage discount on all products in specified categories.

Applies a flat percentage reduction to ticket types and/or add-ons for the conference. Does not use DiscountEffect because it uses its own simplified percentage-only calculation with category-level targeting.

percentage

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

apply_to_tickets

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

apply_to_addons

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

start_time

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

end_time

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

limit

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

times_used

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

evaluate(user, conference)[source]

Return True if within the time window and stock has not been exhausted.

Parameters:
  • user (auth.User) – The authenticated user (unused for category discounts).

  • conference (object) – The conference context (unused, already filtered by FK).

Return type:

bool

calculate_discount(unit_price, quantity)[source]

Calculate the percentage discount for the given price and quantity.

Parameters:
  • unit_price (Decimal) – The per-unit price of the item.

  • quantity (int) – The number of items.

Return type:

Decimal

Returns:

The total discount amount.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

conference

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

conference_id
created_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

description

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_next_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=True, **kwargs)
get_next_by_updated_at(*, field=<django.db.models.fields.DateTimeField: updated_at>, is_next=True, **kwargs)
get_previous_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=False, **kwargs)
get_previous_by_updated_at(*, field=<django.db.models.fields.DateTimeField: updated_at>, is_next=False, **kwargs)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

is_active

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
priority

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

updated_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.