Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Error: Database test_myapp couldn't be flushed. Possible reasons:
- * The database isn't running or isn't configured correctly.
- * At least one of the expected database tables doesn't exist.
- * The SQL was invalid.
- Hint: Look at the output of 'django-admin.py sqlflush'. That's the SQL this command wasn't able to run.
- The full error: column "id" of relation "threadedcomments_comment" does not exist
- ...
- SELECT setval(pg_get_serial_sequence('"threadedcomments_comment"','id'), 1, false);
- ...
- class ThreadedComment(Comment):
- title = models.TextField(_('Title'), blank=True)
- parent = models.ForeignKey('self', null=True, blank=True, default=None,
- related_name='children', verbose_name=_('Parent'))
- last_child = models.ForeignKey('self', null=True, blank=True,
- verbose_name=_('Last child'))
- tree_path = models.TextField(_('Tree path'), editable=False,
- db_index=True)
- #id = models.IntegerField()
- objects = CommentManager()
- def _get_depth(self):
- return len(self.tree_path.split(PATH_SEPARATOR))
- depth = property(_get_depth)
- def _root_id(self):
- return int(self.tree_path.split(PATH_SEPARATOR)[0])
- root_id = property(_root_id)
- def _root_path(self):
- return ThreadedComment.objects.filter(pk__in=self.tree_path.
- split(PATH_SEPARATOR)[:-1])
- root_path = property(_root_path)
- def save(self, *args, **kwargs):
- skip_tree_path = kwargs.pop('skip_tree_path', False)
- super(ThreadedComment, self).save(*args, **kwargs)
- if skip_tree_path:
- return None
- tree_path = unicode(self.pk).zfill(PATH_DIGITS)
- if self.parent:
- tree_path = PATH_SEPARATOR.join((self.parent.tree_path, tree_path))
- self.parent.last_child = self
- ThreadedComment.objects.filter(pk=self.parent_id).update(
- last_child=self)
- self.tree_path = tree_path
- ThreadedComment.objects.filter(pk=self.pk).update(
- tree_path=self.tree_path)
- class Meta(object):
- ordering = ('tree_path',)
- db_table = 'threadedcomments_comment'
- verbose_name = _('Threaded comment')
- verbose_name_plural = _('Threaded comments')
- CREATE TABLE threadedcomments_comment (
- comment_ptr_id integer NOT NULL,
- title text NOT NULL,
- parent_id integer,
- last_child_id integer,
- tree_path text NOT NULL
- );
Add Comment
Please, Sign In to add comment