From 0454bf741ad07b53965f62049be3b9f2c2a50f35 Mon Sep 17 00:00:00 2001 From: Marcus Martins Date: Mon, 5 Jan 2015 17:20:24 -0800 Subject: [PATCH] Adding unicode support for python3 --- defender/models.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/defender/models.py b/defender/models.py index 2f38395..f721264 100644 --- a/defender/models.py +++ b/defender/models.py @@ -1,6 +1,10 @@ +from __future__ import unicode_literals + from django.db import models +from django.utils.encoding import python_2_unicode_compatible +@python_2_unicode_compatible class AccessAttempt(models.Model): user_agent = models.CharField( max_length=255, @@ -31,8 +35,8 @@ class AccessAttempt(models.Model): class Meta: ordering = ['-attempt_time'] - def __unicode__(self): + def __str__(self): """ unicode value for this model """ - return u"{0} @ {1} | {2}".format(self.username, - self.attempt_time, - self.login_valid) + return "{0} @ {1} | {2}".format(self.username, + self.attempt_time, + self.login_valid)