Skip to content

Commit

Permalink
Added unique contraint to the name field
Browse files Browse the repository at this point in the history
  • Loading branch information
jose committed Apr 21, 2011
1 parent 8ff8562 commit 8fda21a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions hiermenu/data/2011-04-21-Menu.SQL
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE hiermenu_menu ADD CONSTRAINT hiermenu_menu_name UNIQUE(name);
2 changes: 1 addition & 1 deletion hiermenu/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def get_items(self, menu, show_hidden=False, limit=None):

class Menu(models.Model):
name = models.SlugField(max_length=100,
help_text='Menu name.')
help_text='Menu name.', unique=True)
parent = models.ForeignKey("self", null=True, blank=True,
help_text='The parent MenuItem this item will be a subitem of.')
text = models.CharField(blank=True, max_length=50,
Expand Down

0 comments on commit 8fda21a

Please sign in to comment.