Skip to content

Commit

Permalink
__unicode__ -> __str__
Browse files Browse the repository at this point in the history
  • Loading branch information
X455u committed Apr 26, 2015
1 parent bf65703 commit 357aee8
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion apps/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def get_absolute_url(self):
def get_label(self):
return self.label

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

def get_container(self):
Expand Down
6 changes: 3 additions & 3 deletions course/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def get_breadcrumb(self):
crumb_tuple = (str(self), self.get_absolute_url())
return [crumb_tuple]

def __unicode__(self):
def __str__(self):
'''
Returns a short representation of the course as an unicode string.
'''
Expand Down Expand Up @@ -197,7 +197,7 @@ def get_label(self):
'''
return _("Dashboard")

def __unicode__(self):
def __str__(self):
return self.course.code + ": " + self.instance_name

class Meta:
Expand Down Expand Up @@ -233,7 +233,7 @@ def trigger(self, data):
except:
logger.error("HTTP POST failed on %s hook to %s (%s)", self.hook_type, self.hook_url, self.course_instance)

def __unicode__(self):
def __str__(self):
return "%s -> %s" % (self.course_instance, self.hook_url)

def get_visible_open_course_instances(profile=None):
Expand Down
6 changes: 3 additions & 3 deletions exercise/exercise_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def is_after_open(self, when=None):
when = when or datetime.now()
return self.opening_time <= when

def __unicode__(self):
def __str__(self):
return self.name + " -- " + str(self.course_instance)

def get_breadcrumb(self):
Expand Down Expand Up @@ -131,7 +131,7 @@ class LearningObjectCategory(models.Model):
class Meta:
unique_together = ("name", "course_instance")

def __unicode__(self):
def __str__(self):
return self.name + " -- " + str(self.course_instance)

def get_exercises(self):
Expand Down Expand Up @@ -492,7 +492,7 @@ def get_submissions_for_student(self, userprofile):
"""
return userprofile.submissions.filter(exercise=self)

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

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

return ", ".join(submitter_strs)

def __unicode__(self):
def __str__(self):
return str(self.id)

# Status methods. The status indicates whether this submission is just
Expand Down
4 changes: 2 additions & 2 deletions external_services/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class LinkService(ModelWithInheritance):
class Meta:
ordering = ["menu_label"]

def __unicode__(self):
def __str__(self):
out = "%s: %s" % (self.menu_label, self.url)
if not self.enabled:
return "[Disabled] " + out
Expand Down Expand Up @@ -114,7 +114,7 @@ def url(self):
return reverse('external_services.views.lti_login', args=[self.id])
return self.service.url

def __unicode__(self):
def __str__(self):
out = "%s %s: " % (self.course_instance.course.code, self.course_instance.instance_name)
if not self.enabled or not self.service.enabled:
return "[Disabled] " + out
Expand Down
2 changes: 1 addition & 1 deletion notification/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def mark_as_seen(self):
self.seen = True
self.save()

def __unicode__(self):
def __str__(self):
return "To:" + self.recipient.user.username + ", " + self.subject + ", " + self.notification[:100]

class Meta:
Expand Down
8 changes: 4 additions & 4 deletions oauth_provider/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Nonce(models.Model):
consumer_key = models.CharField(max_length=CONSUMER_KEY_SIZE)
key = models.CharField(max_length=255)

def __unicode__(self):
def __str__(self):
return "Nonce %s for %s" % (self.key, self.consumer_key)


Expand All @@ -28,7 +28,7 @@ class Resource(models.Model):
url = models.TextField(max_length=MAX_URL_LENGTH)
is_readonly = models.BooleanField(default=True)

def __unicode__(self):
def __str__(self):
return "Resource %s with url %s" % (self.name, self.url)


Expand All @@ -42,7 +42,7 @@ class Consumer(models.Model):
status = models.SmallIntegerField(choices=CONSUMER_STATES, default=PENDING)
user = models.ForeignKey(User, null=True, blank=True)

def __unicode__(self):
def __str__(self):
return "Consumer %s with key %s" % (self.name, self.key)

def generate_random_codes(self):
Expand Down Expand Up @@ -77,7 +77,7 @@ class Token(models.Model):

objects = TokenManager()

def __unicode__(self):
def __str__(self):
return "%s Token %s for %s" % (self.get_token_type_display(), self.key, self.consumer)

def to_string(self, only_key=False):
Expand Down
4 changes: 2 additions & 2 deletions userprofile/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class UserProfile(models.Model):
def get_by_student_id(cls, student_id):
return cls.objects.get(student_id=student_id)

def __unicode__(self):
def __str__(self):
return self.user.username

def _generate_gravatar_url(self):
Expand Down Expand Up @@ -104,7 +104,7 @@ def add_member(self, new_member):
self.members.add(new_member)
return True

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

class Meta:
Expand Down

0 comments on commit 357aee8

Please sign in to comment.