Fix display of registration on dashboard
Ensure the registration information is displayed to any user who can use a component of the section, regardless of if there are available categories for them to purchase from.
This commit is contained in:
parent
5c8f05da69
commit
ebaeedb076
2 changed files with 22 additions and 2 deletions
|
|
@ -16,8 +16,8 @@
|
|||
|
||||
{% block content %}
|
||||
|
||||
{% available_categories as categories %}
|
||||
{% if categories %}
|
||||
{% registration_available as show_registration %}
|
||||
{% if show_registration %}
|
||||
{% include "symposion/dashboard/_categories.html" %}
|
||||
{% endif %}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,25 @@ def user_for_context(context):
|
|||
return context.request.user
|
||||
|
||||
|
||||
@register.simple_tag(takes_context=True)
|
||||
def registration_available(context):
|
||||
''' Checks if registration is available for the user. '''
|
||||
user = user_for_context(context)
|
||||
if user.is_staff:
|
||||
# Staff can always see registration - not necessarily all parts.
|
||||
return True
|
||||
|
||||
if user.attendee.completed_registration:
|
||||
# Always show to someone who has completed registration already.
|
||||
return True
|
||||
|
||||
if available_categories(context):
|
||||
# Not yet registered, but has categories available to purchase from.
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
@register.simple_tag(takes_context=True)
|
||||
def available_categories(context):
|
||||
''' Gets all of the currently available products.
|
||||
|
|
@ -49,6 +68,7 @@ def missing_categories(context):
|
|||
|
||||
return sorted(set(i for i in missing), key=attrgetter("order"))
|
||||
|
||||
|
||||
@register.simple_tag(takes_context=True)
|
||||
def available_credit(context):
|
||||
''' Calculates the sum of unclaimed credit from this user's credit notes.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue