Kai Diefenbach avatar Kai Diefenbach committed 01a8780 Merge

Merged 0.7 branch.

Comments (0)

Files changed (2)

lfs/page/models.py

     """
     active = models.BooleanField(_(u"Active"), default=False)
     title = models.CharField(_(u"Title"), max_length=100)
-    slug = models.SlugField(_(u"Slug"), max_length=100)
+    slug = models.SlugField(_(u"Slug"), unique=True, max_length=100)
     position = models.IntegerField(_(u"Position"), default=999)
     exclude_from_navigation = models.BooleanField(_(u"Exclude from navigation"), default=False)
     short_text = models.TextField(_(u"Short text"), blank=True)

lfs/page/tests.py

 # django imports
 from django.contrib.auth.models import User
 from django.core.urlresolvers import reverse
+from django.db import IntegrityError
 from django.test import TestCase
 from django.test.client import Client
 
         self.page.save()
 
         self.assertEqual("This is a short text - John Doe - Page Title", self.page.get_meta_description())
+
+    def test_add_page_with_existing_slug(self):
+        Page.objects.create(title="Test1", slug="test")
+        self.assertRaises(IntegrityError, Page.objects.create, title="Test2", slug="test")
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.