diff --git a/pinaxcon/templates/dashboard.html b/pinaxcon/templates/dashboard.html index ae336c11..ea74ad20 100644 --- a/pinaxcon/templates/dashboard.html +++ b/pinaxcon/templates/dashboard.html @@ -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 %} diff --git a/vendor/registrasion/registrasion/templatetags/registrasion_tags.py b/vendor/registrasion/registrasion/templatetags/registrasion_tags.py index 4c4a324e..73af25c6 100644 --- a/vendor/registrasion/registrasion/templatetags/registrasion_tags.py +++ b/vendor/registrasion/registrasion/templatetags/registrasion_tags.py @@ -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.