在OSQA(Django&python)上添加qestion时,它的主体是空的

2024-04-24 00:01:59 发布

您现在位置:Python中文网/ 问答频道 /正文

我目前正在研究OSQA,当我试图从另一个问答网站导入一些问题和答案时,我真的遇到了麻烦。在

在发帖前搜索,我在元数据.osqa以及一些典型的错误,但它不再有效。 http://meta.osqa.net/questions/4080/how-can-i-import-data-from-another-question-and-answer-script

另一方面,我的代码是:

from django.core.management.base import NoArgsCommand

from forum.models import *
from forum.actions import *
class Command(NoArgsCommand):
    def handle_noargs(self, **options):
        #retrieve the "asker" from the database
        # "15" for Alumno Paco
        user = User.objects.get(id=15)
        #prepare question data
        qdata = dict(
           title = "Como funciona el TabViewController",
           text = "No entiendo como funciona el TabViewController, alguna ayuda?",
           tags = "iOS iPhone Xcode",
        )
        #save the question, everything will be handled internally,
        #like creating the tags if they don't exist, etc 
        AskAction(user=user).save(data=qdata)

这个命令在我的OSQA站点上正确地创建了问题,除了问题的主体(文本)是空的。在

令人好奇的是,当手动添加问题时,直接从注册为用户的站点中添加问题时,它会成功创建。在

在阅读中,我发现这是一个降价的问题,但是我发现的解决方案已经不再适合,因为它们讨论的是编辑mdx_urlizer.py在当前版本的OSQA中不存在的文件。在

提前谢谢!在

基克罗克斯


Tags: thefromimportdatatagsforumelquestion
2条回答

osqa日志可以为您提供关于该bug的更多信息。它位于osqa/log中/django.osqa.log. 在

要解决这个问题,您需要在任何python markdow函数中替换“html5”的参数扩展。在

markdown2.5版本似乎有问题。在

我通过安装markdown2.4版本解决了这个问题,即:

pip uninstall markdown
pip install markdown==2.4

相关问题 更多 >