From 39b556b7ac4f388ed751cf2c2d971a50d76e6d34 2017-03-31 00:54:46 From: Sachi King Date: 2017-03-31 00:54:46 Subject: [PATCH] Mass style-check update Seems okay. --- diff --git a/pinaxcon/csrf_view.py b/pinaxcon/csrf_view.py index 23b008cbf61ab28d8fe0a93cfc6e94b37d8b8ca5..46509f5ad023be631d4ada5b02ba6311aa1a4ea2 100644 --- a/pinaxcon/csrf_view.py +++ b/pinaxcon/csrf_view.py @@ -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 diff --git a/pinaxcon/disable_cscache.py b/pinaxcon/disable_cscache.py index 2a49643351243eac8f7e4e4cd29613ed855050fe..de91656ff8e7e861656057dd30d0226db58c90f7 100644 --- a/pinaxcon/disable_cscache.py +++ b/pinaxcon/disable_cscache.py @@ -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 - diff --git a/pinaxcon/monkey_patch.py b/pinaxcon/monkey_patch.py index 609aec835b4cea6e8e79e72753d3c8b975a605d5..a85fe1e658850581eda04758dd7d6b93f7b8e0b8 100644 --- a/pinaxcon/monkey_patch.py +++ b/pinaxcon/monkey_patch.py @@ -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 diff --git a/pinaxcon/proposals/admin.py b/pinaxcon/proposals/admin.py index 125ae17688e164f594824a8c4ad2aeaed9939028..eac78362f0a5c5310b7de7137b480c8b972eaffe 100644 --- a/pinaxcon/proposals/admin.py +++ b/pinaxcon/proposals/admin.py @@ -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): diff --git a/pinaxcon/proposals/forms.py b/pinaxcon/proposals/forms.py index 1e452a762c0d95a0dcb234b0e6a68ef430fa927b..c9b70753402a1c98002de568130c17465db633df 100644 --- a/pinaxcon/proposals/forms.py +++ b/pinaxcon/proposals/forms.py @@ -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(), } diff --git a/pinaxcon/proposals/models.py b/pinaxcon/proposals/models.py index 42993ac3abd99a9b510c526339e0f208ac574ca1..ad5aecb3cb293b1ffe022ceb512f7da07252a7d9 100644 --- a/pinaxcon/proposals/models.py +++ b/pinaxcon/proposals/models.py @@ -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" diff --git a/pinaxcon/registrasion/forms.py b/pinaxcon/registrasion/forms.py index ce37ea05070c9b0512c94d5d9ee5268f01a851b3..20145f593a7df4d108e7a24a37a5d9e7dfe58e6a 100644 --- a/pinaxcon/registrasion/forms.py +++ b/pinaxcon/registrasion/forms.py @@ -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", ) diff --git a/pinaxcon/registrasion/management/commands/populate_inventory.py b/pinaxcon/registrasion/management/commands/populate_inventory.py index bbe4728f7c804d9512fe6f312cd528fcd1f0588b..b787f1495781524a40110629fbb4701f0ecc2e4a 100644 --- a/pinaxcon/registrasion/management/commands/populate_inventory.py +++ b/pinaxcon/registrasion/management/commands/populate_inventory.py @@ -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, ) diff --git a/pinaxcon/registrasion/views.py b/pinaxcon/registrasion/views.py index 636707cc59cd822a8fdaaaeee75cd7c6605aefea..5f9d52f9c425b95c6b7b4c2b3a2cbf3dc7c8d2f4 100644 --- a/pinaxcon/registrasion/views.py +++ b/pinaxcon/registrasion/views.py @@ -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) diff --git a/pinaxcon/settings.py b/pinaxcon/settings.py index b446e855d338505bc1a2b8127bdb0a72306d7cd5..e0091db45ddd05fd0d3d15c75ac04a7f1b4553d0 100644 --- a/pinaxcon/settings.py +++ b/pinaxcon/settings.py @@ -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 diff --git a/pinaxcon/templatetags/lca2017_tags.py b/pinaxcon/templatetags/lca2017_tags.py index 2519271f5b588cfd5831c43094ca7e336847edd7..bb321a04f22b6b4dcf680616eab216c85f293eb4 100644 --- a/pinaxcon/templatetags/lca2017_tags.py +++ b/pinaxcon/templatetags/lca2017_tags.py @@ -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: diff --git a/pinaxcon/templatetags/pyconau2017_tags.py b/pinaxcon/templatetags/pyconau2017_tags.py index 1e8e0d52078c93c0e80ee0dc6e84cbc1af667861..cc3bd229fd9e6699d6d9803aff8a3382c36a4431 100644 --- a/pinaxcon/templatetags/pyconau2017_tags.py +++ b/pinaxcon/templatetags/pyconau2017_tags.py @@ -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 "" \ No newline at end of file + return "" diff --git a/pinaxcon/urls.py b/pinaxcon/urls.py index 17d2208460753438e0ad05f3bb7e6a5613e9c621..756d97f588173b021c62d370bb3911cc804994e2 100644 --- a/pinaxcon/urls.py +++ b/pinaxcon/urls.py @@ -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) diff --git a/pinaxcon/widgets.py b/pinaxcon/widgets.py index 3053ddc630a072eba67e477534dc9c6b645a5461..f3a3e6a0d10eb038de00fe29eb97ca6d43f6587f 100644 --- a/pinaxcon/widgets.py +++ b/pinaxcon/widgets.py @@ -1,5 +1,6 @@ from django import forms + class AceMarkdownEditor(forms.Textarea): def render(self, name, value, attrs):