Skip to content

Commit 5de4ca9

Browse files
committed
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
1 parent 927e07b commit 5de4ca9

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

ietf/redirects/models.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,14 @@ class Command(models.Model):
4444
"""
4545
command = models.CharField(maxlength=50, core=True)
4646
url = models.CharField(maxlength=50, blank=True)
47-
script = models.ForeignKey(Redirect, edit_inline=models.TABULAR, related_name='commands')
47+
script = models.ForeignKey(Redirect, edit_inline=models.TABULAR, related_name='commands', editable=False)
4848
suffix = models.ForeignKey(Suffix, null=True, blank=True)
4949
def __str__(self):
5050
ret = "%s?command=%s" % (self.script.cgi, self.command)
5151
if self.suffix_id:
5252
ret += " %s" % (self.suffix)
5353
return ret
54+
class Meta:
55+
unique_together = (("script", "command"), )
5456
class Admin:
5557
pass

0 commit comments

Comments
 (0)