fixed bug where anonymous user can't view work page

pull/1/head
eric 2011-11-26 17:09:33 -05:00
parent e38d78ecc3
commit f96b5e4637
2 changed files with 6 additions and 2 deletions

View File

@ -157,6 +157,7 @@ $(document).ready(function(){
{% endfor %}
</ul>
{% endif %}
{% if not user.is_anonymous %}
{% if request.user.rights_holder.all.count %}
<h4> Claim this work:</h4>
<form method="GET" action="{% url claim %}">
@ -167,6 +168,7 @@ $(document).ready(function(){
<input type="submit" name="submit" value="Claim" id="submit">
</form>
{% endif %}
{% endif %}
</div>
</div>
</div>

View File

@ -59,8 +59,10 @@ def stub(request):
def work(request, work_id, action='display'):
work = get_object_or_404(models.Work, id=work_id)
campaign = work.last_campaign()
claimform = UserClaimForm( request.user, data={'work':work_id, 'user': request.user.id})
if not request.user.is_anonymous():
claimform = UserClaimForm( request.user, data={'work':work_id, 'user': request.user.id})
else:
claimform = None
if campaign:
q = Q(campaign=campaign) | Q(campaign__isnull=True)
premiums = models.Premium.objects.filter(q)