Commit 330c772d by benjaoming

Django south administration and URL patterns with default namespace

parent ef2b1ec2
......@@ -15,7 +15,7 @@ Installation
pip install git+git://github.com/benjaoming/django-wiki.git
After that, add `wiki` to `settings.INSTALLED_APPS`.
After that, add `'wiki'` to `settings.INSTALLED_APPS`.
Background
----------
......@@ -34,6 +34,7 @@ Q&A
* **Why is the module named just "wiki"?** Because "pip install wiki" returns "No distributions at all found for wiki"! :)
* **What markup language will you use?** The markup engine will be pluggable, but Markdown will be the built-in supported one.
* **Why not use django-reversion?** It's a great project, but if the wiki has to grow ambitious, someone will have to optimize its behavior, and using a third-party application for something as crucial as the revision system is a no-go in this regard.
Dependencies
------------
......
......@@ -83,6 +83,8 @@ INSTALLED_APPS = (
'django.contrib.staticfiles',
'django.contrib.admin',
'django.contrib.admindocs',
'south',
'wiki',
)
# A sample logging configuration. The only tangible logging
......
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'testproject.views.home', name='home'),
# url(r'^testproject/', include('testproject.foo.urls')),
# Uncomment the admin/doc line below to enable admin documentation:
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
from wiki.urls import get_pattern as wiki_pattern
# Uncomment the next line to enable the admin:
# url(r'^admin/', include(admin.site.urls)),
urlpatterns = patterns('',
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^wiki1', include(wiki_pattern())),
url(r'^wiki2', include(wiki_pattern())),
)
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
pass
def backwards(self, orm):
pass
models = {
}
complete_apps = ['wiki']
\ No newline at end of file
from django.db import models
# Create your models here.
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
import warnings
######################
# Configuration stuff
######################
######################
# Warnings
######################
if not 'south' in settings.INSTALLED_APPS:
warnings.warn("You do not have south in your INSTALLED_APPS. This is highly discouraged.")
\ No newline at end of file
from django.conf.urls.defaults import patterns, url
urlpatterns = patterns('',
url('^$', 'wiki.views.index', name='index'),
)
def get_pattern(app_name="wiki", namespace="wiki"):
"""Every url resolution takes place as "wiki:view_name".
You should not attempt to have multiple deployments of the wiki on
one site.
https://docs.djangoproject.com/en/dev/topics/http/urls/#topics-http-reversing-url-namespaces
"""
return urlpatterns, app_name, namespace
\ No newline at end of file
# Create your views here.
from django.shortcuts import render_to_response
from django.template.context import RequestContext
def index(request):
c = RequestContext(request)
return render_to_response("wiki/index.html", c)
\ No newline at end of file
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