change __unicode__()s to __str__()s

This commit is contained in:
Brian S. Stephan 2016-01-16 18:21:46 -06:00
parent 9112ad0ae7
commit 47a1352a0a
11 changed files with 23 additions and 23 deletions

View File

@ -18,7 +18,7 @@ class CountdownItem(models.Model):
created_time = models.DateTimeField(auto_now_add=True)
def __unicode__(self):
def __str__(self):
"""String representation."""
return "{0:s} @ {1:s}".format(self.name, timezone.localtime(self.at_time).strftime('%Y-%m-%d %H:%M:%S %Z'))

View File

@ -19,7 +19,7 @@ class Dispatcher(models.Model):
('send_message', "Can send messages to dispatchers"),
)
def __unicode__(self):
def __str__(self):
"""String representation."""
return "{0:s}".format(self.key)
@ -42,7 +42,7 @@ class DispatcherAction(models.Model):
destination = models.CharField(max_length=200)
include_key = models.BooleanField(default=False)
def __unicode__(self):
def __str__(self):
"""String representation."""
return "{0:s} -> {1:s} {2:s}".format(self.dispatcher.key, self.type, self.destination)

View File

@ -19,7 +19,7 @@ class FactCategory(models.Model):
class Meta:
verbose_name_plural = 'fact categories'
def __unicode__(self):
def __str__(self):
"""String representation."""
return "{0:s}".format(self.name)
@ -58,7 +58,7 @@ class Fact(models.Model):
objects = FactManager()
def __unicode__(self):
def __str__(self):
"""String representation."""
return "{0:s} - {1:s}".format(self.category.name, self.fact)

View File

@ -29,7 +29,7 @@ class Alias(models.Model):
class Meta:
verbose_name_plural = "aliases"
def __unicode__(self):
def __str__(self):
"""String representation."""
return "{0:s} -> {1:s}".format(self.pattern, self.replacement)
@ -54,7 +54,7 @@ class BotUser(models.Model):
('quit_bot', "Can tell the bot to quit via IRC"),
)
def __unicode__(self):
def __str__(self):
"""String representation."""
return "{0:s} (Django user {1:s})".format(self.nickmask, self.user.username)
@ -78,7 +78,7 @@ class IrcChannel(models.Model):
('manage_current_channels', "Can join/part channels via IRC"),
)
def __unicode__(self):
def __str__(self):
"""String representation."""
return "{0:s}".format(self.name)
@ -97,7 +97,7 @@ class IrcPlugin(models.Model):
('manage_loaded_plugins', "Can load/unload plugins via IRC"),
)
def __unicode__(self):
def __str__(self):
"""String representation."""
return "{0:s}".format(self.path)

View File

@ -33,7 +33,7 @@ class KarmaKey(models.Model):
objects = KarmaKeyManager()
def __unicode__(self):
def __str__(self):
"""String representation."""
return "{0:s} ({1:d})".format(self.key, self.score())
@ -84,7 +84,7 @@ class KarmaLogEntry(models.Model):
class Meta:
verbose_name_plural = 'karma log entries'
def __unicode__(self):
def __str__(self):
"""String representation."""
tz = pytz.timezone(settings.TIME_ZONE)

View File

@ -17,7 +17,7 @@ class MarkovContext(models.Model):
name = models.CharField(max_length=200, unique=True)
def __unicode__(self):
def __str__(self):
"""String representation."""
return "{0:s}".format(self.name)
@ -32,7 +32,7 @@ class MarkovTarget(models.Model):
chatter_chance = models.IntegerField(default=0)
def __unicode__(self):
def __str__(self):
"""String representation."""
return "{0:s} -> {1:s}".format(self.name, self.context.name)
@ -64,7 +64,7 @@ class MarkovState(models.Model):
}
unique_together = ('context', 'k1', 'k2', 'v')
def __unicode__(self):
def __str__(self):
"""String representation."""
return "{0:s},{1:s} -> {2:s} (count: {3:d})".format(self.k1, self.k2, self.v, self.count)

View File

@ -54,7 +54,7 @@ class PiLog(models.Model):
class Meta:
get_latest_by = 'created'
def __unicode__(self):
def __str__(self):
"""String representation."""
tz = pytz.timezone(settings.TIME_ZONE)

View File

@ -17,7 +17,7 @@ class Race(models.Model):
name = models.CharField(max_length=255)
description = models.TextField()
def __unicode__(self):
def __str__(self):
"""Text representation of a race."""
return "{0:s} ({1:s})".format(self.name, self.key)
@ -37,7 +37,7 @@ class Racer(models.Model):
class Meta:
unique_together = ('nick', 'race')
def __unicode__(self):
def __str__(self):
"""Text representation of a race racer."""
return "{0:s} in {1:s}".format(self.nick, self.race.name)
@ -55,7 +55,7 @@ class RaceUpdate(models.Model):
class Meta:
ordering = ['event_time',]
def __unicode__(self):
def __str__(self):
"""Text representation of a race update."""
local_time = timezone.localtime(self.event_time)

View File

@ -4,7 +4,7 @@ from seen.models import SeenNick
class SeenNickAdmin(admin.ModelAdmin):
list_display = ('__unicode__', 'seen_time')
list_display = ('__str__', 'seen_time')
admin.site.register(SeenNick, SeenNickAdmin)

View File

@ -17,7 +17,7 @@ class SeenNick(models.Model):
ordering = ['-seen_time',]
unique_together = ('nick', 'channel')
def __unicode__(self):
def __str__(self):
"""String representation of a seen nick."""
local_time = timezone.localtime(self.seen_time)

View File

@ -34,7 +34,7 @@ class StorycraftGame(models.Model):
start_time = models.DateTimeField(null=True)
end_time = models.DateTimeField(null=True)
def __unicode__(self):
def __str__(self):
"""String representation."""
return "Storycraft game {0:d}: {1:s}; {2:s}".format(self.pk, self.summary(), self.get_progress_string())
@ -93,7 +93,7 @@ class StorycraftPlayer(models.Model):
nick = models.CharField(max_length=64)
nickmask = models.CharField(max_length=200)
def __unicode__(self):
def __str__(self):
"""String representation."""
return "{0:s} in storycraft game {1:d}".format(self.nick, self.game.pk)
@ -108,7 +108,7 @@ class StorycraftLine(models.Model):
line = models.TextField(default="")
time = models.DateTimeField(auto_now_add=True)
def __unicode__(self):
def __str__(self):
"""String representation."""
return "line by {0:s} in storycraft game {1:d}".format(self.player.nick, self.game.pk)