Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixes #279 url overwrite setting works again, and some cleanup

  • Loading branch information...
commit e56976c9648526ce22ebf943900af340814c2f33 1 parent 41aa54d
@digi604 digi604 authored
View
9 cms/admin/pageadmin.py
@@ -60,7 +60,7 @@ class PageAdmin(admin.ModelAdmin):
top_fields = []
general_fields = ['title', 'slug', ('published', 'in_navigation')]
add_general_fields = ['title', 'slug', 'language', 'template']
- advanced_fields = ['reverse_id', 'overwrite_url', 'login_required', 'menu_login_required']
+ advanced_fields = ['reverse_id', 'overwrite_url', 'redirect', 'login_required', 'menu_login_required']
template_fields = ['template']
change_list_template = "admin/cms/page/change_list.html"
hidden_fields = ['site', 'parent']
@@ -80,12 +80,15 @@ class PageAdmin(admin.ModelAdmin):
additional_hidden_fields.extend(('moderator_state', 'moderator_message'))
if settings.CMS_APPLICATIONS_URLS:
advanced_fields.append('application_urls')
- if settings.CMS_REDIRECTS:
- advanced_fields.append('redirect')
if settings.CMS_SEO_FIELDS:
seo_fields = ('page_title', 'meta_description', 'meta_keywords')
if settings.CMS_MENU_TITLE_OVERWRITE:
general_fields[0] = ('title', 'menu_title')
+ if not settings.CMS_URL_OVERWRITE:
+ advanced_fields.remove("overwrite_url")
+ if not settings.CMS_REDIRECTS:
+ advanced_fields.remove('redirect')
+
# take care with changing fieldsets, get_fieldsets() method removes some
# fields depending on permissions, but its very static!!
View
7 cms/appresolver.py
@@ -35,7 +35,6 @@ def resolve_page_id(self, path):
assigned.
"""
tried = []
- print path
match = self.regex.search(path)
if match:
new_path = path[match.end():]
@@ -54,8 +53,6 @@ def resolve_page_id(self, path):
else:
return self.page_id
tried.append(pattern.regex.pattern)
- print tried
- print new_path
raise Resolver404, {'tried': tried, 'path': new_path}
@@ -104,7 +101,6 @@ def __init__(self, path, title, default_kwargs={}):
if settings.APPEND_SLASH:
regex += r'/'
urlconf_name = title.application_urls
- print regex
# assign page_id to resolver, so he knows on which page he was assigned
self.page_id = title.page_id
super(ApplicationRegexUrlResolver, self).__init__(regex, urlconf_name, default_kwargs)
@@ -169,8 +165,6 @@ def urlpatterns(self):
else:
path = title.path
mixid = "%s:%s" % (path + "/", title.application_urls)
- print path
- print mixid
if mixid in included:
# don't add the same thing twice
continue
@@ -178,7 +172,6 @@ def urlpatterns(self):
path += '/'
urls.append(ApplicationRegexUrlResolver(path, title))
included.append(mixid)
- print urls
self._urlpatterns = urls
return self._urlpatterns
View
2  example/sampleapp/urls.py
@@ -4,5 +4,5 @@
(r'^$', 'sample_view', {'message': 'urls.py => root (DE)',}),
(r'^$', 'sample_view', {'message': 'urls.py => root (EN)'}),
- url(r'^sublevel/$', 'sample_view', kwargs={'message': 'urls.py => sublevel'}, name='sample-app-sublevel'),
+ url(r'^sublevel$', 'sample_view', kwargs={'message': 'urls.py => sublevel'}, name='sample-app-sublevel'),
)
View
6 example/sampleapp/urlstwo.py
@@ -2,7 +2,7 @@
urlpatterns = patterns('sampleapp.views',
(r'^$', 'sample_view', {'message': 'urlstwo.py => root'}),
- url(r'^sublevel/$', 'sample_view', {'message': 'urlstwo.py => sublevel1'}, name='sample-app-sublevel'),
- url(r'^sublevel2/$', 'sample_view', {'message': 'urlstwo.py => sublevel2'}, name='sample-app-sublevel2'),
- url(r'^sublevel/sublevel3/$', 'sample_view', {'message': 'urlstwo.py => sublevel3'}, name='sample-app-sublevel3'),
+ url(r'^sublevel$', 'sample_view', {'message': 'urlstwo.py => sublevel1'}, name='sample-app-sublevel'),
+ url(r'^sublevel2$', 'sample_view', {'message': 'urlstwo.py => sublevel2'}, name='sample-app-sublevel2'),
+ url(r'^sublevel/sublevel3$', 'sample_view', {'message': 'urlstwo.py => sublevel3'}, name='sample-app-sublevel3'),
)
View
3  example/settings.py
@@ -141,6 +141,8 @@
'en':['fr'],
}
+APPEND_SLASH = True
+
CMS_TEMPLATES = (
('index.html', gettext('default')),
('nice.html', gettext('nice one')),
@@ -184,6 +186,7 @@
CMS_FLAT_URLS = False
CMS_MENU_TITLE_OVERWRITE = True
CMS_HIDE_UNTRANSLATED = False
+CMS_URL_OVERWRITE = True
try:
Please sign in to comment.
Something went wrong with that request. Please try again.