File diff fced1790a0d4 → 7d17ee1ef234
pinaxcon/registrasion/management/commands/populate_inventory.py
Show inline comments
...
 
@@ -8,13 +8,13 @@ from django.core.management.base import BaseCommand, CommandError
 

	
 
from registrasion.models import inventory as inv
 
from registrasion.models import conditions as cond
 
from symposion import proposals
 

	
 
class Command(BaseCommand):
 
    help = 'Populates the inventory with the NBPy2018 inventory model'
 
    help = 'Populates the inventory with the NBPy2019 inventory model'
 

	
 
    def add_arguments(self, parser):
 
        pass
 

	
 
    def handle(self, *args, **options):
 

	
...
 
@@ -62,24 +62,26 @@ class Command(BaseCommand):
 
                        "<a href='/attend'>ticket sales page</a>.",
 
            required = True,
 
            render_type=inv.Category.RENDER_TYPE_RADIO,
 
            limit_per_user=1,
 
            order=1,
 
        )
 
        '''
 
        self.t_shirt = self.find_or_make(
 
            inv.Category,
 
            ("name",),
 
            name="T-Shirt",
 
            description="Commemorative conference t-shirts, featuring secret "
 
                        "North Bay Python 2018 artwork. Details of sizing and "
 
                        "manufacturer are on our <a href='/attend/tshirt'>"
 
                        "t-shirts page</a>",
 
            required = False,
 
            render_type=inv.Category.RENDER_TYPE_ITEM_QUANTITY,
 
            order=40,
 
        )
 
        '''
 
        self.extras = self.find_or_make(
 
            inv.Category,
 
            ("name",),
 
            name="Extras",
 
            description="Other items that can improve your conference "
 
                        "experience.",
...
 
@@ -179,12 +181,13 @@ class Command(BaseCommand):
 
            price=Decimal("00.00"),
 
            reservation_duration=hours(24),
 
            order=90,
 
        )
 

	
 
        # Shirts
 
        '''
 
        ShirtGroup = namedtuple("ShirtGroup", ("prefix", "sizes"))
 
        shirt_names = {
 
            "mens": ShirtGroup(
 
                "Men's/Straight Cut Size",
 
                ("S", "M", "L", "XL", "2XL", "3XL", "5XL"),
 
            ),
...
 
@@ -212,12 +215,13 @@ class Command(BaseCommand):
 
                    name=product_name,
 
                    category=self.t_shirt,
 
                    price=Decimal("30.00"),
 
                    reservation_duration=hours(1),
 
                    order=order,
 
                )
 
        '''
 

	
 
    def populate_restrictions(self):
 

	
 
        # Hide the products that will eventually need a voucher
 
        hide_voucher_products = self.find_or_make(
 
            cond.GroupMemberFlag,
...
 
@@ -358,13 +362,13 @@ class Command(BaseCommand):
 

	
 
        # Early Bird Discount (general public)
 
        early_bird = self.find_or_make(
 
            cond.TimeOrStockLimitDiscount,
 
            ("description", ),
 
            description="Early Bird",
 
            end_time=datetime(year=2018, month=9, day=30),
 
            end_time=datetime(year=2019, month=9, day=20),
 
            limit=100,  # Across all users
 
        )
 
        add_early_birds(early_bird)
 

	
 
        # Early bird rates for speakers
 
        speaker_ticket_discounts = self.find_or_make(
...
 
@@ -389,36 +393,40 @@ class Command(BaseCommand):
 
            self.ticket_ind_sponsor,
 
            self.ticket_corporate,
 
            self.ticket_supporter,
 
            self.ticket_sponsor,
 
            self.ticket_speaker,
 
        ])
 
        free_category(ticket_prolike_inclusions, self.t_shirt)
 
        # free_category(ticket_prolike_inclusions, self.t_shirt)
 

	
 
        # Team & volunteer ticket inclusions
 
        ticket_staff_inclusions = self.find_or_make(
 
            cond.IncludedProductDiscount,
 
            ("description", ),
 
            description="Complimentary for ticket holder (staff/volunteer)",
 
        )
 
        ticket_staff_inclusions.enabling_products.set([
 
            self.ticket_team,
 
            self.ticket_volunteer,
 
        ])
 

	
 
        '''
 

	
 
        # Team & volunteer t-shirts, regardless of ticket type
 
        staff_t_shirts = self.find_or_make(
 
            cond.GroupMemberDiscount,
 
            ("description", ),
 
            description="T-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=2)
 
        free_category(staff_t_shirts, self.t_shirt, quantity=2
 

	
 
        '''
 

	
 
    def find_or_make(self, model, search_keys, **k):
 
        ''' Either makes or finds an object of type _model_, with the given
 
        kwargs.
 

	
 
        Arguments: