addressing feedback

pull/1/head
Andromeda Yelton 2013-01-04 15:12:35 -05:00
parent 23d48e6183
commit fa7e0b20de
2 changed files with 10 additions and 6 deletions

View File

@ -792,12 +792,16 @@ class Work(models.Model):
return False
@property
def rightsholders(self):
def user_with_rights(self):
"""
return all users who are rights holders with active claims to the work
return queryset of users (should be at most one) who act for rights holders with active claims to the work
"""
rightsholders = RightsHolder.objects.filter(claim__in=Claim.objects.filter(work=self).filter(status='active'))
return User.objects.filter(rights_holder__in=rightsholders)
claims = self.claim.filter(status='active')
assert claims.count() < 2, "There is more than one active claim on %r" % self.title
try:
return claims[0].user
except:
return False
class Author(models.Model):
created = models.DateTimeField(auto_now_add=True)

View File

@ -45,12 +45,12 @@ $j(document).ready(function(){
<div class="launch_top pale">Hi, {{ request.user.username }}. Since you're a manager for this campaign, you can <a href="{% url manage_campaign id=work.last_campaign.id %}">edit this campaign</a>.</div>
{% endif %}
{% else %}
{% if not work.rightsholders %}
{% if not work.user_with_rights %}
{% if request.user.rights_holder.all %}
<div class="launch_top pale">Hi, {{ request.user.username }}. Since you're an authorized Unglue.it rights holder, if you own the worldwide electronic rights to this work, you may claim it through the Rights tab. Need help? There's a screencast of the process at the <a href="{% url rightsholders %}">rights holder tools page</a>.</div>
{% endif %}
{% else %}
{% if request.user in work.rightsholders %}
{% if request.user == work.user_with_rights %}
{% ifequal work.last_campaign.status 'SUCCESSFUL' %}
<div class="launch_top pale">Congratulations, {{ request.user.username }}; you successfully unglued this work! What are your plans for publicity and distribution? We're happy to brainstorm with you about next steps.</div>
{% else %}