Mass style-check update

Seems okay.
This commit is contained in:
Sachi King 2017-03-05 18:34:15 +11:00
parent 97748a0f7f
commit 39b556b7ac
14 changed files with 138 additions and 115 deletions

View file

@ -1,10 +1,10 @@
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

View file

@ -1,7 +1,7 @@
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

View file

@ -1,5 +1,5 @@
from django.conf import settings
from django.core.mail import EmailMultiAlternatives
from django.core.mail import EmailMultiAlternatives # noqa: F401
from functools import wraps
@ -19,7 +19,7 @@ def do_monkey_patch():
# 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():
@ -34,7 +34,7 @@ def patch_speaker_profile_form():
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. '''
@ -80,7 +80,6 @@ def patch_mail_to_send_bcc():
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.
@ -139,13 +138,14 @@ def fix_sitetree_check_access_500s():
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

View file

@ -18,7 +18,6 @@ from symposion.proposals import models as symposion_models
@admin.register(models.KnowledgeProposal)
@admin.register(models.LawProposal)
@admin.register(models.OpenHardwareProposal)
class CategoryAdmin(admin.ModelAdmin):
class AdditionalSpeakerInline(admin.TabularInline):

View file

@ -8,6 +8,7 @@ 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):
@ -37,9 +38,9 @@ class TalkProposalForm(ProposalForm):
]
widgets = {
"abstract" : widgets.AceMarkdownEditor(),
"private_abstract" : widgets.AceMarkdownEditor(),
"technical_requirements" : widgets.AceMarkdownEditor(),
"abstract": widgets.AceMarkdownEditor(),
"private_abstract": widgets.AceMarkdownEditor(),
"technical_requirements": widgets.AceMarkdownEditor(),
}
@ -61,9 +62,9 @@ class TutorialProposalForm(ProposalForm):
]
widgets = {
"abstract" : widgets.AceMarkdownEditor(),
"private_abstract" : widgets.AceMarkdownEditor(),
"technical_requirements" : widgets.AceMarkdownEditor(),
"abstract": widgets.AceMarkdownEditor(),
"private_abstract": widgets.AceMarkdownEditor(),
"technical_requirements": widgets.AceMarkdownEditor(),
}
@ -79,11 +80,12 @@ class MiniconfProposalForm(ProposalForm):
]
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:
@ -91,7 +93,7 @@ class SysAdminProposalForm(ProposalForm):
fields = [
"title",
"talk_format",
"target_audience",
"target_audience",
"abstract",
"private_abstract",
"technical_requirements",
@ -102,11 +104,12 @@ class SysAdminProposalForm(ProposalForm):
]
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:
@ -114,7 +117,7 @@ class WriteTheDocsProposalForm(ProposalForm):
fields = [
"title",
"talk_format",
"target_audience",
"target_audience",
"abstract",
"private_abstract",
"technical_requirements",
@ -125,18 +128,19 @@ class WriteTheDocsProposalForm(ProposalForm):
]
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",
@ -147,18 +151,19 @@ class RadioProposalForm(ProposalForm):
]
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",
@ -169,18 +174,19 @@ class KernelProposalForm(ProposalForm):
]
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",
@ -191,18 +197,19 @@ class WootconfProposalForm(ProposalForm):
]
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",
@ -213,11 +220,12 @@ class SecurityProposalForm(ProposalForm):
]
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:
@ -225,7 +233,7 @@ class GamesProposalForm(ProposalForm):
fields = [
"title",
"talk_format",
"target_audience",
"target_audience",
"abstract",
"private_abstract",
"technical_requirements",
@ -236,18 +244,19 @@ class GamesProposalForm(ProposalForm):
]
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",
@ -258,18 +267,19 @@ class TestingProposalForm(ProposalForm):
]
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",
@ -280,18 +290,19 @@ class KnowledgeProposalForm(ProposalForm):
]
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",
@ -302,11 +313,12 @@ class LawProposalForm(ProposalForm):
]
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:
@ -314,7 +326,7 @@ class OpenHardwareProposalForm(ProposalForm):
fields = [
"title",
"talk_format",
"target_audience",
"target_audience",
"abstract",
"private_abstract",
"technical_requirements",
@ -325,7 +337,7 @@ class OpenHardwareProposalForm(ProposalForm):
]
widgets = {
"abstract" : widgets.AceMarkdownEditor(),
"private_abstract" : widgets.AceMarkdownEditor(),
"technical_requirements" : widgets.AceMarkdownEditor(),
"abstract": widgets.AceMarkdownEditor(),
"private_abstract": widgets.AceMarkdownEditor(),
"technical_requirements": widgets.AceMarkdownEditor(),
}

View file

@ -45,67 +45,77 @@ 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
@ -117,38 +127,42 @@ class GamesProposal(Proposal):
(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"

View file

@ -8,7 +8,7 @@ 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
@ -22,12 +22,11 @@ class ProfileForm(forms.ModelForm):
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", )

View file

@ -4,13 +4,15 @@ 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):
@ -55,7 +57,7 @@ class Command(BaseCommand):
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,
@ -68,7 +70,7 @@ class Command(BaseCommand):
"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,
@ -81,7 +83,7 @@ class Command(BaseCommand):
"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,
@ -95,7 +97,7 @@ class Command(BaseCommand):
"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,
@ -106,7 +108,7 @@ class Command(BaseCommand):
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,
)
@ -124,7 +126,7 @@ class Command(BaseCommand):
"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,
@ -135,7 +137,7 @@ class Command(BaseCommand):
name="Extras",
description="Other items that can improve your conference "
"experience.",
required = False,
required=False,
render_type=inv.Category.RENDER_TYPE_QUANTITY,
order=60,
)

View file

@ -1,12 +1,8 @@
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
@ -18,7 +14,7 @@ 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)

View file

@ -1,5 +1,4 @@
import os
import dj_database_url
from django.utils.crypto import get_random_string
@ -7,7 +6,7 @@ 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": {
@ -152,7 +151,7 @@ INSTALLED_APPS = [
"django_countries",
"registripe",
#admin - required by registrasion ??
# admin - required by registrasion ??
"nested_admin",
# project
@ -163,7 +162,7 @@ INSTALLED_APPS = [
"jquery",
"djangoformsetjs",
#testing
# testing
"django_nose",
]
@ -204,7 +203,7 @@ LOGGING = {
}
},
'handlers': {
'console':{
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'simple'
@ -273,8 +272,8 @@ PROPOSAL_FORMS = {
"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"
@ -308,6 +307,6 @@ try:
LOCAL_SETTINGS
except NameError:
try:
from local_settings import *
from local_settings import * # noqa: F401,F403
except ImportError:
pass

View file

@ -1,6 +1,5 @@
import cms_pages
import hashlib
import urllib
from decimal import Decimal
from django import template
@ -55,7 +54,9 @@ def speaker_photo(context, speaker, size):
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
@ -94,6 +95,7 @@ def gst(amount):
def conference_name():
return conference_models.Conference.objects.get(id=CONFERENCE_ID).title
@register.filter()
def trackname(room, day):
try:

View file

@ -1,6 +1,5 @@
import cms_pages
import hashlib
import urllib
import os
@ -57,7 +56,9 @@ def speaker_photo(context, speaker, size):
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
@ -96,6 +97,7 @@ def gst(amount):
def conference_name():
return conference_models.Conference.objects.get(id=CONFERENCE_ID).title
@register.filter()
def trackname(room, day):
try:
@ -104,11 +106,11 @@ def trackname(room, day):
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 ""
return ""

View file

@ -1,5 +1,5 @@
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
@ -11,9 +11,6 @@ from django.contrib import admin
import symposion.views
import sys
urlpatterns = [
url(r"^admin/", include(admin.site.urls)),
@ -46,13 +43,13 @@ urlpatterns = [
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)

View file

@ -1,5 +1,6 @@
from django import forms
class AceMarkdownEditor(forms.Textarea):
def render(self, name, value, attrs):