我有一个像下面这样的模型。
class Content(SimpleModel):
title = models.CharField(max_length=255)
body = models.TextField()
slug = models.SlugField(max_length=50)
def __unicode__(self):
return self.title
class MediumStuff(models.Model):
meta_value = models.TextField()
meta_key = models.SlugField('Field Name', max_length=50, blank=True)
content = models.ForeignKey(Content)
def __unicode__(self):
return self.slug
class SmallStuff(models.Model):
text = models.CharField(max_length=60, blank=True, null=True)
content = models.ForeignKey(Content)
Run Code Online (Sandbox Code Playgroud)
我想要做的是使用 inlineformset_factory()
我参考了Django Documentation,但他们有一个关于如何使用单个外键模型的示例。
ContentFormSet = inlineformset_factory(Content, [MediumStuff, SmallStuff])
也不
ContentFormSet = inlineformset_factory(Content, (MediumStuff, SmallStuff))
没有用。
由于可以向管理员添加多个内联,我相信这是可以做到的:)
您有任何建议/任何资源或提示吗?或者可能告诉我应该在哪里查看管理员如何处理多个内联?
我试图去http://lustiges-taschenbuch.de这是一个有效的漫画书网站.
我错误地将地址输入为http://lustigestaschenbuch.de,并惊讶地看到我自己的apache localhost目录(!).这发生在Windows 7中的两台计算机上.
我检查了我的c:\ windows\system32\drivers\etc\hosts文件,但没有列出任何内容.
我在这个网站http://www.whoishostingthis.com上查了一下,但找不到主人.
我在denic看了一下,它说主人是:
Domaininhaber: Tapon del Darien LLC
Organisation: Tapon del Darien LLC
Adresse: First Floor-Commercial Area
Calle 53 , Marbella
P.O. BOX 0832-0588
PLZ: 0832-0588
Ort: Panama City
Land: PA
Run Code Online (Sandbox Code Playgroud)
任何人都可以解释为什么以及如何显示客户端计算机的localhost目录?
运行时出错
pip install datapkg
Run Code Online (Sandbox Code Playgroud)
错误是这样的:
"RuntimeError: maximum recursion depth exceeded while calling a Python object"
Run Code Online (Sandbox Code Playgroud)
部分追溯:
RuntimeError: maximum recursion depth exceeded while calling a Python object
----------------------------------------
Command /usr/bin/python -c "import setuptools; __file__='/home/okfn/var/srvc/data.staging.wheredoesmymoneygo.org/pyenv/src/wdmmg/build/datapkg/setup.py'; execfile('/home/okfn/var/srvc/data.staging.wheredoesmymoneygo.org/pyenv/src/wdmmg/build/datapkg/setup.py')" install --single-version-externally-managed --record /tmp/pip-dV62d0-record/install-record.txt --install-headers /home/okfn/var/srvc/data.staging.wheredoesmymoneygo.org/pyenv/src/wdmmg/lib/include failed with error code 1
Exception information:
Traceback (most recent call last):
File "/usr/lib/python2.6/dist-packages/pip.py", line 252, in main
self.run(options, args)
File "/usr/lib/python2.6/dist-packages/pip.py", line 410, in run
requirement_set.install(install_options)
File "/usr/lib/python2.6/dist-packages/pip.py", line 2017, in install
requirement.install(install_options)
File "/usr/lib/python2.6/dist-packages/pip.py", line 1515, in install …Run Code Online (Sandbox Code Playgroud) 我有一个带有一些文字的文字区域.我还有一个"onsubmit"事件处理程序.在那里我有一个文本区域的innerHTML的警报,我得到了textarea内部的文本.然后我尝试将其分配给隐藏输入元素的"value"属性.但是,从未分配值,当表单发布时,隐藏元素没有值.
我甚至尝试过这样的事情
hiddenElement.value = "please work " + textarea.innerHTML;
并且这也不起作用,但是当我这样做并提交表单时,表单处理程序(jsp页面)显示"请工作"作为隐藏输入被接收.
我也检查过firebug,隐藏的元素只提交"请工作",而不是文本区域的innerHTML.
我错过了什么?
在shell脚本中处理缺少参数的"正确"方法是什么?是否有预先固定的方法来检查这个然后抛出异常?我是一个绝对的初学者.
有没有办法在网站上构建键盘可访问的下拉菜单?我们当前的Web应用程序具有标准的悬停菜单,但是这确实减慢了我们的数据录入员(谁习惯于桌面应用程序,其中有一个键盘访问菜单,无需使用鼠标).
我们想出如何证明使用键盘快捷键的菜单,但我不知道如何选择其中一个条目(如在大多数桌面应用程序使用菜单项的第一个字母等).
编辑 - 指向执行此操作的网站或其他类型的示例的链接将非常有用
我知道颠覆,但有时我想要更简单的东西,比如简单的旧文件,只需自动标记文件。 http://www.filehamster.com/这样做,但我更喜欢开源的东西。任何人都知道这样的事情吗?
我想检查客户端(jQuery)是否从PHP函数返回数据是Json对象或String来分配不同的函数.
我正试图找到解决这个问题的方法.我有一个Ruby脚本需要运行一些PHP代码,但我是Ruby新手,所以我不知道如何去做.
def run_my_code
#execute some PHP code here
# $person = new Person();
# $person->doSomething();
end
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?
我需要编写一个Lisp函数来查找两个节点之间的最长路径,而无需重新访问任何节点.但是,如果起始节点和结束节点相同,则可以重新访问此节点.该函数需要是递归和深度优先搜索.
我一直试图在这里工作几个小时,并且无法提出解决方案.我知道函数的一般大纲,但无法正确编程.在一些代码中,主要是伪代码:
(defun longest-path (start end net &optional (current-path nil))
(cond ((and (eql start end)
(not (null current-path)))
(list start))
(t
(find neighbors of start/node)
(remove any previously traveled neighbors to avoid loop)
(call longest-path on these neighbors)
(check to see which of these correct paths is longest))))
Run Code Online (Sandbox Code Playgroud)
网看起来像'((ab)(bc)),其中第一项是节点,其他一切都是它的邻居(例如,节点a有邻居b,节点b有邻居c).
是的,这是用于家庭作业,所以如果你觉得发布解决方案或其任何部分感觉不舒服,那就不要了.我只是Lisp的新手,想要一些技巧/帮助,以获得一个不错的开始.
谢谢
编辑:嗯,我能得到的最多是:
(defun longest-path (start end net &optional (current-path nil))
(cond ((and (eql start end)
(not (null current-path)))
(list start))
(t
(push start current-path)
(let ((neighbors (cdr (assoc start net)))) …Run Code Online (Sandbox Code Playgroud)