moved all(?) dates to the configuration.

This commit is contained in:
Clinton Roy 2019-09-22 13:38:33 +10:00 committed by Joel Addison
parent 475e02eeaa
commit 183896d2b6
2 changed files with 25 additions and 12 deletions

View file

@ -2,6 +2,7 @@ from collections import namedtuple
from datetime import datetime from datetime import datetime
from datetime import timedelta from datetime import timedelta
from decimal import Decimal from decimal import Decimal
from django.conf import settings
from django.contrib.auth.models import Group from django.contrib.auth.models import Group
from django.core.exceptions import ObjectDoesNotExist from django.core.exceptions import ObjectDoesNotExist
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
@ -12,8 +13,7 @@ from symposion import proposals
class Command(BaseCommand): class Command(BaseCommand):
help = 'Populates the tickets and product inventory models'
help = 'Populates the inventory with the LCA2018 inventory model'
def add_arguments(self, parser): def add_arguments(self, parser):
pass pass
@ -86,7 +86,8 @@ class Command(BaseCommand):
("name",), ("name",),
name="Penguin Dinner Ticket", name="Penguin Dinner Ticket",
description="Tickets to our conference dinner on the evening of " description="Tickets to our conference dinner on the evening of "
"Wednesday 23 January. All attendees may purchase " f"{settings.PENGUIN_DINNER_TICKET_DATE: %A %d %B}. "
"All attendees may purchase "
"seats at the dinner, even if a dinner ticket is not " "seats at the dinner, even if a dinner ticket is not "
"included in your conference ticket price.", "included in your conference ticket price.",
required=False, required=False,
@ -99,7 +100,9 @@ class Command(BaseCommand):
("name",), ("name",),
name="Speakers' Dinner Ticket", name="Speakers' Dinner Ticket",
description="Tickets to our exclusive Speakers' Dinner on the " description="Tickets to our exclusive Speakers' Dinner on the "
"evening of Tuesday 23 January. You may purchase up " "evening of "
f"{settings.SPEAKER_DINNER_TICKET_DATE: %A %d %B}. "
"You may purchase up "
"to 5 tickets in total, for significant others and " "to 5 tickets in total, for significant others and "
"family members.", "family members.",
required=False, required=False,
@ -111,9 +114,10 @@ class Command(BaseCommand):
inv.Category, inv.Category,
("name",), ("name",),
name="Professional Delegates Networking Session Ticket", name="Professional Delegates Networking Session Ticket",
description="Tickets to our Professional Delegates Networking session." description="Tickets to our Professional Delegates Networking session. "
"This event will be held on the evening of Thursday 24th " "This event will be held on the evening of "
"January, and is restricted to Professional Ticket " f"{settings.PDNS_TICKET_DATE: %A %d %B} "
"and is restricted to Professional Ticket "
"holders, speakers, miniconf organisers, and invited " "holders, speakers, miniconf organisers, and invited "
"guests.", "guests.",
required=False, required=False,
@ -126,7 +130,7 @@ class Command(BaseCommand):
("name",), ("name",),
name="Shirt", name="Shirt",
description="Commemorative conference polo shirts, featuring the " description="Commemorative conference polo shirts, featuring the "
"linux.conf.au 2019 artwork.", f"linux.conf.au {settings.LCA_START.year} artwork.",
required=False, required=False,
render_type=inv.Category.RENDER_TYPE_ITEM_QUANTITY, render_type=inv.Category.RENDER_TYPE_ITEM_QUANTITY,
order=50, order=50,
@ -681,7 +685,6 @@ class Command(BaseCommand):
def populate_discounts(self): def populate_discounts(self):
def add_early_birds(discount): def add_early_birds(discount):
self.find_or_make( self.find_or_make(
cond.DiscountForProduct, cond.DiscountForProduct,
@ -715,7 +718,7 @@ class Command(BaseCommand):
cond.TimeOrStockLimitDiscount, cond.TimeOrStockLimitDiscount,
("description", ), ("description", ),
description="Early Bird Discount - Hobbyist", description="Early Bird Discount - Hobbyist",
end_time=datetime(year=2017, month=11, day=1), end_time=settings.EARLY_BIRD_DEADLINE,
limit=150, # Across all users limit=150, # Across all users
) )
self.find_or_make( self.find_or_make(
@ -731,7 +734,7 @@ class Command(BaseCommand):
cond.TimeOrStockLimitDiscount, cond.TimeOrStockLimitDiscount,
("description", ), ("description", ),
description="Early Bird Discount - Professional", description="Early Bird Discount - Professional",
end_time=datetime(year=2017, month=11, day=1), end_time=settings.EARLY_BIRD_DEADLINE,
limit=200, # Across professionals and fairy sponsors limit=200, # Across professionals and fairy sponsors
) )
add_early_birds(early_bird) add_early_birds(early_bird)

View file

@ -6,6 +6,8 @@ import dj_database_url
import saml2 import saml2
import saml2.saml import saml2.saml
from datetime import date, datetime
PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
PACKAGE_ROOT = os.path.abspath(os.path.dirname(__file__)) PACKAGE_ROOT = os.path.abspath(os.path.dirname(__file__))
DJANGO_ROOT = os.path.abspath(os.path.dirname(django.__file__)) DJANGO_ROOT = os.path.abspath(os.path.dirname(django.__file__))
@ -110,7 +112,7 @@ CACHES = {
} }
ALLOWED_HOSTS = ['lca2018.org', '127.0.0.1', 'localhost', '*'] ALLOWED_HOSTS = ['127.0.0.1', 'localhost', '*']
TIME_ZONE = "Pacific/Auckland" TIME_ZONE = "Pacific/Auckland"
DATE_FORMAT = "j F Y" DATE_FORMAT = "j F Y"
@ -438,3 +440,11 @@ SETTINGS_EXPORT = [
if DEV_MODE and DEV_MODE == "LAPTOP": if DEV_MODE and DEV_MODE == "LAPTOP":
print("ENABLING LAPTOP MODE") print("ENABLING LAPTOP MODE")
from .devmode_settings import * from .devmode_settings import *
# Ticket information
LCA_START = datetime(2020, 1, 13)
LCA_END = datetime(2020, 1, 17)
EARLY_BIRD_DEADLINE = datetime(2019, 11, 1)
PENGUIN_DINNER_TICKET_DATE = date(2020, 1, 15)
SPEAKER_DINNER_TICKET_DATE = date(2020, 1, 14)
PDNS_TICKET_DATE = date(2020, 1, 16)