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