Skip to content

Commit 927e07b

Browse files
committed
Allow suffix to be NULL.
- Legacy-Id: 356
1 parent a71abb1 commit 927e07b

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

ietf/redirects/models.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ class Suffix(models.Model):
3030
remove = models.CharField(maxlength=50, blank=True)
3131
def __str__(self):
3232
return "-> %s - %s" % (self.rest, self.remove)
33+
class Meta:
34+
verbose_name_plural="Suffixes"
3335
class Admin:
3436
pass
3537

@@ -43,8 +45,11 @@ class Command(models.Model):
4345
command = models.CharField(maxlength=50, core=True)
4446
url = models.CharField(maxlength=50, blank=True)
4547
script = models.ForeignKey(Redirect, edit_inline=models.TABULAR, related_name='commands')
46-
suffix = models.ForeignKey(Suffix)
48+
suffix = models.ForeignKey(Suffix, null=True, blank=True)
4749
def __str__(self):
48-
return "%s?command=%s %s" % (self.script.cgi, self.command, self.suffix)
50+
ret = "%s?command=%s" % (self.script.cgi, self.command)
51+
if self.suffix_id:
52+
ret += " %s" % (self.suffix)
53+
return ret
4954
class Admin:
5055
pass

0 commit comments

Comments
 (0)