[extensions-web/django/upgrade-1.8] django: migrate from deprecated django.contrib.comments to django_comments



commit 21fcdffb2c72b13f4b4b8828deb7c43f88835d5a
Author: Yuri Konotopov <ykonotopov gnome org>
Date:   Tue Oct 25 22:47:16 2016 +0300

    django: migrate from deprecated django.contrib.comments to django_comments

 requirements.txt                              |    1 +
 sweettooth/ratings/admin.py                   |    2 +-
 sweettooth/ratings/forms.py                   |    2 +-
 sweettooth/ratings/migrations/0001_initial.py |   10 +++++++---
 sweettooth/ratings/models.py                  |    6 +++---
 sweettooth/settings.py                        |    3 ++-
 sweettooth/urls.py                            |    2 +-
 7 files changed, 16 insertions(+), 10 deletions(-)
---
diff --git a/requirements.txt b/requirements.txt
index efa6eb7..214d1db 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,5 +1,6 @@
 Django==1.7.11
 django-autoslug==1.7.2
+django-contrib-comments==1.7.3
 django-registration==2.0
 Pygments==1.6
 wsgiref==0.1.2
diff --git a/sweettooth/ratings/admin.py b/sweettooth/ratings/admin.py
index 348d501..ac0ccc4 100644
--- a/sweettooth/ratings/admin.py
+++ b/sweettooth/ratings/admin.py
@@ -1,6 +1,6 @@
 
 from django.contrib import admin
-from django.contrib.comments.admin import CommentsAdmin
+from django_comments.admin import CommentsAdmin
 from django.utils.translation import ugettext_lazy as _
 
 from sweettooth.ratings.models import RatingComment
diff --git a/sweettooth/ratings/forms.py b/sweettooth/ratings/forms.py
index 99c13eb..2b3afe4 100644
--- a/sweettooth/ratings/forms.py
+++ b/sweettooth/ratings/forms.py
@@ -4,7 +4,7 @@ import datetime
 from django.forms import fields, widgets
 from django.conf import settings
 from django.contrib.contenttypes.models import ContentType
-from django.contrib.comments.forms import CommentForm
+from django_comments.forms import CommentForm
 from django.utils.encoding import force_unicode
 from django.utils.safestring import mark_safe
 
diff --git a/sweettooth/ratings/migrations/0001_initial.py b/sweettooth/ratings/migrations/0001_initial.py
index 357c2d1..766d63c 100644
--- a/sweettooth/ratings/migrations/0001_initial.py
+++ b/sweettooth/ratings/migrations/0001_initial.py
@@ -7,19 +7,23 @@ from django.db import models, migrations
 class Migration(migrations.Migration):
 
     dependencies = [
-        ('comments', '__first__'),
+        ('django_comments', '0003_add_submit_date_index'),
     ]
 
     operations = [
         migrations.CreateModel(
             name='RatingComment',
             fields=[
-                ('comment_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, 
serialize=False, to='comments.Comment')),
+                ('comment_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, 
serialize=False, to='django_comments.Comment')),
                 ('rating', models.IntegerField(default=-1, blank=True)),
             ],
             options={
+                'ordering': ('submit_date',),
                 'abstract': False,
+                'verbose_name': 'comment',
+                'verbose_name_plural': 'comments',
+                'permissions': [('can_moderate', 'Can moderate comments')],
             },
-            bases=('comments.comment',),
+            bases=('django_comments.comment',),
         ),
     ]
diff --git a/sweettooth/ratings/models.py b/sweettooth/ratings/models.py
index 6d0ddd4..df5dca1 100644
--- a/sweettooth/ratings/models.py
+++ b/sweettooth/ratings/models.py
@@ -1,8 +1,8 @@
 
 from django.db import models
-from django.contrib.comments.models import Comment
-from django.contrib.comments.managers import CommentManager
-from django.contrib.comments.signals import comment_will_be_posted
+from django_comments.models import Comment
+from django_comments.managers import CommentManager
+from django_comments.signals import comment_will_be_posted
 
 class RatingComment(Comment):
     objects = CommentManager()
diff --git a/sweettooth/settings.py b/sweettooth/settings.py
index 1c1da64..5b6024b 100644
--- a/sweettooth/settings.py
+++ b/sweettooth/settings.py
@@ -117,7 +117,8 @@ INSTALLED_APPS = (
     # app so it will find our templates
     'sweettooth.ratings',
 
-    'django.contrib.comments',
+    'django_comments',
+
     'django.contrib.contenttypes',
     'django.contrib.sessions',
     'django.contrib.sites',
diff --git a/sweettooth/urls.py b/sweettooth/urls.py
index cf27236..aab1fc2 100644
--- a/sweettooth/urls.py
+++ b/sweettooth/urls.py
@@ -20,7 +20,7 @@ urlpatterns = patterns('',
 
     url(r'^admin/', include(admin.site.urls)),
     url(r'^comments/', include('ratings.urls')),
-    url(r'^comments/', include('django.contrib.comments.urls')),
+    url(r'^comments/', include('django_comments.urls')),
 
 )
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]