Commit 5b3fa5ab by Őry Máté

unicode love

parent 0920478b
...@@ -41,19 +41,19 @@ class Rule(models.Model): ...@@ -41,19 +41,19 @@ class Rule(models.Model):
color_desc.allow_tags = True color_desc.allow_tags = True
def desc(self): def desc(self):
para = "" para = u""
if(self.dport): if(self.dport):
para = "dport=%s %s" % (self.dport, para) para = "dport=%s %s" % (self.dport, para)
if(self.sport): if(self.sport):
para = "sport=%s %s" % (self.sport, para) para = "sport=%s %s" % (self.sport, para)
if(self.proto): if(self.proto):
para = "proto=%s %s" % (self.proto, para) para = "proto=%s %s" % (self.proto, para)
return '[' + self.r_type + '] ' + (self.vlan_l() + ' ▸ ' + self.r_type if self.direction=='1' else self.r_type + ' ▸ ' + self.vlan_l()) + ' ' + para + ' ' +self.description return u'[' + self.r_type + u'] ' + (self.vlan_l() + u' ▸ ' + self.r_type if self.direction=='1' else self.r_type + u' ▸ ' + self.vlan_l()) + u' ' + para + u' ' +self.description
def vlan_l(self): def vlan_l(self):
retval = [] retval = []
for vl in self.vlan.all(): for vl in self.vlan.all():
retval.append(vl.name) retval.append(vl.name)
return ', '.join(retval) return u', '.join(retval)
class Vlan(models.Model): class Vlan(models.Model):
vid = models.IntegerField(unique=True) vid = models.IntegerField(unique=True)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment