Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Changed djangoproject.com Document.slug field to accept slashes

git-svn-id: http://code.djangoproject.com/svn/djangoproject.com@349 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit e77bee804643a8fda2e392b848086222068ac435 1 parent 33d7731
adrian authored
View
14 django_website/apps/docs/models/docs.py
@@ -2,13 +2,13 @@
class Document(meta.Model):
fields = (
- meta.CharField('title', 'title', maxlength=200),
- meta.SlugField('slug', 'slug', unique=True, prepopulate_from=('title',)),
- meta.CharField('doc_path', 'doc path', maxlength=200,
+ meta.CharField('title', maxlength=200),
+ meta.CharField('slug', maxlength=50, unique=True, prepopulate_from=('title',)),
+ meta.CharField('doc_path', maxlength=200,
help_text="Relative to the docs directory in django SVN; leave off the file extension"),
meta.DateTimeField('last_updated', 'last updated', auto_now=True),
)
- ordering = (('title', 'ASC'),)
+ ordering = ('title',)
admin = meta.Admin(
fields = (
(None, {'fields': ('title', 'slug', 'doc_path')}),
@@ -18,10 +18,10 @@ class Document(meta.Model):
def __repr__(self):
return self.title
-
+
def get_absolute_url(self):
return "/documentation/%s/" % self.slug
-
+
def get_content(self):
try:
return self._doc_content
@@ -34,7 +34,7 @@ def get_content(self):
else:
self._doc_content = ''
return self._doc_content
-
+
def get_toc(self):
try:
return self._toc_content
View
2  django_website/apps/docs/urls/docs.py
@@ -8,5 +8,5 @@
}
urlpatterns = patterns('django.views.generic.list_detail',
- (r'^(?P<slug>\w+)', 'object_detail', info),
+ (r'^(?P<slug>[\w\/]+)/$', 'object_detail', info),
)
Please sign in to comment.
Something went wrong with that request. Please try again.