Changeset - fdee3d487831
[Not reviewed]
0 2 1
Christopher Neugebauer - 7 years ago 2017-10-03 23:49:02
chrisjrn@gmail.com
T-Shirt stuff
3 files changed with 119 insertions and 3 deletions:
0 comments (0 inline, 0 general)
pinaxcon/registrasion/management/commands/populate_inventory.py
Show inline comments
 
from collections import namedtuple
 
from datetime import datetime
 
from datetime import timedelta
 
from decimal import Decimal
 
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'
 

	
 
    def add_arguments(self, parser):
 
        pass
 

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

	
 
        kinds = []
 
        for i in ("talk", ):
 
            kinds.append(proposals.models.ProposalKind.objects.get(name=i))
 
        self.main_conference_proposals = kinds
 

	
 
        self.populate_groups()
 
        self.populate_inventory()
 
        self.populate_restrictions()
 
        self.populate_discounts()
 

	
 
    def populate_groups(self):
 
        self.group_team = self.find_or_make(
 
            Group,
 
            ("name", ),
 
            name="Conference organisers",
 
        )
 
        self.group_volunteers = self.find_or_make(
 
            Group,
 
            ("name", ),
 
            name="Conference volunteers",
 
        )
 
        self.group_unpublish = self.find_or_make(
 
            Group,
 
            ("name", ),
 
            name="Can see unpublished products",
 
        )
 

	
 
    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='/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 2017 artwork. Details of sizing and "
 
                        "manufacturer are on our <a href='/attend/tshirts'>"
 
                        "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.",
 
            required = False,
 
            render_type=inv.Category.RENDER_TYPE_QUANTITY,
 
            order=60,
 
        )
 

	
 
        # Tickets
 

	
 
        self.ticket_ind_sponsor = self.find_or_make(
 
            inv.Product,
 
            ("name", "category",),
 
            category=self.ticket,
 
            name="Individual Sponsor",
 
            price=Decimal("500.00"),
 
            reservation_duration=hours(24),
 
            order=1,
 
        )
 
        self.ticket_corporate = self.find_or_make(
 
            inv.Product,
 
            ("name", "category",),
 
            category=self.ticket,
 
            name="Corporate",
 
            price=Decimal("200.00"),
 
            reservation_duration=hours(24),
 
            order=10,
 
        )
 
        self.ticket_supporter = self.find_or_make(
 
            inv.Product,
 
            ("name", "category",),
 
            category=self.ticket,
 
            name="Individual Supporter",
 
            price=Decimal("100.00"),
 
            reservation_duration=hours(24),
 
            order=20,
 
        )
 
        self.ticket_unaffiliated = self.find_or_make(
 
            inv.Product,
 
            ("name", "category",),
 
            category=self.ticket,
 
            name="Unaffiliated Individual",
 
            price=Decimal("50.00"),
 
            reservation_duration=hours(24),
 
            order=30,
 
        )
 
        self.ticket_speaker = self.find_or_make(
 
            inv.Product,
 
            ("name", "category",),
 
            category=self.ticket,
 
            name="Speaker",
 
            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,
 
        )
 
        self.ticket_sponsor = self.find_or_make(
 
            inv.Product,
 
            ("name", "category",),
 
            category=self.ticket,
 
            name="Sponsor",
 
            price=Decimal("00.00"),
 
            reservation_duration=hours(24),
 
            order=70,
 
        )
 
        self.ticket_team = self.find_or_make(
 
            inv.Product,
 
            ("name", "category",),
 
            category=self.ticket,
 
            name="Conference Organiser",
 
            price=Decimal("00.00"),
 
            reservation_duration=hours(24),
 
            order=80,
 
        )
 
        self.ticket_volunteer = self.find_or_make(
 
            inv.Product,
 
            ("name", "category",),
 
            category=self.ticket,
 
            name="Conference Volunteer",
 
            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"),
 
            ),
 
            "womens_classic": ShirtGroup(
 
                "Women's Classic Fit",
 
                "Women's Relaxed Fit",
 
                ("XS", "S", "M", "L", "XL", "2XL", "3XL"),
 
            ),
 
            "womens_semi": ShirtGroup(
 
                "Women's Semi-Fitted",
 
                ("S", "M", "L", "XL", "2XL", "3XL"),
 
            ),
 
        }
 

	
 
        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(
 
                    inv.Product,
 
                    ("name", "category",),
 
                    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,
 
            ("description", ),
 
            description="Can see hidden products",
 
            condition=cond.FlagBase.ENABLE_IF_TRUE,
 
        )
 
        hide_voucher_products.group.set([self.group_unpublish])
 
        hide_voucher_products.products.set([
 
            self.ticket_media,
 
            self.ticket_sponsor,
 
        ])
 

	
 
        # Set limits.
 
        public_ticket_cap = self.find_or_make(
 
            cond.TimeOrStockLimitFlag,
 
            ("description", ),
 
            description="Public ticket cap",
 
            condition=cond.FlagBase.DISABLE_IF_FALSE,
 
            limit=350,
 
        )
 
        public_ticket_cap.products.set([
 
            self.ticket_ind_sponsor,
 
            self.ticket_corporate,
 
            self.ticket_supporter,
 
            self.ticket_unaffiliated,
 
        ])
 

	
 
        non_public_ticket_cap = self.find_or_make(
 
            cond.TimeOrStockLimitFlag,
 
            ("description", ),
 
            description="Non-public ticket cap",
 
            condition=cond.FlagBase.DISABLE_IF_FALSE,
 
            limit=200,
 
        )
 
        non_public_ticket_cap.products.set([
 
            self.ticket_speaker,
 
            self.ticket_sponsor,
 
            self.ticket_media,
 
            self.ticket_team,
 
            self.ticket_volunteer,
 
        ])
 

	
 
        # Volunteer tickets are for volunteers only
 
        volunteers = self.find_or_make(
 
            cond.GroupMemberFlag,
 
            ("description", ),
 
            description="Volunteer tickets",
 
            condition=cond.FlagBase.ENABLE_IF_TRUE,
 
        )
 
        volunteers.group.set([self.group_volunteers])
 
        volunteers.products.set([
 
            self.ticket_volunteer,
 
        ])
 

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

	
 
        # Speaker tickets are for primary speakers only
pinaxcon/templates/static_pages/attend/tshirt.html
Show inline comments
 
new file 100644
 
{% extends "page_with_title_and_lede.html" %}
 

	
 
{% load i18n %}
 

	
 
{% block head_title %}T-Shirts{% endblock %}
 

	
 
{% block heading %}T-Shirt sizes and {% endblock %}
 

	
 
{% block body_class %}attend{% endblock %}
 

	
 
{% block lede %}
 

	
 
{% endblock %}
 

	
 
{% block content %}
 

	
 
<p>North Bay Python uses Gildan t-shirts, and this year's design will be available in a variety of colours that you can choose from when you collect your shirt. There are three varieties available:</p>
 

	
 
<ul>
 
  <li>The Men's/Straight-Cut option is the <a href="http://www.mygildan.com/store/us/browse/productDetailsPage.jsp?productId=2000">Ultra Cotton "Classic Fit" shirt</a>.</li>
 
  <li>The Women's Semi-Fitted option is the <a href="http://www.mygildan.com/store/us/browse/productDetailsPage.jsp?productId=5000L">Heavy Cotton Semi-Fitted Ladies' shirt</a></li>
 
  <li>The Women's Relaxed Fit option is the <a href="http://www.mygildan.com/store/us/browse/productDetailsPage.jsp?productId=2000L">Ultra Cotton "Classic Fit" Ladies' shirt</a></li>
 
</ul>
 

	
 
<table class="table table-striped">
 
  <tbody><tr>
 
    <th></th>
 
    <th colspan="2">XS</th>
 
    <th colspan="2">S</th>
 
    <th colspan="2">M</th>
 
    <th colspan="2">L</th>
 
    <th colspan="2">XL</th>
 
    <th colspan="2">2XL</th>
 
    <th colspan="2">3XL</th>
 
    <th colspan="2">5XL</th>
 
</tr>
 
<tr>
 
    <th></th>
 
    <th>W</th>
 
    <th>L</th>
 
    <th>W</th>
 
    <th>L</th>
 
    <th>W</th>
 
    <th>L</th>
 
    <th>W</th>
 
    <th>L</th>
 
    <th>W</th>
 
    <th>L</th>
 
    <th>W</th>
 
    <th>L</th>
 
    <th>W</th>
 
    <th>L</th>
 
    <th>W</th>
 
    <th>L</th>
 
</tr>
 
<tr>
 
    <td>Men's / Straight Cut</td>
 
    <td>-</td>
 
    <td>-</td>
 
    <td>18</td>
 
    <td>28</td>
 
    <td>20</td>
 
    <td>29</td>
 
    <td>22</td>
 
    <td>30</td>
 
    <td>24</td>
 
    <td>31</td>
 
    <td>26</td>
 
    <td>32</td>
 
    <td>28</td>
 
    <td>33</td>
 
    <td>32</td>
 
    <td>35</td>
 
</tr>
 
<tr>
 
    <td>Women's <br> Semi-Fitted</td>
 
    <td>-</td>
 
    <td>-</td>
 
    <td>17&frac14;</td>
 
    <td>25&frac12;</td>
 
    <td>19&frac14;</td>
 
    <td>26</td>
 
    <td>21&frac14;</td>
 
    <td>27</td>
 
    <td>23.35</td>
 
    <td>28</td>
 
    <td>25&frac14;</td>
 
    <td>28&frac12;</td>
 
    <td>27&frac14;</td>
 
    <td>29</td>
 
    <td>-</td>
 
    <td>-</td>
 
</tr>
 
<tr>
 
    <td>Women's <br> Classic Fit</td>
 
    <td>16</td>
 
    <td>23&frac12;</td>
 
    <td>18</td>
 
    <td>25</td>
 
    <td>20</td>
 
    <td>26</td>
 
    <td>22</td>
 
    <td>27</td>
 
    <td>24</td>
 
    <td>28</td>
 
    <td>26</td>
 
    <td>29</td>
 
    <td>28</td>
 
    <td>30</td>
 
    <td>-</td>
 
    <td>-</td>
 
</tr>
 
</tbody></table>
 

	
 

	
 
{% endblock %}
pinaxcon/urls.py
Show inline comments
 
from django.conf import settings
 
from django.conf.urls import include, url
 
from django.conf.urls.static import static
 
from django.contrib.staticfiles.templatetags.staticfiles import static as _static
 
from django.views.generic import TemplateView
 
from django.views.generic import RedirectView
 

	
 
from django.contrib import admin
 

	
 
from pinaxcon import views
 

	
 
import symposion.views
 

	
 

	
 
urlpatterns = [
 
    url(r"^$", TemplateView.as_view(template_name="static_pages/homepage.html"), name="home"),
 

	
 
    # about
 
    url(r"^about/north-bay-python$", TemplateView.as_view(template_name="static_pages/about/north_bay_python.html"), name="about/north-bay-python"),
 
    url(r"^about/petaluma$", TemplateView.as_view(template_name="static_pages/about/petaluma.html"), name="about/petaluma"),
 
    url(r"^about/team$", TemplateView.as_view(template_name="static_pages/about/team.html"), name="about/team"),
 
    url(r"^about/colophon$", TemplateView.as_view(template_name="static_pages/about/colophon.html"), name="about/colophon"),
 

	
 
    # program
 
    url(r"^program/events$", TemplateView.as_view(template_name="static_pages/program/events.html"), name="program/events"),
 
    url(r"^program/call-for-proposals$", TemplateView.as_view(template_name="static_pages/program/call_for_proposals.html"), name="program/call-for-proposals"),
 
    url(r"^program/selection-process$", TemplateView.as_view(template_name="static_pages/program/selection_process.html"), name="program/selection-process"),
 
    url(r"^proposals$", RedirectView.as_view(url="program/call-for-proposals")),
 
    url(r"^cfp$", RedirectView.as_view(url="program/call-for-proposals")),
 

	
 
    # attend
 
    url(r"^attend$", TemplateView.as_view(template_name="static_pages/attend/attend.html"), name="attend/attend"),
 
    url(r"^tickets$", RedirectView.as_view(url="attend")),
 
    url(r"^tickets/buy$", views.buy_ticket, name="buy_ticket"),
 
    url(r"^attend/business-case$", TemplateView.as_view(template_name="static_pages/attend/business-case.html"), name="attend/business-case"),
 
    url(r"^attend/travel$", TemplateView.as_view(template_name="static_pages/attend/travel.html"), name="attend/travel"),
 
    url(r"^attend/hotels$", TemplateView.as_view(template_name="static_pages/attend/hotels.html"), name="attend/hotels"),
 
    url(r"^attend/tshirts$", TemplateView.as_view(template_name="static_pages/attend/tshirts.html"), name="attend/tshirts"),
 
    url(r"^attend/tshirt$", TemplateView.as_view(template_name="static_pages/attend/tshirt.html"), name="attend/tshirt"),
 

	
 
    url(r"^code-of-conduct$", TemplateView.as_view(template_name="static_pages/code_of_conduct/code_of_conduct.html"), name="code-of-conduct"),
 
    url(r"^code-of-conduct/harassment-incidents$", TemplateView.as_view(template_name="static_pages/code_of_conduct/harassment_procedure_attendee.html"), name="code-of-conduct/harassment-incidents"),
 
    url(r"^code-of-conduct/harassment-staff-procedures$", TemplateView.as_view(template_name="static_pages/code_of_conduct/harassment_procedure_staff.html"), name="code-of-conduct/harassment-staff-procedures"),
 
    url(r"^terms-and-conditions$", TemplateView.as_view(template_name="static_pages/terms_and_conditions.html"), name="terms-and-conditions"),
 
    url(r"^terms$", RedirectView.as_view(url="terms-and-conditions")),
 

	
 
    # sponsor
 
    url(r"^sponsors/prospectus$", RedirectView.as_view(url=_static("assets/northbaypython_prospectus.pdf")), name="sponsors/prospectus"),
 
    url(r"^northbaypython_prospectus.pdf$", RedirectView.as_view(url=_static("assets/northbaypython_prospectus.pdf")), name="northbaypython_prospectus.pdf"),
 
    url(r"^sponsors/become-a-sponsor$", TemplateView.as_view(template_name="static_pages/sponsors/become_a_sponsor.html"), name="sponsors/become-a-sponsor"),
 
    url(r"^sponsors/donate$", TemplateView.as_view(template_name="static_pages/sponsors/donate.html"), name="sponsors/donate"),
 
    url(r"^donate$", RedirectView.as_view(url="sponsors/donate")),
 
    url(r"^about/donate$", RedirectView.as_view(url="sponsors/donate")),
 

	
 
    # news
 
    url(r"^news$", TemplateView.as_view(template_name="static_pages/news.html"), name="news"),
 

	
 
    # Django, Symposion, and Registrasion URLs
 

	
 
    url(r"^admin/", include(admin.site.urls)),
 

	
 
    url(r"^login$", views.account_login, name="nbpy_login"),
 
    # Override the default account_login view with one that takes email addys
 
    url(r"^account/login/$", views.EmailLoginView.as_view(), name="account_login"),
 
    url(r"^account/", include("account.urls")),
 

	
 
    url(r"^dashboard/", symposion.views.dashboard, name="dashboard"),
 

	
 
    url(r"^speaker/", include("symposion.speakers.urls")),
 
    url(r"^proposals/", include("symposion.proposals.urls")),
 
    url(r"^sponsors/", include("symposion.sponsorship.urls")),
 
    url(r"^reviews/", include("symposion.reviews.urls")),
 
    url(r"^schedule/", include("symposion.schedule.urls")),
 

	
 
    url(r"^teams/", include("symposion.teams.urls")),
 

	
 
    # Demo payment gateway and related features
 
    url(r"^tickets/payments/", include("registripe.urls")),
 

	
 
    # Required by registrasion
 
    url(r'^tickets/', include('registrasion.urls')),
 
    url(r'^nested_admin/', include('nested_admin.urls')),
 

	
 
    # Catch-all MUST go last.
 
    #url(r"^", include("pinax.pages.urls")),
 
]
 

	
 
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
 

	
 
handler500 = views.server_error
0 comments (0 inline, 0 general)