Changeset - f20d2bd63c26
[Not reviewed]
0 1 0
Christopher Neugebauer - 6 years ago 2018-09-05 02:51:07
chrisjrn@gmail.com
Inventory populator
1 file changed with 29 insertions and 2 deletions:
0 comments (0 inline, 0 general)
pinaxcon/registrasion/management/commands/populate_inventory.py
Show inline comments
...
 
@@ -6,17 +6,17 @@ from django.contrib.auth.models import Group
 
from django.core.exceptions import ObjectDoesNotExist
 
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 NBPy2017 inventory model'
 
    help = 'Populates the inventory with the NBPy2018 inventory model'
 

	
 
    def add_arguments(self, parser):
 
        pass
 

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

	
 
        kinds = []
 
        for i in ("talk", ):
...
 
@@ -34,16 +34,21 @@ class Command(BaseCommand):
 
            ("name", ),
 
            name="Conference organisers",
 
        )
 
        self.group_volunteers = self.find_or_make(
 
            Group,
 
            ("name", ),
 
            name="Conference volunteers",
 
        )
 
        self.group_rejected_or_waitlist = self.find_or_make(
 
            Group,
 
            ("name", ),
 
            name="Rejected or Waitlisted Speakers",
 
        )
 
        self.group_unpublish = self.find_or_make(
 
            Group,
 
            ("name", ),
 
            name="Can see unpublished products",
 
        )
 

	
 
    def populate_inventory(self):
 
        # Categories
...
 
@@ -60,17 +65,17 @@ class Command(BaseCommand):
 
            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 2017 artwork. Details of sizing and "
 
                        "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,
...
 
@@ -125,16 +130,25 @@ class Command(BaseCommand):
 
            inv.Product,
 
            ("name", "category",),
 
            category=self.ticket,
 
            name="Speaker",
 
            price=Decimal("00.00"),
 
            reservation_duration=hours(24),
 
            order=50,
 
        )
 
        self.ticket_talk_proposer = self.find_or_make(
 
            inv.Product,
 
            ("name", "category",),
 
            category=self.ticket,
 
            name="Talk Proposer",
 
            price=Decimal("00.00"),
 
            reservation_duration=hours(24),
 
            order=50,
 
        )
 
        self.ticket_media = self.find_or_make(
 
            inv.Product,
 
            ("name", "category",),
 
            category=self.ticket,
 
            name="Media",
 
            price=Decimal("00.00"),
 
            reservation_duration=hours(24),
 
            order=60,
...
 
@@ -266,16 +280,29 @@ class Command(BaseCommand):
 
            description="Team tickets",
 
            condition=cond.FlagBase.ENABLE_IF_TRUE,
 
        )
 
        team.group.set([self.group_team])
 
        team.products.set([
 
            self.ticket_team,
 
        ])
 

	
 
        # Team tickets are for team members only
 
        team = self.find_or_make(
 
            cond.GroupMemberFlag,
 
            ("description", ),
 
            description="Talk proposer tickets",
 
            condition=cond.FlagBase.ENABLE_IF_TRUE,
 
        )
 
        team.group.set([self.group_rejected_or_waitlist])
 
        team.products.set([
 
            self.ticket_talk_proposer,
 
        ])
 

	
 

	
 
        # Speaker tickets are for primary speakers only
 
        speaker_tickets = self.find_or_make(
 
            cond.SpeakerFlag,
 
            ("description", ),
 
            description="Speaker tickets",
 
            condition=cond.FlagBase.ENABLE_IF_TRUE,
 
            is_presenter=True,
 
            is_copresenter=False,
0 comments (0 inline, 0 general)