Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-wiki
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
django-wiki
Commits
a4e3ebfb
Commit
a4e3ebfb
authored
Jul 16, 2013
by
benjaoming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make SEARCH_VIEW configurable from conf.settings
parent
24271db1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
11 deletions
+32
-11
.gitignore
+6
-0
testproject/testproject/.gitignore
+0
-2
wiki/conf/settings.py
+10
-0
wiki/core/utils.py
+10
-0
wiki/urls.py
+6
-9
No files found.
.gitignore
View file @
a4e3ebfb
...
...
@@ -3,11 +3,16 @@ build
dist
*.egg-info
README.rst
testproject/testproject/whoosh_index/
#Docs
docs/_build
docs/_build/*
# Test project
testproject/testproject/settings/local.py
testproject/testproject/media/*
# Installer logs
pip-log.txt
...
...
@@ -22,6 +27,7 @@ pip-log.txt
#Virtualenv
virtualenv
.venv
#Mr Developer
.mr.developer.cfg
...
...
testproject/testproject/.gitignore
deleted
100644 → 0
View file @
24271db1
media/*
settings_local.py
wiki/conf/settings.py
View file @
a4e3ebfb
...
...
@@ -117,6 +117,16 @@ USE_BOOTSTRAP_SELECT_WIDGET = getattr( django_settings, 'WIKI_USE_BOOTSTRAP_SELE
#: you can derive from this.
URL_CONFIG_CLASS
=
getattr
(
django_settings
,
'WIKI_URL_CONFIG_CLASS'
,
'wiki.urls.WikiURLPatterns'
)
# Search view - dotted path denoting where the search view Class is located
SEARCH_VIEW
=
getattr
(
django_settings
,
'WIKI_SEARCH_VIEW'
,
'wiki.views.article.SearchView'
if
not
'haystack'
in
django_settings
.
INSTALLED_APPS
else
'wiki.plugins.haystack.views.HaystackSearchView'
)
# Seconds of timeout before renewing article cache. Articles are automatically
# renewed whenever an edit occurs but article content may be generated from
# other objects that are changed.
...
...
wiki/core/utils.py
0 → 100644
View file @
a4e3ebfb
# -*- coding: utf-8 -*-
from
django.utils.importlib
import
import_module
def
get_class_from_str
(
class_path
):
"""Dynamically load a View class from a string path
"myapp.views.MyView" -- used for dynamic settings"""
module_path
,
klass_name
=
class_path
.
rsplit
(
'.'
,
1
)
module
=
import_module
(
module_path
)
return
getattr
(
module
,
klass_name
)
wiki/urls.py
View file @
a4e3ebfb
# -*- coding: utf-8 -*-
from
django.conf
import
settings
as
django_settings
from
django.conf.urls
import
patterns
,
url
,
include
from
django.utils.importlib
import
import_module
from
wiki.views
import
article
,
accounts
from
wiki.conf
import
settings
from
wiki.core.plugins
import
registry
from
wiki.views
import
article
,
accounts
from
wiki.core.utils
import
get_class_from_str
class
WikiURLPatterns
(
object
):
'''
...
...
@@ -32,14 +31,14 @@ class WikiURLPatterns(object):
revision_merge_view
=
'wiki.views.article.merge'
create_root
=
'wiki.views.article.root_create'
search_view_class
=
article
.
SearchViewHaystack
if
'haystack'
in
django_settings
.
INSTALLED_APPS
else
article
.
SearchView
search_view_class
=
settings
.
SEARCH_VIEW
article_diff_view
=
'wiki.views.article.diff'
# account views
signup_view_class
=
accounts
.
Signup
login_view_class
=
accounts
.
Login
logout_view_class
=
accounts
.
Logout
def
get_urls
(
self
):
urlpatterns
=
self
.
get_root_urls
()
urlpatterns
+=
self
.
get_accounts_urls
()
...
...
@@ -56,7 +55,7 @@ class WikiURLPatterns(object):
urlpatterns
=
patterns
(
''
,
url
(
'^$'
,
self
.
article_view_class
.
as_view
(),
name
=
'root'
,
kwargs
=
{
'path'
:
''
}),
url
(
'^create-root/$'
,
self
.
create_root
,
name
=
'root_create'
),
url
(
'^_search/$'
,
self
.
search_view_class
.
as_view
(),
name
=
'search'
),
url
(
'^_search/$'
,
get_class_from_str
(
self
.
search_view_class
)
.
as_view
(),
name
=
'search'
),
url
(
'^_revision/diff/(?P<revision_id>
\
d+)/$'
,
self
.
article_diff_view
,
name
=
'diff'
),
)
return
urlpatterns
...
...
@@ -142,8 +141,6 @@ def get_pattern(app_name="wiki", namespace="wiki", url_config_class=None):
if
url_config_classname
is
None
:
url_config_class
=
WikiURLPatterns
else
:
url_config_modname
,
config_classname
=
url_config_classname
.
rsplit
(
'.'
,
1
)
url_config_mod
=
import_module
(
url_config_modname
)
url_config_class
=
getattr
(
url_config_mod
,
config_classname
)
url_config_class
=
get_class_from_str
(
url_config_classname
)
urlpatterns
=
url_config_class
()
.
get_urls
()
return
urlpatterns
,
app_name
,
namespace
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment