1.要实现一个功能数据集里面的作循环然后将其中的一个值传到下一个当数据集的条件想了一下只能是考虑使用 自定义标签的办法了! from django import template from django.template import Context, Template, loader, resolve_variable register = template.Library() class PostDetailNode(template.Node): def __init__(self, id, current_post_id): self.id = id self.current_post_id = current_post_id ...
by hkebao - Python文档中心 - 2009-08-24 08:17:44 阅读(2710) 回复(0)
请问一下大家是怎么获取到input file中的文件路径的,我通过网页 中的post去查询详细的输出,没有找到客户端文件路径的信息, 请问有什么其它的方式可以获取得到吗?谢谢。
我一直在家里做python,家里机器较差,为P41.70G,256M内存。但在家里时,跑django经常出现莫名其妙的错误,比如登录后显示的是“找不到服务器”,要后退,再登录一次,或者刷新好几次。有些功能不能使用,比如admin下的修改口令等功能均不能用,点击后好长时间是打不开页面的错误。 起初我以为是django自带的baseHttpServer的问题,后来今天把配置文件和程序全拿到公司机器上跑下,一模一样的配置,一样的数据库mysql,结果没一点...
1.在python中应用日志的功能代码如下: import logging LEVELS = {'debug': logging.DEBUG, 'info': logging.INFO, 'warning': logging.WARNING, 'error': logging.ERROR, 'critical': logging.CRITICAL} level = LEVELS.get('debug',logging.NOTSET) logging.basicConfig(level = level) logging.debug('This is a debug message') 这个只是一个DEBUG级别的日志记录功能。 import loggin...
django的new form库很不错,但是,现在遇到一个问题。描述如下: class MyForm(forms.Form): sub_group = forms.ChoiceField(choices = ()) 我现在的问题是,choices的参数需要根据不同的用户来查找,我怎么把我的参数传入? 谢谢!
今天学习了《django Step by Step》第七章,感谢limodou提供初学者如此精彩的入门教程。 文章地址 http://www.woodpecker.org.cn/obp/django/django-stepbystep/newtest/doc/tut07.html 通篇看了第七章,请问作者是否忘了增加介绍编辑address/view.py的部分,因为增加的模版address_list.html在代码中没找到使用该模版的地方?(可能是我看代码不仔细) 文章最后的图中显示的姓名是7位的,但是文中介绍只能输入6位,请问图片是否有...
在项目中用到验证码,懒得去找,自己随便写了一个: views.py: def get_check_code_image(request,image='media/images/checkcode.gif'): import Image, ImageDraw, ImageFont, random im = Image.open(image) draw = ImageDraw.Draw(im) mp = md5.new() mp_src = mp.update(str(datetime.now())) mp_src = mp.hexdigest() rand_str = mp_src[0:4] draw.text...
http://www.woodpecker.org.cn/obp/django/django-faq/templates.html 讲django模板比较详细 本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/84280/showart_2016460.html
看到啄木鸟上面一篇关于django自带的用户认证系统的介绍,学习了一下 文章地址:http://wiki.woodpecker.org.cn/moin/djangoAuth-ZH
manage.py syncdb后创建超级用户那些没问题,认证系统装好了
然后我 from django.contrib.auth.models import User 时出问题了:
Traceback (most recent call last):
File "
5.拷贝FCKEditor目录下的 fckeditor.py 到 util目录下.查找 IsCompatible 方法定义.修改如下 def IsCompatible(self): if self.sAgent: sAgent = self.sAgent elif (os.environ.has_key("HTTP_USER_AGENT")): sAgent = os.environ.get("HTTP_USER_AGENT", "") else: sAgent = "" if (sAgent.find("MSIE") >= 0) and (sAgent.find("mac") 0) an...