import django
from django.conf import settings
from django.contrib.auth.models import User
-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
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
- }))
-
@models.permalink
def get_absolute_url(self):
return ('bundle-detail', (), {
<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"
'id': obj.id,
'name': obj.name,
'n_patches': obj.patches.count(),
- 'public_url': obj.public_url(),
+ 'public_url': obj.get_mbox_url(),
}