Skip to content

Commit

Permalink
Remove old Django compat code from example app
Browse files Browse the repository at this point in the history
  • Loading branch information
vdboor committed Aug 27, 2018
1 parent 6bb0e16 commit 41c85e0
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 24 deletions.
6 changes: 1 addition & 5 deletions examples/core/models.py
@@ -1,9 +1,5 @@
from django.db import models

try:
from django.urls import reverse # Django 1.10+
except ImportError:
from django.core.urlresolvers import reverse
from django.urls import reverse


class Message(models.Model):
Expand Down
2 changes: 1 addition & 1 deletion examples/core/templates/comments/base.html
@@ -1,7 +1,7 @@
{% extends "core/base.html" %}{% load i18n %}
{% comment %}

To implement django.contrib.comments in your web site,
To implement django comments in your web site,
it is recommended to override the following templates in your app:

comments/base.html - map the blocks 'title' and 'contents' to your base template.
Expand Down
6 changes: 1 addition & 5 deletions examples/example/settings.py
Expand Up @@ -108,17 +108,13 @@
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'django_comments',

# Messages setup:
'core',
'threadedcomments',
)

if django.VERSION >= (1, 8):
INSTALLED_APPS += ('django_comments',)
else:
INSTALLED_APPS += ('django.contrib.comments',)


# --- App settings

Expand Down
14 changes: 3 additions & 11 deletions examples/example/urls.py
@@ -1,20 +1,12 @@
import django_comments.urls
from django.conf import settings
from django.conf.urls import url, include
from django.contrib import admin
from core import views

if 'django_comments' in settings.INSTALLED_APPS:
# Django 1.7/1.8 situation
import django_comments.urls
COMMENT_URLS = django_comments.urls
else:
# Old Django projects
import django.contrib.comments.urls
COMMENT_URLS = django.contrib.comments.urls

urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^comments/', include(COMMENT_URLS)),
url(r'^admin/', admin.site.urls),
url(r'^comments/', include(django_comments.urls)),

url(r'^$', views.home, name='homepage'),
url(r'^message/(?P<id>.+)$', views.message, name='message_detail'),
Expand Down
4 changes: 2 additions & 2 deletions examples/requirements.txt
@@ -1,2 +1,2 @@
Django >= 1.8
django-contrib-comments >= 1.7.3
Django >= 1.11
django-contrib-comments >= 1.9.0

0 comments on commit 41c85e0

Please sign in to comment.