@@ -40,118 +40,117 @@ class Command(BaseCommand):
Group,
("name", ),
name="Conference volunteers",
)
self.group_unpublish = self.find_or_make(
name="Can see unpublished products",
self.group_prepurchase = self.find_or_make(
name="Pre-purchase",
def populate_inventory(self):
# Categories
self.ticket = self.find_or_make(
inv.Category,
("name",),
name="Ticket",
description="Each type of ticket has different included products. "
"For details of what products are included, see our "
"<a href='https://linux.conf.au/attend/tickets/'>registration page</a>",
"<a href='https://linux.conf.au/attend/tickets/'>registration page</a>.",
required=True,
render_type=inv.Category.RENDER_TYPE_RADIO,
limit_per_user=1,
order=1,
self.terms = self.find_or_make(
name="Terms, Conditions, and Code of Conduct Acceptance",
description="I agree to the "
"<a href=\"https://linux.conf.au/attend/terms-and-conditions\"> "
"terms and conditions of attendance</a>, and I have read, "
"understood, and agree to act according to the standards set "
"forth in our <a href=\"https://linux.conf.au/attend/code-of-conduct\">"
"Code of Conduct</a>.",
render_type=inv.Category.RENDER_TYPE_CHECKBOX,
order=10,
self.penguin_dinner = self.find_or_make(
name="Penguin Dinner Ticket",
description="Tickets to our conference dinner on the evening of "
f"{settings.PENGUIN_DINNER_TICKET_DATE: %A %d %B}. "
"All attendees may purchase "
"seats at the dinner, even if a dinner ticket is not "
"included in your conference ticket price.",
required=False,
render_type=inv.Category.RENDER_TYPE_QUANTITY,
limit_per_user=10,
order=20,
self.speakers_dinner_ticket = self.find_or_make(
name="Speakers' Dinner Ticket",
description="Tickets to our exclusive Speakers' Dinner on the "
"evening of "
f"{settings.SPEAKER_DINNER_TICKET_DATE: %A %d %B}. "
"You may purchase up "
"to 5 tickets in total, for significant others and "
"family members.",
f"{settings.SPEAKER_DINNER_TICKET_DATE: %A %d %B}.",
limit_per_user=5,
order=30,
self.pdns_category = self.find_or_make(
name="Professional Delegates Networking Session Ticket",
description="Tickets to our Professional Delegates Networking session. "
"This event will be held on the evening of "
f"{settings.PDNS_TICKET_DATE: %A %d %B} "
"and is restricted to Professional Ticket "
"holders, speakers, miniconf organisers, and invited "
"guests.",
order=40,
self.t_shirt = self.find_or_make(
name="Shirt",
description="Commemorative conference polo shirts, featuring the "
f"linux.conf.au {settings.LCA_START.year} artwork.",
description="Commemorative conference shirts, featuring the "
f"linux.conf.au {settings.LCA_START.year} artwork. "
"View the <a href=\"https://linux.conf.au/attend/shirts\">"
"sizing guide</a>.",
render_type=inv.Category.RENDER_TYPE_ITEM_QUANTITY,
order=50,
# self.accommodation = self.find_or_make(
# inv.Category,
# ("name",),
# name="Accommodation at University of Tasmania",
# description="Accommodation at the University of Tasmania colleges "
# "and apartments. You can come back and book your "
# "accommodation at a later date, provided rooms remain "
# "available. Rooms may only be booked from Sunday 15 "
# "January--Saturday 21 January. If you wish to stay "
# "for only a part of the 6-day period, you must book "
# "accommodation for the full 6-day period. Rooms at "
# "other hotels, including Wrest Point can be booked "
# "elsewhere. For full details, see [LINK]our "
# "accommodation page.[/LINK]",
# required=False,
# render_type=inv.Category.RENDER_TYPE_RADIO,
# limit_per_user=1,
# order=50,
# )
self.extras = self.find_or_make(
@@ -334,55 +333,59 @@ class Command(BaseCommand):
# name="Single Bedroom with Shared Bathrooms, includes full "
# "breakfast, Sunday 15 January 2017--Saturday 21 January 2017",
# price=Decimal("396.00"),
# reservation_duration=hours(24),
# order=10,
# Extras
self.carbon_offset = self.find_or_make(
inv.Product,
("name", "category",),
category=self.extras,
name="Offset the carbon pollution generated by your attendance, "
"thanks to fifteen trees.",
price=Decimal("5.00"),
reservation_duration=hours(1),
# Shirts
ShirtGroup = namedtuple("ShirtGroup", ("prefix", "sizes"))
shirt_names = {
"mens": ShirtGroup(
"Men's/Straight Cut",
("S", "M", "L", "XL", "2XL", "3XL", "4XL"),
"straight": ShirtGroup(
"Straight Cut",
("S", "M", "L", "XL", "2XL", "3XL", "4XL", "5XL"),
),
"semi_fitted": ShirtGroup(
"Semi-Fitted",
("XS", "S", "M", "L", "XL", "2XL"),
"womens": ShirtGroup(
"Women's Classic Fit",
("8", "10", "12", "14", "16", "18"),
"fitted": ShirtGroup(
"Fitted",
}
self.shirts = {}
order = 0
for name, group in shirt_names.items():
self.shirts[name] = {}
prefix = group.prefix
for size in group.sizes:
product_name = "%s %s" % (prefix, size)
order += 10
self.shirts[name][size] = self.find_or_make(
name=product_name,
category=self.t_shirt,
price=settings.TSHIRT_PRICE,
order=order,
def populate_restrictions(self):
# Hide the products that will eventually need a voucher
@@ -442,49 +445,49 @@ class Command(BaseCommand):
self.ticket_student,
])
public_ticket_cap.products.set([
self.ticket_contributor,
self.ticket_professional,
self.ticket_hobbyist,
sponsor_ticket_cap = self.find_or_make(
cond.TimeOrStockLimitFlag,
("description", ),
description="Reserved for sponsors",
condition=cond.FlagBase.DISABLE_IF_FALSE,
limit=70,
sponsor_ticket_cap.products.set([
self.ticket_sponsor,
volunteer_ticket_cap = self.find_or_make(
description="Reserrved for volunteers and organizers",
description="Reserved for volunteers and organisers",
limit=62,
volunteer_ticket_cap.products.set([
self.ticket_team,
self.ticket_volunteer,
media_ticket_cap = self.find_or_make(
description="Reserved for media",
limit=10,
media_ticket_cap.products.set([
self.ticket_media,
speaker_ticket_cap = self.find_or_make(
description="Reserved for speakers (and miniconf organisers)",
@@ -542,56 +545,56 @@ class Command(BaseCommand):
# Team tickets are for team members only
team = self.find_or_make(
cond.GroupMemberFlag,
description="Team tickets",
condition=cond.FlagBase.ENABLE_IF_TRUE,
team.group.set([self.group_team])
team.products.set([
# Speaker tickets are for primary speakers only
speaker_tickets = self.find_or_make(
cond.SpeakerFlag,
description="Speaker tickets",
is_presenter=True,
is_copresenter=False,
speaker_tickets.proposal_kind.set(self.main_conference_proposals)
speaker_tickets.products.set([self.ticket_speaker, ])
# Speaker dinner tickets are for primary and secondary speakers
# Speaker dinner tickets are for primary speakers only
speaker_dinner_tickets = self.find_or_make(
description="Speaker dinner tickets",
is_copresenter=True,
speaker_dinner_tickets.proposal_kind.set(self.main_conference_proposals)
speaker_dinner_tickets.categories.set([self.speakers_dinner_ticket, ])
# PDNS tickets are complicated.
# They can be enabled by tickets
pdns_by_ticket = self.find_or_make(
cond.ProductFlag,
description="PDNS available by ticket",
pdns_by_ticket.enabling_products.set([
pdns_by_ticket.categories.set([self.pdns_category, ])
# They are available to speakers
pdns_by_speaker = self.find_or_make(
@@ -746,49 +749,49 @@ class Command(BaseCommand):
cond.IncludedProductDiscount,
description="Complimentary for ticket holder (Hobbyist-level)",
ticket_hobbyist_inclusions.enabling_products.set([
free_category(ticket_hobbyist_inclusions, self.t_shirt)
# Student ticket inclusions
ticket_student_inclusions = self.find_or_make(
description="Complimentary for ticket holder (Student-level)",
ticket_student_inclusions.enabling_products.set([
free_category(ticket_student_inclusions, self.t_shirt)
# Team ticket inclusions
ticket_staff_inclusions = self.find_or_make(
description="Complimentary for ticket holder staff)",
description="Complimentary for ticket holder (Staff)",
ticket_staff_inclusions.enabling_products.set([
free_category(ticket_staff_inclusions, self.penguin_dinner)
# Team & volunteer shirts, regardless of ticket type
staff_t_shirts = self.find_or_make(
cond.GroupMemberDiscount,
description="Shirts complimentary for staff and volunteers",
staff_t_shirts.group.set([
self.group_team,
self.group_volunteers,
free_category(staff_t_shirts, self.t_shirt, quantity=5)
print(f"{self.count} categories found/made")
def find_or_make(self, model, search_keys, **k):
''' Either makes or finds an object of type _model_, with the given
kwargs.