# HG changeset patch # User Steve Losh # Date 1263016888 18000 # Node ID 87dafa5e8959cd3a6b7a301aa1727cb5b2c6532a # Parent b3eb9a757704d4105d0ef0e38ac915cb336e2dc3 Add the comment export script. diff -r b3eb9a757704 -r 87dafa5e8959 blog/models.py --- a/blog/models.py Fri Dec 11 22:22:27 2009 -0500 +++ b/blog/models.py Sat Jan 09 01:01:28 2010 -0500 @@ -14,10 +14,8 @@ verbose_name = 'entry' verbose_name_plural = 'entries' - @models.permalink def get_absolute_url(self): - return ('blog-entry', (self.pub_date.year, self.pub_date.month, - self.pub_date.day, self.slug),) + return u'/blog/%d/%d/%s/' % (self.pub_date.year, self.pub_date.month, self.slug) def __unicode__(self): return u'%s' % (self.title,) diff -r b3eb9a757704 -r 87dafa5e8959 convert-comments.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/convert-comments.py Sat Jan 09 01:01:28 2010 -0500 @@ -0,0 +1,39 @@ +#!/usr/bin/env python + +from django.core.management import setup_environ +import settings +setup_environ(settings) + +from django.contrib.comments.models import Comment +from django.contrib.sites.models import Site +from stevelosh.blog.models import Comment as BlogComment +from stevelosh.projects.models import Comment as ProjectComment + + +site = Site.objects.all()[0] +blog_comments = BlogComment.objects.filter(spam=False) +project_comments = ProjectComment.objects.filter(spam=False) + +for bc in blog_comments: + c = Comment() + c.content_object = bc.entry + c.user_name = bc.name + c.comment = bc.body + c.submit_date = bc.submitted + c.site = site + c.is_public = True + c.is_removed = False + c.save() + print 'http://%s%s' % (site.domain, c.content_object.get_absolute_url()) + +for pc in project_comments: + c = Comment() + c.content_object = pc.project + c.user_name = pc.name + c.comment = pc.body + c.submit_date = pc.submitted + c.site = site + c.is_public = True + c.is_removed = False + c.save() + print 'http://%s%s' % (site.domain, c.content_object.get_absolute_url()) diff -r b3eb9a757704 -r 87dafa5e8959 projects/models.py --- a/projects/models.py Fri Dec 11 22:22:27 2009 -0500 +++ b/projects/models.py Sat Jan 09 01:01:28 2010 -0500 @@ -12,9 +12,8 @@ posted = models.DateTimeField(blank=False, default=datetime.datetime.now) slug = models.SlugField() - @models.permalink def get_absolute_url(self): - return ('project-view', (self.slug,),) + return u'/projects/%s/' % (self.slug,) def __unicode__(self): return u"%s" % (self.name,) diff -r b3eb9a757704 -r 87dafa5e8959 settings.py --- a/settings.py Fri Dec 11 22:22:27 2009 -0500 +++ b/settings.py Sat Jan 09 01:01:28 2010 -0500 @@ -94,9 +94,13 @@ 'django.contrib.admin', 'django.contrib.markup', 'django.contrib.flatpages', + 'django.contrib.comments', 'stevelosh.blog', 'stevelosh.projects', 'stevelosh.messengerbag', 'mobileadmin', 'typogrify', + 'disqus', ) + +from deploy import * \ No newline at end of file