Skip to content

Commit

Permalink
Replace __unicode__ with __str__
Browse files Browse the repository at this point in the history
https://docs.djangoproject.com/en/1.11/topics/python3/#str-and-unicode-methods

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
  • Loading branch information
MauricioFauth committed Mar 17, 2023
1 parent afb0782 commit 6b48961
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion files/management/commands/import_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def process_snapshots(self, path):
)
if modified:
for download in release.download_set.all():
filename = download.__unicode__()
filename = download.__str__()
purge.extend([
filename,
'/snapshots/phpMyAdmin-{}.json'.format(version),
Expand Down
14 changes: 7 additions & 7 deletions files/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class Release(models.Model):
class Meta(object):
ordering = ['-version_num']

def __unicode__(self):
def __str__(self):
return self.version

def get_absolute_url(self):
Expand Down Expand Up @@ -330,7 +330,7 @@ class Meta(object):
ordering = ['-release__version_num', 'filename']
unique_together = ['release', 'filename']

def __unicode__(self):
def __str__(self):
if self.release.snapshot:
return '/snapshots/{0}'.format(
self.filename
Expand Down Expand Up @@ -358,24 +358,24 @@ def get_filesystem_path(self):

def get_absolute_url(self):
return 'https://files.phpmyadmin.net{0}'.format(
self.__unicode__()
self.__str__()
)

def get_signed_url(self):
if not self.signed:
return ''
return 'https://files.phpmyadmin.net{0}.asc'.format(
self.__unicode__()
self.__str__()
)

def get_checksum_url(self):
return 'https://files.phpmyadmin.net{0}.sha256'.format(
self.__unicode__()
self.__str__()
)

def get_alternate_url(self):
return 'https://1126968067.rsc.cdn77.org{0}'.format(
self.__unicode__()
self.__str__()
)

@property
Expand Down Expand Up @@ -433,7 +433,7 @@ class Theme(models.Model):
class Meta(object):
ordering = ['name', 'version']

def __unicode__(self):
def __str__(self):
return '{0} {1}'.format(self.display_name, self.version)

@property
Expand Down
4 changes: 2 additions & 2 deletions news/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Post(models.Model):
class Meta(object):
ordering = ['-date']

def __unicode__(self):
def __str__(self):
return self.title

@models.permalink
Expand All @@ -68,7 +68,7 @@ class Planet(models.Model):
class Meta(object):
ordering = ['-date']

def __unicode__(self):
def __str__(self):
return self.title

def get_absolute_url(self):
Expand Down
2 changes: 1 addition & 1 deletion security/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@


class PMASAAdmin(admin.ModelAdmin):
list_display = ('__unicode__', 'date', 'updated', 'summary', 'draft')
list_display = ('__str__', 'date', 'updated', 'summary', 'draft')
search_fields = ('summary', 'description')
date_hierarchy = 'date'
list_filter = ('draft',)
Expand Down
2 changes: 1 addition & 1 deletion security/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class Meta(object):
verbose_name = 'PMASA'
verbose_name_plural = 'PMASAs'

def __unicode__(self):
def __str__(self):
return 'PMASA-{0}-{1}'.format(self.year, self.sequence)

@models.permalink
Expand Down
2 changes: 1 addition & 1 deletion translations/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Translation(models.Model):
class Meta(object):
ordering = ['name']

def __unicode__(self):
def __str__(self):
return self.name

def get_absolute_url(self):
Expand Down

0 comments on commit 6b48961

Please sign in to comment.