pizzas package

Submodules

pizzas.admin module

Registers admin interfaces for the pizzas module

class pizzas.admin.OrderAdmin(model, admin_site)[source]

Bases: utils.admin.DoNextModelAdmin

Manage the orders

exclude = ('payment',)
has_change_permission(request, order=None)[source]

Only give change permission if the user is an organiser

has_delete_permission(request, order=None)[source]

Only give delete permission if the user is an organiser

has_view_permission(request, order=None)[source]

Only give view permission if the user is an organiser

list_display = ('pizza_event', 'member_first_name', 'member_last_name', 'product', 'payment')
property media
save_model(request, obj, form, change)[source]

You can only save the orders if you have permission

class pizzas.admin.PizzaEventAdmin(model, admin_site)[source]

Bases: django.contrib.admin.options.ModelAdmin

Manage the pizza events

autocomplete_fields = ('event',)
date_hierarchy = 'start'
exclude = ('end_reminder',)
get_urls()[source]
has_change_permission(request, obj=None)[source]

Only allow access to the change form if the user is an organiser

has_delete_permission(request, obj=None)[source]

Only allow access to delete if the user is an organiser

list_display = ('title', 'start', 'end', 'notification_enabled', 'orders')
property media
notification_enabled(obj)[source]
orders(obj)[source]
search_fields = ['event__title_en', 'event__title_nl']
class pizzas.admin.ProductAdmin(model, admin_site)[source]

Bases: django.contrib.admin.options.ModelAdmin

Manage the products

list_display = ('name', 'price', 'available')
list_filter = ('available', 'restricted')
property media
search_fields = ('name',)

pizzas.admin_views module

Admin views provided by the pizzas package

class pizzas.admin_views.PizzaOrderDetails(**kwargs)[source]

Bases: django.views.generic.base.TemplateView

admin = None
dispatch(request, *args, **kwargs)
get_context_data(**kwargs)[source]
template_name = 'pizzas/admin/orders.html'
class pizzas.admin_views.PizzaOrderSummary(**kwargs)[source]

Bases: django.views.generic.base.TemplateView

admin = None
dispatch(request, *args, **kwargs)
get_context_data(**kwargs)[source]
template_name = 'pizzas/admin/summary.html'

pizzas.apps module

Configuration for the pizzas package

class pizzas.apps.PizzasConfig(app_name, app_module)[source]

Bases: django.apps.config.AppConfig

AppConfig for the pizzas package

name = 'pizzas'
ready()[source]

Imports the signals when the app is ready

verbose_name = 'Pizzas'

pizzas.decorators module

The decorators defined by the pizzas package

class pizzas.decorators.OrganiserOnly(view_function)[source]

Bases: object

Decorator that denies access to the page if: 1. There is no pk in the request 2. The specified pizza event does not exist 3. The user is no organiser of the specified pizza event

pizzas.decorators.organiser_only(view_function)[source]

See OrganiserOnly

pizzas.models module

The models defined by the pizzas package

class pizzas.models.AvailableProductManager(*args, **kwargs)[source]

Bases: django.db.models.manager.Manager

Only shows available products

get_queryset()[source]

Return a new QuerySet object. Subclasses can override this method to customize the behavior of the Manager.

class pizzas.models.Order(*args, **kwargs)[source]

Bases: django.db.models.base.Model, payments.models.Payable

Describes an order of an item during an event

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

property can_be_changed
clean()[source]

Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.

id

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

member

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.

property member_first_name
member_id
property member_last_name
property member_name
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>
payment

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

property payment_amount
payment_id
property payment_notes
property payment_payer
property payment_topic
pizza_event

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.

pizza_event_id
product

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.

product_id
class pizzas.models.PizzaEvent(*args, **kwargs)[source]

Bases: django.db.models.base.Model

Describes an event where pizzas can be ordered

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

clean()[source]

Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.

classmethod current()[source]

Get the currently relevant pizza event: the first one that starts within 8 hours from now.

delete(using=None, keep_parents=False)[source]
end

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

end_reminder

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

end_reminder_id
event

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

event_id
get_next_by_end(*, field=<django.db.models.fields.DateTimeField: end>, is_next=True, **kwargs)
get_next_by_start(*, field=<django.db.models.fields.DateTimeField: start>, is_next=True, **kwargs)
get_previous_by_end(*, field=<django.db.models.fields.DateTimeField: end>, is_next=False, **kwargs)
get_previous_by_start(*, field=<django.db.models.fields.DateTimeField: start>, is_next=False, **kwargs)
property has_ended
id

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

property in_the_future
property just_ended
objects = <django.db.models.manager.Manager object>
order_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

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

Parent.children is a ReverseManyToOneDescriptor instance.

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

save(*args, **kwargs)[source]

Save the current instance. Override this in a subclass if you want to control the saving process.

The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

send_notification

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

start

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

property title
validate_unique(exclude=None)[source]

Check unique constraints on the model and raise ValidationError if any failed.

class pizzas.models.Product(*args, **kwargs)[source]

Bases: django.db.models.base.Model

Describes a product

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

available

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

available_products = <pizzas.models.AvailableProductManager object>
property description

Accessor that fetches the localized variant of description

description_en

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

description_nl

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

id

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>
order_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

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

Parent.children is a ReverseManyToOneDescriptor instance.

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

price

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

restricted

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

pizzas.services module

pizzas.services.can_change_order(member, pizza_event)[source]

Determine if a certain member can edit orders of an event :param member: Member who wants to change and order :param pizza_event: The event for which we want to change an order :return: True if we can change an order else False

pizzas.services.gen_stats_current_pizza_orders()[source]

Generate statistics about number of orders per product of the active pizza event :return: Dict with key, value being resp. name, order count of a product.

pizzas.services.gen_stats_pizza_orders()[source]

Generate statistics about number of orders per product :return: Dict with key, value being resp. name, order count of a product.

pizzas.signals module

The signals checked by the pizzas package

pizzas.signals.post_registration_save(sender, instance, **kwargs)[source]

Update members on pizza reminder notification

pizzas.signals.pre_order_delete(sender, instance, **kwargs)[source]

Re-add user to reminder to on order deletion

pizzas.signals.pre_order_save(sender, instance, **kwargs)[source]

Remove user from the order reminder when saved

pizzas.urls module

The routes defined by this package

pizzas.views module

Views provided by the pizzas package

pizzas.views.cancel_order(request)[source]

View that cancels a user’s order

pizzas.views.index(request)[source]

Overview of user order for a pizza event

pizzas.views.order(request)[source]

View that shows the detail of the current order

pizzas.views.pay_order(request)[source]

View that marks the order as paid using Thalia Pay