mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-17 05:41:25 +02:00
Replace __unicode__ functions by python_2_unicode_compatible decorator
This commit is contained in:
@@ -315,6 +315,7 @@ class MXQuerySet(models.QuerySet):
|
||||
return self.exists()
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class MXRecord(models.Model):
|
||||
"""A model used to store MX records for Domain."""
|
||||
|
||||
@@ -331,9 +332,6 @@ class MXRecord(models.Model):
|
||||
return False
|
||||
return bool(param_tools.get_global_parameter("valid_mxs").strip())
|
||||
|
||||
def __unicode__(self):
|
||||
return u"{0.name} ({0.address}) for {0.domain} ".format(self)
|
||||
|
||||
def __str__(self):
|
||||
return "{0.name} ({0.address}) for {0.domain} ".format(self)
|
||||
|
||||
|
||||
@@ -405,6 +405,7 @@ def populate_callback(user, group="SimpleUsers"):
|
||||
sender="populate_callback", user=user)
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class ObjectAccess(models.Model):
|
||||
user = models.ForeignKey(User)
|
||||
content_type = models.ForeignKey(ContentType)
|
||||
@@ -415,11 +416,6 @@ class ObjectAccess(models.Model):
|
||||
class Meta(object):
|
||||
unique_together = (("user", "content_type", "object_id"),)
|
||||
|
||||
def __unicode__(self):
|
||||
return "%s => %s (%s)" % (
|
||||
self.user, self.content_object, self.content_type
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
return "%s => %s (%s)" % (
|
||||
self.user, self.content_object, self.content_type
|
||||
|
||||
@@ -13,7 +13,7 @@ from django.forms.fields import Field
|
||||
from django.forms.widgets import RadioSelect
|
||||
from django.forms.widgets import RadioChoiceInput
|
||||
from django.shortcuts import render
|
||||
from django.utils.encoding import force_text, force_str
|
||||
from django.utils.encoding import python_2_unicode_compatible, force_text, force_str
|
||||
from django.utils.html import conditional_escape
|
||||
from django.utils.safestring import mark_safe
|
||||
from django.utils.translation import ugettext as _, ugettext_lazy
|
||||
@@ -370,20 +370,10 @@ class TabForms(object):
|
||||
#
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class CustomRadioInput(RadioChoiceInput):
|
||||
"""Custom radio input."""
|
||||
|
||||
def __unicode__(self):
|
||||
if "id" in self.attrs:
|
||||
label_for = ' for="%s"' % self.attrs["id"]
|
||||
else:
|
||||
label_for = ""
|
||||
choice_label = conditional_escape(force_text(self.choice_label))
|
||||
return mark_safe(
|
||||
u"<label class='radio-inline' %s>%s %s</label>"
|
||||
% (label_for, self.tag(), choice_label)
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
if "id" in self.attrs:
|
||||
label_for = ' for="%s"' % self.attrs["id"]
|
||||
|
||||
Reference in New Issue
Block a user