本文整理汇总了Python中forms.UploadForm.as_p方法的典型用法代码示例。如果您正苦于以下问题:Python UploadForm.as_p方法的具体用法?Python UploadForm.as_p怎么用?Python UploadForm.as_p使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类forms.UploadForm
的用法示例。
在下文中一共展示了UploadForm.as_p方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: put
# 需要导入模块: from forms import UploadForm [as 别名]
# 或者: from forms.UploadForm import as_p [as 别名]
def put(request):
"""
Se ocupa de poner un fichero en tagfs,
verificando que se cumplen todos los requisitos del form.
"""
form = UploadForm()
if request.method == 'POST':
form = UploadForm(request.POST, request.FILES)
if form.is_valid():
name = form.cleaned_data['name']
description = form.cleaned_data['description']
tags_cleaned = form.cleaned_data['tags']
data = form.cleaned_data['data']
replication = form.cleaned_data['replication']
tags = set()
for tag in tags_cleaned.split():
tags.add(tag)
data = data.read()
description = not description and 'Uploaded using the web client.' or description
replication = not replication and 25 or replication
save = CLIENT.put(name, description, tags, 'tagfs', 'tagfs', 775, data, replication)
form = UploadForm()
return render_to_response(PUT_TEMPLATE,
{'form_put': form.as_p(), 'save': save,
'put': True},
context_instance=RequestContext(request))
return render_to_response(PUT_TEMPLATE,
{'form_put': form.as_p(), 'put': True},
context_instance=RequestContext(request))