【发布时间】: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