【问题标题】:when adding a qestion on OSQA (django&python) its body is empty在 OSQA (django python) 上添加问题时,其正文为空
【发布时间】:2014-04-03 11:45:58
【问题描述】:

我目前正在从事 OSQA 工作,当我尝试从另一个问答网站导入一些问题和答案时,我确实遇到了麻烦。

发帖前搜索,在meta.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 网站上正确创建问题,但问题的正文(文本)为空。

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

阅读后,我发现这是 Markdown 的问题,但我发现的解决方案不再适用,因为他们谈论的是编辑当前版本的 OSQA 上不存在的 mdx_urlizer.py 文件。

提前致谢!

凯乐克斯

【问题讨论】:

    标签: python django markdown osqa


    【解决方案1】:

    markdown2.5 版本似乎有问题。

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

    pip uninstall markdown
    pip install markdown==2.4
    

    【讨论】:

      【解决方案2】:

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

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2012-03-23
        • 1970-01-01
        • 2020-09-16
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-09-03
        相关资源
        最近更新 更多