Ben Sturmfels
6a8515358b
It's a little confusing having both a "supporter" and "supporters" app. This is a fairly minor change to move the sustainer banner urls/views into the existing "supporters" app. The functionality isn't directly related, but it is all about sustainers.
19 lines
608 B
Python
19 lines
608 B
Python
from django.shortcuts import render
|
|
|
|
from .. import ParameterValidator
|
|
|
|
|
|
def index(request):
|
|
with ParameterValidator(request.GET, 'upgrade_id') as validator:
|
|
try:
|
|
amount_param = float(request.GET['upgrade'])
|
|
except (KeyError, ValueError):
|
|
validator.fail()
|
|
else:
|
|
validator.validate('{:.2f}'.format(amount_param))
|
|
partial_amount = amount_param if validator.valid else 0
|
|
context = {
|
|
'partial_amount': partial_amount,
|
|
'minimum_amount': 120 - partial_amount,
|
|
}
|
|
return render(request, "supporter/index.html", context)
|