From 927e07b53fb6efbae436035bb8498667fb7b4e10 Mon Sep 17 00:00:00 2001 From: Bill Fenner Date: Wed, 13 Jun 2007 03:38:32 +0000 Subject: [PATCH] Allow suffix to be NULL. - Legacy-Id: 356 --- ietf/redirects/models.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ietf/redirects/models.py b/ietf/redirects/models.py index ed701c5c6..48ce1dfb4 100644 --- a/ietf/redirects/models.py +++ b/ietf/redirects/models.py @@ -30,6 +30,8 @@ class Suffix(models.Model): remove = models.CharField(maxlength=50, blank=True) def __str__(self): return "-> %s - %s" % (self.rest, self.remove) + class Meta: + verbose_name_plural="Suffixes" class Admin: pass @@ -43,8 +45,11 @@ class Command(models.Model): command = models.CharField(maxlength=50, core=True) url = models.CharField(maxlength=50, blank=True) script = models.ForeignKey(Redirect, edit_inline=models.TABULAR, related_name='commands') - suffix = models.ForeignKey(Suffix) + suffix = models.ForeignKey(Suffix, null=True, blank=True) def __str__(self): - return "%s?command=%s %s" % (self.script.cgi, self.command, self.suffix) + ret = "%s?command=%s" % (self.script.cgi, self.command) + if self.suffix_id: + ret += " %s" % (self.suffix) + return ret class Admin: pass