Commit a3846f20 authored by Chris Lamb's avatar Chris Lamb 💬

Django 2.x dropped @models.permalink

parent d27540da
......@@ -2,6 +2,7 @@ import datetime
import functools
from django.db import models
from django.urls import reverse
from django.utils.crypto import get_random_string
......@@ -29,11 +30,14 @@ class Submission(models.Model):
def __unicode__(self):
return u"pk=%d buildinfo=%r" % (self.pk, self.buildinfo)
@models.permalink
def get_absolute_url(self):
return (
return reverse(
'buildinfo:submissions:view',
(self.buildinfo.sha1, self.buildinfo.get_filename(), self.slug),
args=(
self.buildinfo.sha1,
self.buildinfo.get_filename(),
self.slug,
),
)
def get_storage_name(self):
......
import datetime
from django.db import models
from django.urls import reverse
class Buildinfo(models.Model):
......@@ -35,13 +36,13 @@ class Buildinfo(models.Model):
self.version,
)
@models.permalink
def get_absolute_url(self):
return 'buildinfo:view', (self.sha1, self.get_filename())
return reverse('buildinfo:view', args=(self.sha1, self.get_filename()))
@models.permalink
def get_absolute_raw_url(self):
return 'buildinfo:raw-text', (self.sha1, self.get_filename())
return reverse(
'buildinfo:raw-text', args=(self.sha1, self.get_filename())
)
def get_filename(self):
return '{}_{}_{}'.format(
......
import datetime
from django.db import models
from django.urls import reverse
class Source(models.Model):
......@@ -15,9 +16,8 @@ class Source(models.Model):
def __unicode__(self):
return u"pk=%d name=%r" % (self.pk, self.name)
@models.permalink
def get_absolute_url(self):
return 'packages:source', (self.name,)
return reverse('packages:source', args=(self.name,))
class Binary(models.Model):
......@@ -30,9 +30,8 @@ class Binary(models.Model):
def __unicode__(self):
return u"pk=%d name=%r" % (self.pk, self.name)
@models.permalink
def get_absolute_url(self):
return 'packages:binary', (self.name,)
return reverse('packages:binary', args=(self.name,))
class Architecture(models.Model):
......
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