mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-17 05:41:25 +02:00
Python3 compatibility: add __str__ functions in addition to __unicode__ functions
This commit is contained in:
@@ -334,6 +334,9 @@ class MXRecord(models.Model):
|
||||
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)
|
||||
|
||||
|
||||
class DNSBLQuerySet(models.QuerySet):
|
||||
"""Custom manager for DNSBLResultManager."""
|
||||
|
||||
@@ -420,6 +420,11 @@ class ObjectAccess(models.Model):
|
||||
self.user, self.content_object, self.content_type
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
return "%s => %s (%s)" % (
|
||||
self.user, self.content_object, self.content_type
|
||||
)
|
||||
|
||||
|
||||
class Log(models.Model):
|
||||
"""Simple log in database."""
|
||||
|
||||
@@ -384,6 +384,17 @@ class CustomRadioInput(RadioChoiceInput):
|
||||
% (label_for, self.tag(), choice_label)
|
||||
)
|
||||
|
||||
def __str__(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(
|
||||
"<label class='radio-inline' %s>%s %s</label>"
|
||||
% (label_for, self.tag(), choice_label)
|
||||
)
|
||||
|
||||
|
||||
class InlineRadioRenderer(RadioSelect.renderer):
|
||||
"""Custom inline radio renderer."""
|
||||
|
||||
Reference in New Issue
Block a user