@@ -27,8 +27,6 @@ import re
from django.contrib.auth.models import User
from django.conf import settings
-from django.contrib.sites.models import Site
-from django.core.urlresolvers import reverse
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.functional import cached_property
@@ -721,17 +719,6 @@ class Bundle(models.Model):
return BundlePatch.objects.create(bundle=self, patch=patch,
order=max_order + 1)
- def public_url(self):
- if not self.public:
- return None
- site = Site.objects.get_current()
- return 'http://%s%s' % (site.domain,
- reverse('bundle-detail',
- kwargs={
- 'username': self.owner.username,
- 'bundlename': self.name
- }))
-
def is_editable(self, user):
if not user.is_authenticated():
return False
@@ -24,12 +24,11 @@
<td>{{ bundle.project.linkname }}</td>
<td>
{% if bundle.public %}
- <a href="{{ bundle.public_url }}">{{ bundle.public_url }}</a>
+ <a href="{{ bundle.get_mbox_url }}">{{ bundle.get_mbox_url }}</a>
{% endif %}
</td>
<td style="text-align: right">{{ bundle.patches.count }}</td>
- <td style="text-align: center;"><a
- href="{% url 'bundle-mbox' username=bundle.owner.username bundlename=bundle.name %}"
+ <td style="text-align: center;"><ahref="{{ bundle.get_mbox_url }}"
><span class="glyphicon glyphicon-download-alt"></span></a></td>
<td style="text-align: center;">
<form method="post"
@@ -314,7 +314,7 @@ def bundle_to_dict(obj):
'id': obj.id,
'name': obj.name,
'n_patches': obj.patches.count(),
- 'public_url': obj.public_url(),
+ 'public_url': obj.get_mbox_url(),
}
We now have 'get_mbox_url' which is consistent with patches. Let's drop the older one. Signed-off-by: Stephen Finucane <stephen@that.guru> Cc: Daniel Axtens <dja@axtens.net> --- patchwork/models.py | 13 ------------- patchwork/templates/patchwork/bundles.html | 5 ++--- patchwork/views/xmlrpc.py | 2 +- 3 files changed, 3 insertions(+), 17 deletions(-)