forked from django-wiki/django-wiki
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from edx/christina/1_11_upgrade
Updates for Django 1.11.
- Loading branch information
Showing
59 changed files
with
303 additions
and
265 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +0,0 @@ | ||
from django.contrib.contenttypes.models import ContentType | ||
from django.db.models import Model | ||
from django.utils.translation import ugettext as _ | ||
|
||
import models | ||
|
||
_disable_notifications = False | ||
|
||
def notify(message, key, target_object=None, url=None): | ||
""" | ||
Notify subscribing users of a new event. Key can be any kind of string, | ||
just make sure to reuse it where applicable! Object_id is some identifier | ||
of an object, for instance if a user subscribes to a specific comment thread, | ||
you could write: | ||
notify("there was a response to your comment", "comment_response", | ||
target_object=PostersObject, | ||
url=reverse('comments:view', args=(PostersObject.id,))) | ||
The below example notifies everyone subscribing to the "new_comments" key | ||
with the message "New comment posted". | ||
notify("New comment posted", "new_comments") | ||
""" | ||
|
||
if _disable_notifications: | ||
return 0 | ||
|
||
if target_object: | ||
if not isinstance(target_object, Model): | ||
raise TypeError(_(u"You supplied a target_object that's not an instance of a django Model.")) | ||
object_id = target_object.id | ||
else: | ||
object_id = None | ||
|
||
objects = models.Notification.create_notifications(key, object_id=object_id, | ||
message=message, url=url) | ||
return len(objects) | ||
|
||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
django<1.9 | ||
South==1.0.1 | ||
Markdown<2.3.0 | ||
django-sekizai<0.7 | ||
django-mptt<0.8 | ||
sorl-thumbnail<13 | ||
django>=1.8,<2.0 | ||
Markdown>=2.6,<2.7 | ||
django-sekizai>=0.10 | ||
django-mptt>=0.8.6,<0.9 | ||
sorl-thumbnail>=12,<13 | ||
six>=1.10.0,<2.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ def build_media_pattern(base_folder, file_extension): | |
|
||
setup( | ||
name = "django-wiki", | ||
version = "0.0.10", | ||
version="0.0.11", | ||
author = "Benjamin Bach", | ||
author_email = "[email protected]", | ||
description = ("A wiki system written for the Django framework."), | ||
|
@@ -39,7 +39,7 @@ def build_media_pattern(base_folder, file_extension): | |
long_description=read('README.md'), | ||
zip_safe = False, | ||
install_requires=[ | ||
'Django>=1.4', | ||
'Django>=1.8', | ||
'markdown', | ||
'django-sekizai', | ||
'django-mptt', | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ | |
PROJECT_PATH = os_path.abspath(os_path.split(__file__)[0]) | ||
|
||
DEBUG = True | ||
TEMPLATE_DEBUG = DEBUG | ||
|
||
ADMINS = ( | ||
# ('Your Name', '[email protected]'), | ||
|
@@ -47,22 +46,9 @@ | |
|
||
STATIC_ROOT = os_path.join(PROJECT_PATH, 'static') | ||
STATIC_URL = '/static/' | ||
STATICFILES_DIRS = ( | ||
) | ||
STATICFILES_FINDERS = ( | ||
'django.contrib.staticfiles.finders.FileSystemFinder', | ||
'django.contrib.staticfiles.finders.AppDirectoriesFinder', | ||
# 'django.contrib.staticfiles.finders.DefaultStorageFinder', | ||
) | ||
|
||
SECRET_KEY = 'b^fv_)t39h%9p40)fnkfblo##jkr!$0)lkp6bpy!fi*f$4*92!' | ||
|
||
TEMPLATE_LOADERS = ( | ||
'django.template.loaders.filesystem.Loader', | ||
'django.template.loaders.app_directories.Loader', | ||
# 'django.template.loaders.eggs.Loader', | ||
) | ||
|
||
MIDDLEWARE_CLASSES = ( | ||
'django.middleware.common.CommonMiddleware', | ||
'django.contrib.sessions.middleware.SessionMiddleware', | ||
|
@@ -79,22 +65,31 @@ | |
# Python dotted path to the WSGI application used by Django's runserver. | ||
WSGI_APPLICATION = 'testproject.wsgi.application' | ||
|
||
TEMPLATE_DIRS = ( | ||
'templates', | ||
) | ||
|
||
TEMPLATE_CONTEXT_PROCESSORS =( | ||
'django.contrib.auth.context_processors.auth', | ||
'django.core.context_processors.debug', | ||
'django.core.context_processors.i18n', | ||
'django.core.context_processors.media', | ||
'django.core.context_processors.static', | ||
'django.core.context_processors.tz', | ||
'django.contrib.messages.context_processors.messages', | ||
'sekizai.context_processors.sekizai', | ||
) | ||
TEMPLATES = [ | ||
{ | ||
'BACKEND': 'django.template.backends.django.DjangoTemplates', | ||
'DIRS': [ | ||
os_path.join(PROJECT_PATH, 'templates'), | ||
], | ||
'APP_DIRS': True, | ||
'OPTIONS': { | ||
'context_processors': [ | ||
"django.contrib.auth.context_processors.auth", | ||
"django.template.context_processors.debug", | ||
"django.template.context_processors.i18n", | ||
"django.template.context_processors.media", | ||
"django.template.context_processors.static", | ||
"django.template.context_processors.request", | ||
"django.template.context_processors.tz", | ||
"django.contrib.messages.context_processors.messages", | ||
"sekizai.context_processors.sekizai", | ||
], | ||
'debug': DEBUG, | ||
}, | ||
}, | ||
] | ||
|
||
INSTALLED_APPS = ( | ||
INSTALLED_APPS = [ | ||
'django.contrib.humanize', | ||
'django.contrib.auth', | ||
'django.contrib.contenttypes', | ||
|
@@ -114,7 +109,7 @@ | |
'wiki.plugins.attachments', | ||
'wiki.plugins.notifications', | ||
'mptt', | ||
) | ||
] | ||
|
||
# A sample logging configuration. The only tangible logging | ||
# performed by this configuration is to send an email to | ||
|
@@ -146,3 +141,6 @@ | |
} | ||
|
||
WIKI_ANONYMOUS_WRITE = True | ||
|
||
# We disable this in edx-platform lms/envs/common.py, so disabling for test project also. | ||
WIKI_USE_BOOTSTRAP_SELECT_WIDGET = False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,26 @@ | ||
from django.conf.urls import patterns, include, url | ||
from django.conf.urls import include, url | ||
from django.conf import settings | ||
from django.contrib.staticfiles.urls import staticfiles_urlpatterns | ||
from django.views.static import serve as static_serve | ||
|
||
from django.contrib import admin | ||
admin.autodiscover() | ||
|
||
urlpatterns = patterns('', | ||
url(r'^admin/doc/', include('django.contrib.admindocs.urls')), | ||
urlpatterns = [ | ||
url(r'^admin/', include(admin.site.urls)), | ||
url(r'^notify/', include('django_notify.urls', namespace='notify')), | ||
) | ||
] | ||
|
||
if settings.DEBUG: | ||
urlpatterns += staticfiles_urlpatterns() | ||
urlpatterns += patterns('', | ||
url(r'^media/(?P<path>.*)$', 'django.views.static.serve', { | ||
'document_root': settings.MEDIA_ROOT, | ||
}), | ||
) | ||
urlpatterns += [ | ||
url(r'^media/(?P<path>.*)$', static_serve, {'document_root': settings.MEDIA_ROOT}), | ||
] | ||
|
||
|
||
from wiki.urls import get_pattern as get_wiki_pattern | ||
from django_notify.urls import get_pattern as get_notify_pattern | ||
urlpatterns += patterns('', | ||
(r'^notify/', get_notify_pattern()), | ||
(r'', get_wiki_pattern()) | ||
) | ||
|
||
urlpatterns += [ | ||
url(r'^notify/', get_notify_pattern()), | ||
url(r'', get_wiki_pattern()), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Django 1.11 Widget.build_attrs has a different signature, designed for the new | ||
# template based rendering. The previous version was more useful for our needs, | ||
# so we restore that version. | ||
# When support for Django < 1.11 is dropped, we should look at using the | ||
# new template based rendering, at which point this probably won't be needed at all. | ||
class BuildAttrsCompat(object): | ||
def build_attrs_compat(self, extra_attrs=None, **kwargs): | ||
"Helper function for building an attribute dictionary." | ||
attrs = self.attrs.copy() | ||
if extra_attrs is not None: | ||
attrs.update(extra_attrs) | ||
if kwargs is not None: | ||
attrs.update(kwargs) | ||
return attrs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.