can_propose only if there are changed objects

This commit is contained in:
Laura Klünder 2017-07-05 21:06:17 +02:00
parent 7973a9e632
commit 1ba2df6116
3 changed files with 3 additions and 2 deletions

View file

@ -292,7 +292,7 @@ class ChangeSet(models.Model):
return self.can_edit(request) and self.state == 'unproposed'
def can_propose(self, request):
return self.can_edit(request) and not self.proposed
return self.can_edit(request) and not self.proposed and self.changed_objects_count
def can_unpropose(self, request):
return self.author_id == request.user.pk and self.state in ('proposed', 'reproposed')

View file

@ -134,7 +134,7 @@
{% if can_edit %}
<a href="{% url 'editor.changesets.edit' pk=changeset.pk %}" class="btn btn-default">{% trans 'Edit' %}</a>
{% endif %}
{% if can_edit and not changeset.proposed %}
{% if can_propose %}
<button type="submit" class="btn btn-primary" name="propose" value="1">{% trans 'Propose' %}</button>
{% endif %}
{% if can_start_review %}

View file

@ -318,6 +318,7 @@ def changeset_detail(request, pk):
'changeset': changeset,
'can_edit': can_edit,
'can_delete': can_delete,
'can_propose': changeset.can_propose(request),
'can_unpropose': changeset.can_unpropose(request),
'can_start_review': changeset.can_start_review(request),
'can_end_review': changeset.can_end_review(request),