Commit 4246c494 authored by chris's avatar chris

content/models.py: ensure uniqueness of page titles.

parent ccb2bf35
......@@ -4,7 +4,7 @@ from ckeditor.fields import RichTextField
from sorl.thumbnail.fields import ImageField
class Page(models.Model):
title = models.CharField(max_length=80)
title = models.CharField(max_length=80, unique=True)
text = RichTextField(blank=True,null=True)
parent = models.ForeignKey('self',blank=True,null=True)
in_menu = models.BooleanField(default=False)
......@@ -30,7 +30,7 @@ class Image(models.Model):
page = models.ForeignKey(Page)
#image = models.ImageField(upload_to="images")
image = ImageField(upload_to="images")
title = models.CharField(max_length=80,blank=True,null=True)
title = models.CharField(max_length=80,blank=True,null=True, unique=True)
text = RichTextField(blank=True,null=True)
def url(self):
......@@ -46,7 +46,7 @@ class Image(models.Model):
class Video(models.Model):
page = models.ForeignKey(Page)
title = models.CharField(max_length=80)
title = models.CharField(max_length=80, unique=True)
text = RichTextField(blank=True,null=True)
def __unicode__(self):
......@@ -60,7 +60,7 @@ class Agenda(models.Model):
return "Agenda " + str(self.page)
class Press(models.Model):
page = models.ForeignKey(Page)
page = models.ForeignKey(Page, unique=True)
image = ImageField(upload_to="images",blank=True,null=True)
text = RichTextField(blank=True,null=True)
......@@ -71,7 +71,7 @@ class Press(models.Model):
verbose_name = 'Press review'
class Reference(models.Model):
page = models.ForeignKey(Page)
page = models.ForeignKey(Page, unique=True)
text = RichTextField(blank=True,null=True)
def __unicode__(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment