From 5de4ca900446240bfb0644ed15e2b5498ea56fa4 Mon Sep 17 00:00:00 2001 From: Bill Fenner Date: Wed, 13 Jun 2007 04:13:23 +0000 Subject: [PATCH] Don't allow script to be edited in the command admin. Add unique_together to create a constraint and create an index that I expect to use. - Legacy-Id: 357 --- ietf/redirects/models.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ietf/redirects/models.py b/ietf/redirects/models.py index 48ce1dfb4..87fbe0d0f 100644 --- a/ietf/redirects/models.py +++ b/ietf/redirects/models.py @@ -44,12 +44,14 @@ 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') + script = models.ForeignKey(Redirect, edit_inline=models.TABULAR, related_name='commands', editable=False) suffix = models.ForeignKey(Suffix, null=True, blank=True) def __str__(self): ret = "%s?command=%s" % (self.script.cgi, self.command) if self.suffix_id: ret += " %s" % (self.suffix) return ret + class Meta: + unique_together = (("script", "command"), ) class Admin: pass