小编Tom*_*Joy的帖子

Django 表单缓存或重新加载问题

我有一个页面可以将值插入到数据库中。插入后加载另一个页面,其中包含列出数据库值的下拉列表,但插入的值未在下拉列表中列出

问题不在于事务/提交等。以第二种形式检索下拉列表数据的查询是正确的。

表格1(首页)

class Organization(forms.Form):   
    orgList = getOrgUnitList()     

    orgUnit = forms.CharField(label=u'Organization Name',
                            max_length=50,
                            error_messages={'required':'Organization name is required field.'})
    parentOrg= forms.ChoiceField(label=u'Parent Organization',
                       choices=[(u'Select',u'Select')]+orgList,
                       error_messages={'required':'Organization name is required field.'})
Run Code Online (Sandbox Code Playgroud)

Form2(第二页)

class User(forms.Form):    
    orgUnitList = getOrgUnitList()        

    email = forms.EmailField(label=u'Email',
                         max_length=50,
                         error_messages={'required':'Email is required field'})  
    orgUnit = forms.ChoiceField(label=u'Organizational Unit',   
                  choices=orgUnitList,                        
                  error_messages={'required':'Organizational unit is required field'})
Run Code Online (Sandbox Code Playgroud)

询问

def getOrgUnitList():
    orgUnitList = list(OrganizationUnit.objects.values_list
               ('OrgUnitID','OrgUnitName').order_by('OrgUnitName'))
    return orgUnitList
Run Code Online (Sandbox Code Playgroud)

但是当我尝试绑定视图中的选择时,它正在工作 代码 *视图*

def user()
    template = get_template('AddUser.html')
    form = AddUser()     
    orgUnitList = getOrgUnitList()                    
    del objAdminUIDA
    form.fields['orgUnit'].widget.choices=orgUnitList
    variables …
Run Code Online (Sandbox Code Playgroud)

forms django

5
推荐指数
1
解决办法
1878
查看次数

Python Beautifulsoup img标签解析

我正在使用 beautifulsoup 来解析“www.youtube.com”中存在的所有 img 标签

代码是

import urllib2
from BeautifulSoup import BeautifulSoup
page = urllib2.urlopen('http://www.youtube.com/')
soup = BeautifulSoup(page)
tags=soup.findAll('img')
Run Code Online (Sandbox Code Playgroud)

但是我没有得到所有的 img 标签。获取 img 标签也是无效的。

解析后得到的img标签与页面源img标签不同。缺少某些属性。

我需要在 youtube.com 中获取所有视频 img 标签

请帮忙

python image beautifulsoup

5
推荐指数
2
解决办法
2万
查看次数

为apache安装mod_wsgi模块

当我为APACHE安装WSGI模块时

我从http://code.google.com/p/modwsgi/downloads/detail?name=mod_wsgi-win32-ap22py27-3.3.so下载了模块

重命名为mod_wsgi.so

复制到C:\ Program Files\Apache Software Foundation\Apache2.2\modules

在C:\ Program Files\Apache Software Foundation\Apache2.2\conf中编辑'httpd.conf'

在httpd.conf的模块加载部分添加'LoadModule wsgi_module modules/mod_wsgi.so'行

重启Apache

Apache无法重新启动

错误日志中的错误是:C:/ Program Files/Apache Software Foundation/Apache2.2/conf/httpd.conf的第129行语法错误:无法加载C:/ Program Files/Apache Software Foundation/Apache2.2/modules/mod_wsgi.so进入服务器:找不到指定的模块.

这不是文件扩展名或权限的问题.请帮忙.

apache mod-wsgi

4
推荐指数
1
解决办法
9080
查看次数

标签 统计

apache ×1

beautifulsoup ×1

django ×1

forms ×1

image ×1

mod-wsgi ×1

python ×1