Skip to content

Commit

Permalink
Merge pull request #38 from edx/jeskew/fix_django20_deprecation_warning
Browse files Browse the repository at this point in the history
Fix some Django20 deprecation warnings.
  • Loading branch information
awais786 authored Jan 8, 2020
2 parents 3798202 + 44efc23 commit 752069f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions django_notify/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
url('^goto/$', views.goto, name='goto_base', kwargs={}),
]

def get_pattern(app_name="notify", namespace="notify"):
def get_pattern(app_name="notify"):
"""Every url resolution takes place as "notify:view_name".
https://docs.djangoproject.com/en/dev/topics/http/urls/#topics-http-reversing-url-namespaces
"""
return urlpatterns, app_name, namespace
return urlpatterns, app_name
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def build_media_pattern(base_folder, file_extension):

setup(
name = "django-wiki",
version="0.0.23",
version="0.0.24",
author="Benjamin Bach",
author_email="[email protected]",
description=("A wiki system written for the Django framework."),
Expand Down
12 changes: 6 additions & 6 deletions wiki/templatetags/wiki_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
# called more than once per page in multiple template blocks.
_cache = {}

@register.assignment_tag(takes_context=True)
@register.simple_tag(takes_context=True)
def article_for_object(context, obj):
if not isinstance(obj, Model):
raise TypeError("A Wiki article can only be associated to a Django Model instance, not %s" % type(obj))

content_type = ContentType.objects.get_for_model(obj)

# TODO: This is disabled for now, as it should only fire once per request
# Maybe store cache in the request object?
if True or not obj in list(_cache.keys()):
Expand All @@ -35,7 +35,7 @@ def article_for_object(context, obj):

@register.inclusion_tag('wiki/includes/render.html')
def wiki_render(article, preview_content=None):

if preview_content:
content = article.render(preview_content=preview_content)
else:
Expand All @@ -50,10 +50,10 @@ def wiki_render(article, preview_content=None):

@register.inclusion_tag('wiki/includes/form.html', takes_context=True)
def wiki_form(context, form_obj):

if not isinstance(form_obj, BaseForm):
raise TypeError("Error including form, it's not a form, it's a %s" % type(form_obj))

return {
'form': form_obj,
}
Expand Down
8 changes: 4 additions & 4 deletions wiki/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
]

urlpatterns += [
# This one doesn't work because it don't know where to redirect after...
# This one doesn't work because it don't know where to redirect after...
url(r'^_revision/change/(?P<article_id>\d+)/(?P<revision_id>\d+)/$', article.change_revision,
name='change_revision'),
url(r'^_revision/preview/(?P<article_id>\d+)/$', article.Preview.as_view(), name='preview_revision'),
url(r'^_revision/merge/(?P<article_id>\d+)/(?P<revision_id>\d+)/preview/$', article.merge,
name='merge_revision_preview', kwargs={'preview': True}),

# Paths decided by article_ids
url(r'^(?P<article_id>\d+)/$', article.ArticleView.as_view(), name='get'),
url(r'^(?P<article_id>\d+)/delete/$', article.Delete.as_view(), name='delete'),
Expand Down Expand Up @@ -69,10 +69,10 @@
url(r'^(?P<path>.+/|)$', article.ArticleView.as_view(), name='get'),
]

def get_pattern(app_name="wiki", namespace="wiki"):
def get_pattern(app_name="wiki"):
"""Every url resolution takes place as "wiki:view_name".
You should not attempt to have multiple deployments of the wiki in a
single Django project.
https://docs.djangoproject.com/en/dev/topics/http/urls/#topics-http-reversing-url-namespaces
"""
return urlpatterns, app_name, namespace
return urlpatterns, app_name

0 comments on commit 752069f

Please sign in to comment.