fix regression in 5598b154c5

pull/91/head
eric 2018-06-20 11:36:15 -04:00
parent 2b2df9d3b5
commit 68ddec61c8
2 changed files with 9 additions and 5 deletions

View File

@ -44,6 +44,6 @@
</form>
{% endif %}
{% else %}
Please find a work to claim.
It appears you have reached this page in the wrong context. Please see <a href="{% url 'rightsholders' %}">information for rights holders</a>.
{% endif %}
{% endblock %}

View File

@ -1,5 +1,6 @@
from datetime import timedelta
from decimal import Decimal as D
import logging
from django.conf import settings
from django.core.urlresolvers import reverse, reverse_lazy
@ -23,6 +24,8 @@ from regluit.frontend.forms import (
)
from regluit.utils.localdatetime import date_today
logger = logging.getLogger(__name__)
class RHAgree(CreateView):
template_name = "rh_agree.html"
form_class = RightsHolderForm
@ -74,7 +77,7 @@ class ClaimView(CreateView):
return UserClaimForm(self.request.user, data=self.request.POST, prefix='claim')
def form_valid(self, form):
print form.cleaned_data
logger.info(form.cleaned_data)
work = form.cleaned_data['work']
rights_holder = form.cleaned_data['rights_holder']
if not rights_holder.approved:
@ -88,9 +91,10 @@ class ClaimView(CreateView):
return HttpResponseRedirect(reverse('rightsholders'))
def get_context_data(self, form):
if not form.is_valid():
return {'form': form}
try:
work = form.cleaned_data['work']
except AttributeError:
return {}
rights_holder = form.cleaned_data['rights_holder']
active_claims = work.claim.exclude(status = 'release')
return {