Commit 254fefa8 authored by Michal Čihař's avatar Michal Čihař

Simplify property access

Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent c07e75fa
......@@ -115,7 +115,7 @@
{% if perms.trans.lock_subproject and object.is_lockable %}
{% if object.is_git_locked %}
{% if object.locked %}
<tr>
<td>
<a href="{{ object.get_unlock_url }}" class="btn btn-default">{% trans "Unlock" %}</a>
......
......@@ -284,7 +284,8 @@ class Project(models.Model, PercentMixin, URLMixin, PathMixin):
reverse('engage', kwargs={'project': self.slug})
)
def is_git_locked(self):
@property
def locked(self):
subprojects = self.subproject_set.all()
if len(subprojects) == 0:
return False
......
......@@ -312,9 +312,6 @@ class SubProject(models.Model, PercentMixin, URLMixin, PathMixin):
reverse('engage', kwargs={'project': self.project.slug})
)
def is_git_locked(self):
return self.locked
def __unicode__(self):
return '%s/%s' % (self.project.__unicode__(), self.name)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment