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

Move to __str__ and str.format(...) over % and u"unicode" strings.

parent c46e48bd
......@@ -31,8 +31,8 @@ class Submission(models.Model):
ordering = ('created',)
get_latest_by = 'created'
def __unicode__(self):
return u"pk=%d buildinfo=%r" % (self.pk, self.buildinfo)
def __str__(self):
return "pk={} buildinfo={!r}".format(self.pk, self.buildinfo)
def get_absolute_url(self):
return reverse(
......
......@@ -37,7 +37,7 @@ class Buildinfo(models.Model):
ordering = ('-created',)
get_latest_by = 'created'
def __unicode__(self):
def __str__(self):
return u"pk=%d source=%r version=%r" % (
self.pk,
self.source,
......@@ -83,7 +83,7 @@ class Binary(models.Model):
get_latest_by = 'created'
unique_together = (('buildinfo', 'binary'),)
def __unicode__(self):
def __str__(self):
return u"pk=%d binary=%r" % (self.pk, self.binary)
......@@ -115,8 +115,8 @@ class Checksum(models.Model):
get_latest_by = 'created'
unique_together = (('buildinfo', 'filename'),)
def __unicode__(self):
return u"pk=%d filename=%r" % (self.pk, self.filename)
def __str__(self):
return "pk={} filename={!r}".format(self.pk, self.filename)
class Origin(models.Model):
......@@ -128,5 +128,5 @@ class Origin(models.Model):
ordering = ('name',)
get_latest_by = 'created'
def __unicode__(self):
return u"pk=%d name=%r" % (self.pk, self.name)
def __str__(self):
return "pk={} name=%r".format(self.pk, self.name)
......@@ -14,8 +14,8 @@ class Key(models.Model):
ordering = ('-created',)
get_latest_by = 'created'
def __unicode__(self):
return u"pk=%d uid=%r name=%r" % (self.pk, self.uid, self.name)
def __str__(self):
return "pk={} uid={!r} name={!r}".format(self.pk, self.uid, self.name)
def save(self, *args, **kwargs):
created = not self.pk
......
......@@ -13,8 +13,8 @@ class Source(models.Model):
ordering = ('name',)
get_latest_by = 'created'
def __unicode__(self):
return u"pk=%d name=%r" % (self.pk, self.name)
def __str__(self):
return "pk={} name={!r}".format(self.pk, self.name)
def get_absolute_url(self):
return reverse('packages:source', args=(self.name,))
......@@ -27,8 +27,8 @@ class Binary(models.Model):
ordering = ('name',)
get_latest_by = 'created'
def __unicode__(self):
return u"pk=%d name=%r" % (self.pk, self.name)
def __str__(self):
return "pk={} name={!r}".format(self.pk, self.name)
def get_absolute_url(self):
return reverse('packages:binary', args=(self.name,))
......@@ -43,5 +43,5 @@ class Architecture(models.Model):
ordering = ('name',)
get_latest_by = 'created'
def __unicode__(self):
return u"pk=%d name=%r" % (self.pk, self.name)
def __str__(self):
return "pk={} name={!r}".format(self.pk, 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