Changeset - 5380a510d53c
[Not reviewed]
0 2 0
Joel Addison - 5 years ago 2019-10-13 11:34:08
joel@addison.net.au
Fix display of GST amount

Move GST rate to settings. Set to Australian GST rate.
2 files changed with 5 insertions and 1 deletions:
0 comments (0 inline, 0 general)
pinaxcon/settings.py
Show inline comments
...
 
@@ -338,64 +338,65 @@ AUTHENTICATION_BACKENDS = [
 
    'symposion.teams.backends.TeamPermissionsBackend',
 
    'django.contrib.auth.backends.ModelBackend',
 
    'djangosaml2.backends.Saml2Backend',
 
]
 

	
 
LOGIN_URL = '/saml2/login/'
 
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
 

	
 
CONFERENCE_ID = 1
 
PROPOSAL_FORMS = {
 
    "talk": "pinaxcon.proposals.forms.TalkProposalForm",
 
    "tutorial": "pinaxcon.proposals.forms.TutorialProposalForm",
 
    "miniconf": "pinaxcon.proposals.forms.MiniconfProposalForm",
 
    ### LCA2020 Miniconfs
 
    "containers-miniconf": "pinaxcon.proposals.forms.ContainersProposalForm",
 
    "creative-arts-miniconf": "pinaxcon.proposals.forms.CreativeArtsProposalForm",
 
    "docs-miniconf": "pinaxcon.proposals.forms.DocsProposalForm",
 
    "freebsd-miniconf": "pinaxcon.proposals.forms.FreeBsdProposalForm",
 
    "games-miniconf": "pinaxcon.proposals.forms.GamesProposalForm",
 
    "glam-miniconf": "pinaxcon.proposals.forms.GlamProposalForm",
 
    "kernel-miniconf": "pinaxcon.proposals.forms.KernelProposalForm",
 
    "open-education-miniconf": "pinaxcon.proposals.forms.OpenEducationProposalForm",
 
    "open-hardware-miniconf": "pinaxcon.proposals.forms.OpenHardwareProposalForm",
 
    "open-isa-miniconf": "pinaxcon.proposals.forms.OpenIsaProposalForm",
 
    "security-miniconf": "pinaxcon.proposals.forms.SecurityProposalForm",
 
    "sysadmin-miniconf": "pinaxcon.proposals.forms.SysAdminProposalForm",
 
}
 

	
 
# Registrasion bits:
 
ATTENDEE_PROFILE_MODEL = "pinaxcon.registrasion.models.AttendeeProfile"
 
ATTENDEE_PROFILE_FORM = "pinaxcon.registrasion.forms.ProfileForm"
 
INVOICE_CURRENCY = "AUD"
 
GST_RATE =  Decimal('0.1')
 
TICKET_PRODUCT_CATEGORY = 1
 
TERMS_PRODUCT_CATEGORY = 2
 
ATTENDEE_PROFILE_FORM = "pinaxcon.registrasion.forms.ProfileForm"
 

	
 
#REGIDESK
 
REGIDESK_BOARDING_GROUP = "Ready For Boarding"
 

	
 
# CSRF custom error screen
 
CSRF_FAILURE_VIEW = "pinaxcon.csrf_view.csrf_failure"
 

	
 
# Use nose to run all tests
 
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
 

	
 
# Tell nose to measure coverage on the 'foo' and 'bar' apps
 
NOSE_ARGS = [
 
    '--with-coverage',
 
    '--cover-package=registrasion.controllers,registrasion.models',
 
]
 

	
 
SASS_PROCESSOR_INCLUDE_DIRS = [
 
    os.path.join(PROJECT_ROOT, 'static/src/bootstrap/scss'),
 
    os.path.join(PROJECT_ROOT, 'static/src/scss'),
 
]
 

	
 
xmlsec_binary = '/usr/bin/xmlsec1'
 
if not os.path.isfile(xmlsec_binary):
 
        sys.exit('ERROR: xmlsec1 binary missing, EXITING')
 

	
 
SAML_ATTRIBUTE_MAPPING = {
 
    'uid': ('username', ),
 
    'mail': ('email', ),
 
    'givenName': ('first_name', ),
pinaxcon/templatetags/lca2018_tags.py
Show inline comments
 
import hashlib
 

	
 
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
 
from registrasion.templatetags import registrasion_tags
 
from symposion.conference import models as conference_models
 
from symposion.schedule.models import Track
 

	
 
CONFERENCE_ID = settings.CONFERENCE_ID
 
GST_RATE = settings.GST_RATE
 

	
 
register = template.Library()
 

	
 

	
 
@register.assignment_tag()
 
def classname(ob):
 
    return ob.__class__.__name__
 

	
 

	
 
@register.simple_tag(takes_context=True)
 
def can_manage(context, proposal):
 
    return proposal_permission(context, "manage", proposal)
 

	
 

	
 
@register.simple_tag(takes_context=True)
 
def can_review(context, proposal):
 
    return proposal_permission(context, "review", proposal)
 

	
 

	
 
def proposal_permission(context, permname, proposal):
 
    slug = proposal.kind.section.slug
 
    perm = "reviews.can_%s_%s" % (permname, slug)
 
    return context.request.user.has_perm(perm)
 

	
 

	
 
@register.simple_tag(takes_context=False)
 
def illustration(name):
 
    return staticfiles.static('lca2018/images/') + name
 

	
 

	
 
@register.simple_tag(takes_context=True)
 
def speaker_photo(context, speaker, size):
 
    ''' Provides the speaker profile, or else fall back to libravatar or gravatar. '''
 

	
 
    if speaker.photo:
 
        thumbnailer = get_thumbnailer(speaker.photo)
 
        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()
 
        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, "mp")
 

	
 
        return url
 

	
 

	
 
@register.simple_tag()
 
def define(value):
 
    return value
 

	
 

	
 
@register.simple_tag()
 
def presentation_bg_number(presentation, count):
 
    return sum(ord(i) for i in presentation.title) % count
 

	
 

	
 
@register.filter()
 
def gst(amount):
 
    GST_RATE = Decimal('0.15')
 
    value_no_gst = Decimal(amount / (1 + GST_RATE))
 
    return Decimal(amount - value_no_gst).quantize(Decimal('0.01'))
 

	
 

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

	
 

	
 
@register.filter()
 
def day_has_tracks(timetable, day):
 
    try:
 
        track_names = day.track_set.all()
 
        has_tracks = True
 
    except Track.DoesNotExist:
 
        has_tracks = False
 
    return len(track_names)
 

	
 

	
 
@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(takes_context=True)
 
def ticket_type(context):
 

	
 
    # Default to purchased ticket type (only item from category 1)
 
    items = registrasion_tags.items_purchased(context, 1)
 

	
 
    if not items:
 
        return "NO TICKET"
 

	
 
    item = next(iter(items))
 
    name = item.product.name
 
    if name == "Conference Volunteer":
 
        return "Volunteer"
 
    elif name == "Conference Organiser":
 
        return "Organiser"
 
    else:
 
        ticket_type = name
 

	
 

	
 
    # Miniconfs are secion 2
 
    # General sessions are section 1
 

	
 
    user = registrasion_tags.user_for_context(context)
 

	
 
    if hasattr(user, "speaker_profile"):
 
        best = 0
 
        for presentation in user.speaker_profile.presentations.all():
 
            if presentation.section.id == 1:
 
                best = 1
 
            if best == 0 and presentation.section.id == 2:
 
                best = 2
 
        if best == 1:
0 comments (0 inline, 0 general)