Changeset - 39b556b7ac4f
[Not reviewed]
pinaxcon/csrf_view.py
Show inline comments
 
from django.conf import settings
 
from django.http import HttpResponseForbidden
 
from django.shortcuts import redirect
 
from django.template import Context, RequestContext, loader
 
from django.utils.translation import ugettext as _
 
from django.utils.version import get_docs_version
 

	
 

	
 
def csrf_failure(request, reason=""):
 

	
 
    from django.middleware.csrf import REASON_BAD_TOKEN, REASON_NO_REFERER, REASON_NO_CSRF_COOKIE
 
    t = loader.get_template("403_csrf.html")
 
    c = Context({
 
        'title': _("Forbidden"),
pinaxcon/disable_cscache.py
Show inline comments
 
from django.utils.cache import add_never_cache_headers
 

	
 

	
 
class DisableClientSideCachingMiddleware(object):
 
    def process_response(self, request, response):
 
        add_never_cache_headers(response)
 
        return response
 

	
pinaxcon/monkey_patch.py
Show inline comments
 
from django.conf import settings
 
from django.core.mail import EmailMultiAlternatives
 
from django.core.mail import EmailMultiAlternatives  # noqa: F401
 
from functools import wraps
 

	
 

	
 
class MonkeyPatchMiddleware(object):
 
    ''' Ensures that our monkey patching only gets called after it is safe to do so.'''
 

	
...
 
@@ -16,13 +16,13 @@ def do_monkey_patch():
 
    fix_sitetree_check_access_500s()
 
    never_cache_login_page()
 
    patch_stripe_payment_form()
 

	
 
    # Remove this function from existence
 
    global do_monkey_patch
 
    do_monkey_patch = lambda: None
 
    do_monkey_patch = lambda: None  # noqa: E731
 

	
 

	
 
def patch_speaker_profile_form():
 
    ''' Replaces textarea widgets with markdown editors. '''
 

	
 
    import widgets
...
 
@@ -31,13 +31,13 @@ def patch_speaker_profile_form():
 
    fields = SpeakerForm.base_fields
 
    fields["biography"].widget = widgets.AceMarkdownEditor()
 
    fields["experience"].widget = widgets.AceMarkdownEditor()
 
    fields["accessibility"].widget = widgets.AceMarkdownEditor()
 

	
 

	
 
def patch_mail_to_send_bcc():
 
def patch_mail_to_send_bcc():  # noqa: C901
 
    ''' Patches django.core.mail's message classes to send a BCC e-mail to
 
    the default BCC e-mail address. '''
 

	
 
    from django.core.mail import message
 

	
 
    ARG = "bcc"
...
 
@@ -77,13 +77,12 @@ def patch_mail_to_send_bcc():
 
            bcc = []
 

	
 
        bcc += bcc_email
 

	
 
        return tuple(a[:pos] + (bcc,) + a[pos + 1:])
 

	
 

	
 
    def patch_bcc_keyword(f, k):
 
        ''' Adds our BCC list to the BCC list in the keyword arguments, and
 
        returns the new version of the keyword arguments.
 

	
 
        Arguments:
 
            f (callable): The function that we're patching. It should have an
...
 
@@ -136,19 +135,20 @@ def fix_sitetree_check_access_500s():
 
            return old_check_access(self, *a, **k)
 
        except KeyError:
 
            return False
 

	
 
    SiteTree.check_access = check_access
 

	
 

	
 
def never_cache_login_page():
 
    from django.views.decorators.cache import never_cache
 
    from account.views import LoginView
 
    LoginView.get = never_cache(LoginView.get)
 

	
 

	
 
def patch_stripe_payment_form():
 
def patch_stripe_payment_form():  # noqa: C901
 

	
 
    import inspect  # Oh no.
 
    from django.http.request import HttpRequest
 
    from registripe.forms import CreditCardForm
 
    from pinaxcon.registrasion import models
 

	
pinaxcon/proposals/admin.py
Show inline comments
...
 
@@ -15,13 +15,12 @@ from symposion.proposals import models as symposion_models
 
@admin.register(models.KernelProposal)
 
@admin.register(models.GamesProposal)
 
@admin.register(models.TestingProposal)
 
@admin.register(models.KnowledgeProposal)
 
@admin.register(models.LawProposal)
 
@admin.register(models.OpenHardwareProposal)
 

	
 
class CategoryAdmin(admin.ModelAdmin):
 

	
 
    class AdditionalSpeakerInline(admin.TabularInline):
 
        model = symposion_models.AdditionalSpeaker
 

	
 
    inlines = [
pinaxcon/proposals/forms.py
Show inline comments
...
 
@@ -5,12 +5,13 @@ from pinaxcon import widgets
 
from .models import TalkProposal, TutorialProposal, MiniconfProposal
 
from .models import SysAdminProposal, WriteTheDocsProposal, WootconfProposal
 
from .models import KernelProposal, OpenRadioProposal, SecurityProposal
 
from .models import GamesProposal, TestingProposal, LawProposal, OpenHardwareProposal
 
from .models import KnowledgeProposal
 

	
 

	
 
class ProposalForm(forms.ModelForm):
 

	
 
    def clean_description(self):
 
        value = self.cleaned_data["description"]
 
        if len(value) > 400:
 
            raise forms.ValidationError(
...
 
@@ -34,15 +35,15 @@ class TalkProposalForm(ProposalForm):
 
            "video_url",
 
            "recording_release",
 
            "materials_release",
 
        ]
 

	
 
        widgets = {
 
            "abstract" : widgets.AceMarkdownEditor(),
 
            "private_abstract" : widgets.AceMarkdownEditor(),
 
            "technical_requirements" : widgets.AceMarkdownEditor(),
 
            "abstract": widgets.AceMarkdownEditor(),
 
            "private_abstract": widgets.AceMarkdownEditor(),
 
            "technical_requirements": widgets.AceMarkdownEditor(),
 
        }
 

	
 

	
 
class TutorialProposalForm(ProposalForm):
 

	
 
    class Meta:
...
 
@@ -58,15 +59,15 @@ class TutorialProposalForm(ProposalForm):
 
            "video_url",
 
            "recording_release",
 
            "materials_release",
 
        ]
 

	
 
        widgets = {
 
            "abstract" : widgets.AceMarkdownEditor(),
 
            "private_abstract" : widgets.AceMarkdownEditor(),
 
            "technical_requirements" : widgets.AceMarkdownEditor(),
 
            "abstract": widgets.AceMarkdownEditor(),
 
            "private_abstract": widgets.AceMarkdownEditor(),
 
            "technical_requirements": widgets.AceMarkdownEditor(),
 
        }
 

	
 

	
 
class MiniconfProposalForm(ProposalForm):
 

	
 
    class Meta:
...
 
@@ -76,256 +77,267 @@ class MiniconfProposalForm(ProposalForm):
 
            "abstract",
 
            "private_abstract",
 
            "technical_requirements",
 
        ]
 

	
 
        widgets = {
 
            "abstract" : widgets.AceMarkdownEditor(),
 
            "private_abstract" : widgets.AceMarkdownEditor(),
 
            "technical_requirements" : widgets.AceMarkdownEditor(),
 
            "abstract": widgets.AceMarkdownEditor(),
 
            "private_abstract": widgets.AceMarkdownEditor(),
 
            "technical_requirements": widgets.AceMarkdownEditor(),
 
        }
 

	
 

	
 
class SysAdminProposalForm(ProposalForm):
 

	
 
    class Meta:
 
        model = SysAdminProposal
 
        fields = [
 
            "title",
 
            "talk_format",
 
            "target_audience",  
 
            "target_audience",
 
            "abstract",
 
            "private_abstract",
 
            "technical_requirements",
 
            "project",
 
            "project_url",
 
            "recording_release",
 
            "materials_release",
 
        ]
 

	
 
        widgets = {
 
            "abstract" : widgets.AceMarkdownEditor(),
 
            "private_abstract" : widgets.AceMarkdownEditor(),
 
            "technical_requirements" : widgets.AceMarkdownEditor(),
 
            "abstract": widgets.AceMarkdownEditor(),
 
            "private_abstract": widgets.AceMarkdownEditor(),
 
            "technical_requirements": widgets.AceMarkdownEditor(),
 
        }
 

	
 

	
 
class WriteTheDocsProposalForm(ProposalForm):
 

	
 
    class Meta:
 
        model = WriteTheDocsProposal
 
        fields = [
 
            "title",
 
            "talk_format",
 
            "target_audience",  
 
            "target_audience",
 
            "abstract",
 
            "private_abstract",
 
            "technical_requirements",
 
            "project",
 
            "project_url",
 
            "recording_release",
 
            "materials_release",
 
        ]
 

	
 
        widgets = {
 
            "abstract" : widgets.AceMarkdownEditor(),
 
            "private_abstract" : widgets.AceMarkdownEditor(),
 
            "technical_requirements" : widgets.AceMarkdownEditor(),
 
            "abstract": widgets.AceMarkdownEditor(),
 
            "private_abstract": widgets.AceMarkdownEditor(),
 
            "technical_requirements": widgets.AceMarkdownEditor(),
 
        }
 

	
 

	
 
class RadioProposalForm(ProposalForm):
 

	
 
    class Meta:
 
        model = OpenRadioProposal
 
        fields = [
 
            "title",
 
            "target_audience",  
 
            "target_audience",
 
            "abstract",
 
            "private_abstract",
 
            "technical_requirements",
 
            "project",
 
            "project_url",
 
            "recording_release",
 
            "materials_release",
 
        ]
 

	
 
        widgets = {
 
            "abstract" : widgets.AceMarkdownEditor(),
 
            "private_abstract" : widgets.AceMarkdownEditor(),
 
            "technical_requirements" : widgets.AceMarkdownEditor(),
 
            "abstract": widgets.AceMarkdownEditor(),
 
            "private_abstract": widgets.AceMarkdownEditor(),
 
            "technical_requirements": widgets.AceMarkdownEditor(),
 
        }
 

	
 

	
 
class KernelProposalForm(ProposalForm):
 

	
 
    class Meta:
 
        model = KernelProposal
 
        fields = [
 
            "title",
 
            "target_audience",  
 
            "target_audience",
 
            "abstract",
 
            "private_abstract",
 
            "technical_requirements",
 
            "project",
 
            "project_url",
 
            "recording_release",
 
            "materials_release",
 
        ]
 

	
 
        widgets = {
 
            "abstract" : widgets.AceMarkdownEditor(),
 
            "private_abstract" : widgets.AceMarkdownEditor(),
 
            "technical_requirements" : widgets.AceMarkdownEditor(),
 
            "abstract": widgets.AceMarkdownEditor(),
 
            "private_abstract": widgets.AceMarkdownEditor(),
 
            "technical_requirements": widgets.AceMarkdownEditor(),
 
        }
 

	
 

	
 
class WootconfProposalForm(ProposalForm):
 

	
 
    class Meta:
 
        model = WootconfProposal
 
        fields = [
 
            "title",
 
            "target_audience",  
 
            "target_audience",
 
            "abstract",
 
            "private_abstract",
 
            "technical_requirements",
 
            "project",
 
            "project_url",
 
            "recording_release",
 
            "materials_release",
 
        ]
 

	
 
        widgets = {
 
            "abstract" : widgets.AceMarkdownEditor(),
 
            "private_abstract" : widgets.AceMarkdownEditor(),
 
            "technical_requirements" : widgets.AceMarkdownEditor(),
 
            "abstract": widgets.AceMarkdownEditor(),
 
            "private_abstract": widgets.AceMarkdownEditor(),
 
            "technical_requirements": widgets.AceMarkdownEditor(),
 
        }
 

	
 

	
 
class SecurityProposalForm(ProposalForm):
 

	
 
    class Meta:
 
        model = SecurityProposal
 
        fields = [
 
            "title",
 
            "target_audience",  
 
            "target_audience",
 
            "abstract",
 
            "private_abstract",
 
            "technical_requirements",
 
            "project",
 
            "project_url",
 
            "recording_release",
 
            "materials_release",
 
        ]
 

	
 
        widgets = {
 
            "abstract" : widgets.AceMarkdownEditor(),
 
            "private_abstract" : widgets.AceMarkdownEditor(),
 
            "technical_requirements" : widgets.AceMarkdownEditor(),
 
            "abstract": widgets.AceMarkdownEditor(),
 
            "private_abstract": widgets.AceMarkdownEditor(),
 
            "technical_requirements": widgets.AceMarkdownEditor(),
 
        }
 

	
 

	
 
class GamesProposalForm(ProposalForm):
 

	
 
    class Meta:
 
        model = GamesProposal
 
        fields = [
 
            "title",
 
            "talk_format",
 
            "target_audience",  
 
            "target_audience",
 
            "abstract",
 
            "private_abstract",
 
            "technical_requirements",
 
            "project",
 
            "project_url",
 
            "recording_release",
 
            "materials_release",
 
        ]
 

	
 
        widgets = {
 
            "abstract" : widgets.AceMarkdownEditor(),
 
            "private_abstract" : widgets.AceMarkdownEditor(),
 
            "technical_requirements" : widgets.AceMarkdownEditor(),
 
            "abstract": widgets.AceMarkdownEditor(),
 
            "private_abstract": widgets.AceMarkdownEditor(),
 
            "technical_requirements": widgets.AceMarkdownEditor(),
 
        }
 

	
 

	
 
class TestingProposalForm(ProposalForm):
 

	
 
    class Meta:
 
        model = TestingProposal
 
        fields = [
 
            "title",
 
            "target_audience",  
 
            "target_audience",
 
            "abstract",
 
            "private_abstract",
 
            "technical_requirements",
 
            "project",
 
            "project_url",
 
            "recording_release",
 
            "materials_release",
 
        ]
 

	
 
        widgets = {
 
            "abstract" : widgets.AceMarkdownEditor(),
 
            "private_abstract" : widgets.AceMarkdownEditor(),
 
            "technical_requirements" : widgets.AceMarkdownEditor(),
 
            "abstract": widgets.AceMarkdownEditor(),
 
            "private_abstract": widgets.AceMarkdownEditor(),
 
            "technical_requirements": widgets.AceMarkdownEditor(),
 
        }
 

	
 

	
 
class KnowledgeProposalForm(ProposalForm):
 

	
 
    class Meta:
 
        model = KnowledgeProposal
 
        fields = [
 
            "title",
 
            "target_audience",  
 
            "target_audience",
 
            "abstract",
 
            "private_abstract",
 
            "technical_requirements",
 
            "project",
 
            "project_url",
 
            "recording_release",
 
            "materials_release",
 
        ]
 

	
 
        widgets = {
 
            "abstract" : widgets.AceMarkdownEditor(),
 
            "private_abstract" : widgets.AceMarkdownEditor(),
 
            "technical_requirements" : widgets.AceMarkdownEditor(),
 
            "abstract": widgets.AceMarkdownEditor(),
 
            "private_abstract": widgets.AceMarkdownEditor(),
 
            "technical_requirements": widgets.AceMarkdownEditor(),
 
        }
 

	
 

	
 
class LawProposalForm(ProposalForm):
 

	
 
    class Meta:
 
        model = LawProposal
 
        fields = [
 
            "title",
 
            "target_audience",  
 
            "target_audience",
 
            "abstract",
 
            "private_abstract",
 
            "technical_requirements",
 
            "project",
 
            "project_url",
 
            "recording_release",
 
            "materials_release",
 
        ]
 

	
 
        widgets = {
 
            "abstract" : widgets.AceMarkdownEditor(),
 
            "private_abstract" : widgets.AceMarkdownEditor(),
 
            "technical_requirements" : widgets.AceMarkdownEditor(),
 
            "abstract": widgets.AceMarkdownEditor(),
 
            "private_abstract": widgets.AceMarkdownEditor(),
 
            "technical_requirements": widgets.AceMarkdownEditor(),
 
        }
 

	
 

	
 
class OpenHardwareProposalForm(ProposalForm):
 

	
 
    class Meta:
 
        model = OpenHardwareProposal
 
        fields = [
 
            "title",
 
            "talk_format",
 
            "target_audience",  
 
            "target_audience",
 
            "abstract",
 
            "private_abstract",
 
            "technical_requirements",
 
            "project",
 
            "project_url",
 
            "recording_release",
 
            "materials_release",
 
        ]
 

	
 
        widgets = {
 
            "abstract" : widgets.AceMarkdownEditor(),
 
            "private_abstract" : widgets.AceMarkdownEditor(),
 
            "technical_requirements" : widgets.AceMarkdownEditor(),
 
            "abstract": widgets.AceMarkdownEditor(),
 
            "private_abstract": widgets.AceMarkdownEditor(),
 
            "technical_requirements": widgets.AceMarkdownEditor(),
 
        }
pinaxcon/proposals/models.py
Show inline comments
...
 
@@ -42,113 +42,127 @@ class Proposal(ProposalBase):
 

	
 
class TalkProposal(Proposal):
 

	
 
    class Meta:
 
        verbose_name = "talk proposal"
 

	
 

	
 
class TutorialProposal(Proposal):
 

	
 
    class Meta:
 
        verbose_name = "tutorial proposal"
 

	
 

	
 
class MiniconfProposal(ProposalBase):
 

	
 
    class Meta:
 
        verbose_name = "miniconf proposal"
 

	
 

	
 
class SysAdminProposal(Proposal):
 

	
 
    TYPE_SHORT_PRESENTATION = 1
 
    TYPE_LIGHTNING_TALK = 2
 
    
 

 
    TALK_FORMATS = [
 
        (TYPE_SHORT_PRESENTATION, "Short Presentation (15-25 min)"),
 
        (TYPE_LIGHTNING_TALK, "Lightning Talk (5-10 min)"),
 
    ]
 
    
 
    talk_format = models.IntegerField(choices=TALK_FORMATS,
 

	
 
    talk_format = models.IntegerField(
 
        choices=TALK_FORMATS,
 
        help_text="Please indicate your preferred talk length in the private abstract field below.")
 
    
 

 
    class Meta:
 
        verbose_name = "System Administration Miniconf Proposal"
 

	
 

	
 
class WriteTheDocsProposal(Proposal):
 

	
 
    TYPE_LONG_PRESENTATION = 1 
 
    TYPE_LONG_PRESENTATION = 1
 
    TYPE_SHORT_PRESENTATION = 2
 
    
 

 
    TALK_FORMATS = [
 
        (TYPE_LONG_PRESENTATION, "Long Presentation (40 min)"),  
 
        (TYPE_LONG_PRESENTATION, "Long Presentation (40 min)"),
 
        (TYPE_SHORT_PRESENTATION, "Short Presentation (20 min)"),
 
    ]
 
    
 

 
    talk_format = models.IntegerField(choices=TALK_FORMATS)
 
    
 

 
    class Meta:
 
        verbose_name = "WriteThe Docs Miniconf Proposal"
 

	
 

	
 
class OpenRadioProposal(Proposal):
 

	
 
    class Meta:
 
        verbose_name = "OpenRadio Miniconf Proposal"
 

	
 

	
 
class WootconfProposal(Proposal):
 

	
 
    class Meta:
 
        verbose_name = "WOOTCONF Miniconf Proposal"
 

	
 

	
 
class KernelProposal(Proposal):
 

	
 
    class Meta:
 
        verbose_name = "Kernel Miniconf Proposal"
 

	
 

	
 
class SecurityProposal(Proposal):
 

	
 
    class Meta:
 
        verbose_name = "Security/Privacy Miniconf Proposal"
 

	
 

	
 
class GamesProposal(Proposal):
 

	
 
    TYPE_PRESENTATION = 1
 
    TYPE_DEMONSTRATION = 2
 
    TYPE_OTHER = 3
 

	
 
    TALK_FORMATS = [
 
        (TYPE_PRESENTATION, "Presentation"),
 
        (TYPE_DEMONSTRATION, "Demonstration"),
 
        (TYPE_OTHER, "Other"),
 
    ]
 
    
 

 
    talk_format = models.IntegerField(choices=TALK_FORMATS)
 
    
 

 
    class Meta:
 
        verbose_name = "Games and FOSS Miniconf Proposal"
 

	
 

	
 
class TestingProposal(Proposal):
 

	
 
    class Meta:
 
        verbose_name = "Testing/Automation Miniconf Proposal"
 

	
 

	
 
class KnowledgeProposal(Proposal):
 

	
 
    class Meta:
 
        verbose_name = "Open Knowledge Australia Miniconf Proposal"
 

	
 

	
 
class LawProposal(Proposal):
 

	
 
    class Meta:
 
        verbose_name = "Open Law and Policy Miniconf Proposal"
 

	
 

	
 
class OpenHardwareProposal(Proposal):
 

	
 
    TYPE_NORMAL_PRESENTATION = 1 
 
    TYPE_NORMAL_PRESENTATION = 1
 
    TYPE_LIGHTNING_TALK = 2
 
    
 

 
    TALK_FORMATS = [
 
        (TYPE_NORMAL_PRESENTATION, "Presentation (20 min)"),  
 
        (TYPE_NORMAL_PRESENTATION, "Presentation (20 min)"),
 
        (TYPE_LIGHTNING_TALK, "Lightning Talk (5 min)"),
 
    ]
 
    
 

 
    talk_format = models.IntegerField(choices=TALK_FORMATS)
 
    
 

 
    class Meta:
 
        verbose_name = "Open Hardware Miniconf Proposal"
pinaxcon/registrasion/forms.py
Show inline comments
...
 
@@ -5,13 +5,13 @@ from django import forms
 

	
 
class YesNoField(forms.TypedChoiceField):
 

	
 
    def __init__(self, *a, **k):
 
        super(YesNoField, self).__init__(
 
            *a,
 
            coerce=lambda x: x =='True',
 
            coerce=lambda x: x == 'True',
 
            choices=((False, 'No'), (True, 'Yes')),
 
            widget=forms.RadioSelect,
 
            **k
 
        )
 

	
 

	
...
 
@@ -19,15 +19,14 @@ class ProfileForm(forms.ModelForm):
 
    ''' A form for requesting badge and profile information. '''
 

	
 
    class Meta:
 
        model = models.AttendeeProfile
 
        exclude = ['attendee']
 
        field_classes = {
 
            "of_legal_age" : YesNoField,
 
            "of_legal_age": YesNoField,
 
        }
 
        widgets = {
 
            "past_lca" : forms.widgets.CheckboxSelectMultiple(),
 
            "past_lca": forms.widgets.CheckboxSelectMultiple(),
 
        }
 

	
 

	
 
    class Media:
 
        js = ("lca2017/js/profile_form.js", )
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 django.core.management.base import BaseCommand
 

	
 
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 LCA2017 inventory model'
 

	
 
    def add_arguments(self, parser):
 
        pass
 

	
 
    def handle(self, *args, **options):
...
 
@@ -52,39 +54,39 @@ class Command(BaseCommand):
 
            inv.Category,
 
            ("name",),
 
            name="Ticket",
 
            description="Each type of ticket has different included products. "
 
                        "For details of what products are included, see our "
 
                        "[LINK]registration details page.[/LINK]",
 
            required = True,
 
            required=True,
 
            render_type=inv.Category.RENDER_TYPE_RADIO,
 
            limit_per_user=1,
 
            order=1,
 
        )
 
        self.penguin_dinner = self.find_or_make(
 
            inv.Category,
 
            ("name",),
 
            name="Penguin Dinner Ticket",
 
            description="Tickets to our conference dinner on the evening of "
 
                        "Wednesday 18 January. All attendees may purchase "
 
                        "seats at the dinner, even if a dinner ticket is not "
 
                        "included in your conference ticket price.",
 
            required = False,
 
            required=False,
 
            render_type=inv.Category.RENDER_TYPE_QUANTITY,
 
            limit_per_user=10,
 
            order=10,
 
        )
 
        self.speakers_dinner_ticket = self.find_or_make(
 
            inv.Category,
 
            ("name",),
 
            name="Speakers' Dinner Ticket",
 
            description="Tickets to our exclusive Speakers' Dinner on the "
 
                        "evening of Tuesday 17 January. You may purchase up "
 
                        "to 5 tickets in total, for significant others, and "
 
                        "family members.",
 
            required = False,
 
            required=False,
 
            render_type=inv.Category.RENDER_TYPE_QUANTITY,
 
            limit_per_user=5,
 
            order=20,
 
        )
 
        self.pdns_breakfast = self.find_or_make(
 
            inv.Category,
...
 
@@ -92,24 +94,24 @@ class Command(BaseCommand):
 
            name="Opening Reception Breakfast Ticket",
 
            description="Tickets to our Opening Reception Breakfast. This "
 
                        "event will be held on the morning of Monday 16 "
 
                        "January, and is restricted to Professional Ticket "
 
                        "holders, speakers, miniconf organisers, and invited "
 
                        "guests.",
 
            required = False,
 
            required=False,
 
            render_type=inv.Category.RENDER_TYPE_RADIO,
 
            limit_per_user=1,
 
            order=30,
 
        )
 
        self.t_shirt = self.find_or_make(
 
            inv.Category,
 
            ("name",),
 
            name="T-Shirt",
 
            description="Commemorative conference t-shirts, featuring secret "
 
                        "linux.conf.au 2017 artwork.",
 
            required = False,
 
            required=False,
 
            render_type=inv.Category.RENDER_TYPE_ITEM_QUANTITY,
 
            order=40,
 
        )
 
        self.accommodation = self.find_or_make(
 
            inv.Category,
 
            ("name",),
...
 
@@ -121,24 +123,24 @@ class Command(BaseCommand):
 
                        "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,
 
            required=False,
 
            render_type=inv.Category.RENDER_TYPE_RADIO,
 
            limit_per_user=1,
 
            order=50,
 
        )
 
        self.extras = self.find_or_make(
 
            inv.Category,
 
            ("name",),
 
            name="Extras",
 
            description="Other items that can improve your conference "
 
                        "experience.",
 
            required = False,
 
            required=False,
 
            render_type=inv.Category.RENDER_TYPE_QUANTITY,
 
            order=60,
 
        )
 

	
 
        # Tickets
 

	
pinaxcon/registrasion/views.py
Show inline comments
 
from django.conf import settings
 
from django.contrib.auth.decorators import login_required
 
from django.contrib import messages
 
from django.core.exceptions import ObjectDoesNotExist
 
from django.core.exceptions import ValidationError
 
from django.http import Http404
 
from django.shortcuts import get_object_or_404
 
from django.shortcuts import redirect
 
from django.shortcuts import render
 

	
 
from registrasion import models as rego
 
from registrasion.controllers.invoice import InvoiceController
 

	
 
import models
 

	
 

	
 
def demopay(request, invoice_id, access_code):
 
    ''' Marks the invoice with the given invoice id as paid.
 
    '''
 
    invoice_id = int(invoice_id)
 
    inv = get_object_or_404(rego.Invoice.objects,pk=invoice_id)
 
    inv = get_object_or_404(rego.Invoice.objects, pk=invoice_id)
 

	
 
    invoice = InvoiceController(inv)
 

	
 
    if not invoice.can_view(user=request.user, access_code=access_code):
 
        raise Http404()
 

	
pinaxcon/settings.py
Show inline comments
 
import os
 
import dj_database_url
 
from django.utils.crypto import get_random_string
 

	
 

	
 
PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
 
PACKAGE_ROOT = os.path.abspath(os.path.dirname(__file__))
 
BASE_DIR = PACKAGE_ROOT
 

	
 
DEBUG = True #bool(int(os.environ.get("DEBUG", "1")))
 
DEBUG = True  # bool(int(os.environ.get("DEBUG", "1")))
 

	
 
DATABASES = {
 
    "default": {
 
        "ENGINE": "django.db.backends.sqlite3",
 
        "NAME": os.path.join(PROJECT_ROOT, "dev.db"),
 
    }
...
 
@@ -149,24 +148,24 @@ INSTALLED_APPS = [
 

	
 
    # Registrasion-stipe
 
    "pinax.stripe",
 
    "django_countries",
 
    "registripe",
 

	
 
    #admin - required by registrasion ??
 
    # admin - required by registrasion ??
 
    "nested_admin",
 

	
 
    # project
 
    "cms_pages",
 
    "pinaxcon",
 
    "pinaxcon.proposals",
 
    "pinaxcon.registrasion",
 
    "jquery",
 
    "djangoformsetjs",
 

	
 
    #testing
 
    # testing
 
    "django_nose",
 
]
 

	
 
DEBUG_TOOLBAR_PANELS = [
 
    'debug_toolbar.panels.versions.VersionsPanel',
 
    'debug_toolbar.panels.timer.TimerPanel',
...
 
@@ -201,13 +200,13 @@ LOGGING = {
 
    'filters': {
 
        'require_debug_false': {
 
            '()': 'django.utils.log.RequireDebugFalse'
 
        }
 
    },
 
    'handlers': {
 
         'console':{
 
        'console': {
 
            'level': 'DEBUG',
 
            'class': 'logging.StreamHandler',
 
            'formatter': 'simple'
 
        },
 
        'mail_admins': {
 
            'level': 'ERROR',
...
 
@@ -270,14 +269,14 @@ PROPOSAL_FORMS = {
 
    "testing-miniconf": "pinaxcon.proposals.forms.TestingProposalForm",
 
    "knowledge-miniconf": "pinaxcon.proposals.forms.KnowledgeProposalForm",
 
    "lawpolicy-miniconf": "pinaxcon.proposals.forms.LawProposalForm",
 
    "openhardware-miniconf": "pinaxcon.proposals.forms.OpenHardwareProposalForm",
 
}
 

	
 
#PINAX_PAGES_HOOKSET = "pinaxcon.hooks.PinaxPagesHookSet"
 
#PINAX_BOXES_HOOKSET = "pinaxcon.hooks.PinaxBoxesHookSet"
 
# PINAX_PAGES_HOOKSET = "pinaxcon.hooks.PinaxPagesHookSet"
 
# PINAX_BOXES_HOOKSET = "pinaxcon.hooks.PinaxBoxesHookSet"
 

	
 
# Registrasion bits:
 
ATTENDEE_PROFILE_MODEL = "pinaxcon.registrasion.models.AttendeeProfile"
 
ATTENDEE_PROFILE_FORM = "pinaxcon.registrasion.forms.ProfileForm"
 
INVOICE_CURRENCY = "AUD"
 
PINAX_STRIPE_PUBLIC_KEY = os.environ.get("STRIPE_PUBLIC_KEY", "your test public key")
...
 
@@ -305,9 +304,9 @@ NOSE_ARGS = [
 

	
 
# Production settings have their own file to override stuff here
 
try:
 
    LOCAL_SETTINGS
 
except NameError:
 
    try:
 
        from local_settings import *
 
        from local_settings import *  # noqa: F401,F403
 
    except ImportError:
 
        pass
pinaxcon/templatetags/lca2017_tags.py
Show inline comments
 
import cms_pages
 
import hashlib
 
import urllib
 

	
 
from decimal import Decimal
 
from django import template
 
from django.conf import settings
 
from django.contrib.staticfiles.templatetags import staticfiles
 
from easy_thumbnails.files import get_thumbnailer
...
 
@@ -52,13 +51,15 @@ def speaker_photo(context, speaker, size):
 
        thumbnail_options = {'crop': True, 'size': (size, size)}
 
        thumbnail = thumbnailer.get_thumbnail(thumbnail_options)
 
        return thumbnail.url
 
    else:
 
        email = speaker.user.email.encode("utf-8")
 
        md5sum = hashlib.md5(email.strip().lower()).hexdigest()
 
        url = "https://secure.gravatar.com/avatar/%s?s=%d&d=%s" % (md5sum, size, "https://linux.conf.au/site_media/static/lca2017/images/speaker-fallback-devil.jpg")
 
        fallback_image = ("https://linux.conf.au/site_media/static/lca2017"
 
                          "/images/speaker-fallback-devil.jpg")
 
        url = "https://secure.gravatar.com/avatar/%s?s=%d&d=%s" % (md5sum, size, fallback_image)
 

	
 
        return url
 

	
 

	
 
@register.simple_tag()
 
def define(value):
...
 
@@ -91,12 +92,13 @@ def gst(amount):
 

	
 

	
 
@register.simple_tag()
 
def conference_name():
 
    return conference_models.Conference.objects.get(id=CONFERENCE_ID).title
 

	
 

	
 
@register.filter()
 
def trackname(room, day):
 
    try:
 
        track_name = room.track_set.get(day=day).name
 
    except Track.DoesNotExist:
 
        track_name = None
pinaxcon/templatetags/pyconau2017_tags.py
Show inline comments
 
import cms_pages
 
import hashlib
 
import urllib
 

	
 
import os
 

	
 
from decimal import Decimal
 
from django import template
 
from django.conf import settings
...
 
@@ -54,13 +53,15 @@ def speaker_photo(context, speaker, size):
 
        thumbnail_options = {'crop': True, 'size': (size, size)}
 
        thumbnail = thumbnailer.get_thumbnail(thumbnail_options)
 
        return thumbnail.url
 
    else:
 
        email = speaker.user.email.encode("utf-8")
 
        md5sum = hashlib.md5(email.strip().lower()).hexdigest()
 
        url = "https://secure.gravatar.com/avatar/%s?s=%d&d=%s" % (md5sum, size, "https://2017.pycon-au.org/site_media/static/pyconau23017/images/speaker-fallback-devil.jpg")
 
        fallback_image = ("https://2017.pycon-au.org/site_media/static"
 
                          "/pyconau23017/images/speaker-fallback-devil.jpg")
 
        url = "https://secure.gravatar.com/avatar/%s?s=%d&d=%s" % (md5sum, size, fallback_image)
 

	
 
        return url
 

	
 

	
 
@register.simple_tag()
 
def define(value):
...
 
@@ -93,22 +94,23 @@ def gst(amount):
 

	
 

	
 
@register.simple_tag()
 
def conference_name():
 
    return conference_models.Conference.objects.get(id=CONFERENCE_ID).title
 

	
 

	
 
@register.filter()
 
def trackname(room, day):
 
    try:
 
        track_name = room.track_set.get(day=day).name
 
    except Track.DoesNotExist:
 
        track_name = None
 
    return track_name
 

	
 

	
 
@register.simple_tag()
 
def sponsor_thumbnail(sponsor_logo):
 
    if sponsor_logo is not None:
 
        if sponsor_logo.upload:
 
            logo_file = os.path.join(settings.MEDIA_URL, str(sponsor_logo.upload))
 
            return logo_file
 

	
 
    return ""
...
 
\ No newline at end of file
 
    return ""
pinaxcon/urls.py
Show inline comments
 
from django.conf import settings
 
from django.conf.urls import patterns, include, url
 
from django.conf.urls import include, url
 
from django.conf.urls.static import static
 
from django.views.generic import TemplateView
 

	
 
from wagtail.wagtailadmin import urls as wagtailadmin_urls
 
from wagtail.wagtailcore import urls as wagtail_urls
 

	
 
from django.contrib import admin
 

	
 
import symposion.views
 

	
 

	
 

	
 
import sys
 

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

	
 
    url(r"^account/", include("account.urls")),
 

	
 
    url(r"^dashboard/", symposion.views.dashboard, name="dashboard"),
...
 
@@ -43,16 +40,16 @@ urlpatterns = [
 
    url(r'^', include(wagtail_urls)),
 

	
 
    # Matches *NOTHING* -- remove once site_tree is fixed
 
    url(r"^$", TemplateView.as_view(template_name="homepage.html"), name="home"),
 

	
 
    # Demo payment gateway and related features
 
    #url(r"^register/pinaxcon/", include("pinaxcon.registrasion.urls")),
 
    # url(r"^register/pinaxcon/", include("pinaxcon.registrasion.urls")),
 

	
 
]
 

	
 
if settings.DEBUG:
 
   import debug_toolbar
 
   urlpatterns.insert(0, url(r'^__debug__/', include(debug_toolbar.urls)))
 
    import debug_toolbar
 
    urlpatterns.insert(0, url(r'^__debug__/', include(debug_toolbar.urls)))
 

	
 

	
 
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
pinaxcon/widgets.py
Show inline comments
 
from django import forms
 

	
 

	
 
class AceMarkdownEditor(forms.Textarea):
 

	
 
    def render(self, name, value, attrs):
 
        original = super(AceMarkdownEditor, self).render(name, value, attrs)
 
        ret = '''
 
                %s
0 comments (0 inline, 0 general)