Fixing python3
This commit is contained in:
Awais Qureshi
2019-09-20 16:11:47 +05:00
parent 718fb0f5b8
commit 75b5fffb87

View File

@@ -375,6 +375,7 @@ class RestrictedCourse(models.Model):
log.info("Invalidated cached messaging URLs ")
@python_2_unicode_compatible
class Country(models.Model):
"""Representation of a country.
@@ -389,7 +390,7 @@ class Country(models.Model):
help_text=ugettext_lazy(u"Two character ISO country code.")
)
def __unicode__(self):
def __str__(self):
return u"{name} ({code})".format(
name=six.text_type(self.country.name),
code=six.text_type(self.country)
@@ -400,6 +401,7 @@ class Country(models.Model):
ordering = ['country']
@python_2_unicode_compatible
class CountryAccessRule(models.Model):
"""Course access rule based on the user's country.
@@ -522,7 +524,7 @@ class CountryAccessRule(models.Model):
# that have access to the course.
return list(whitelist_countries - blacklist_countries)
def __unicode__(self):
def __str__(self):
if self.rule_type == self.WHITELIST_RULE:
return _(u"Whitelist {country} for {course}").format(
course=six.text_type(self.restricted_course.course_key),