
celery -A celery_tasks.server beat
django 使用celery定时任务完成邮件,信息,钉钉的发送_BeefpasteC的博客-CSDN博客
这个是在 django的,viwes.py 中的,视图处理函数中的
# 获取文章详细信息,包含一个CommentForm表单def detail(req, article_id):
if req.method == 'POST':
form = CommentForm(req.POST)
if form.is_valid():
name = form.cleaned_data['name']
address = form.cleaned_data['address']
email = form.cleaned_data['email']
context = form.cleaned_data['context']
article = Article.objects.get(pk=article_id)
comment = Comment(article=article, name=name, address=address, email=email, context=context)
comment.save()
return HttpResponseRedirect('dlog/detail.html')
例如这个。
cleaned_data 就是读取表单返回的值,返回类型为字典dict型
cleaned_data['email'] 读取name为 ‘email’的表单提交值,并赋予 email变量
官方文档不容错过: http://django-chinese-docs-16.readthedocs.org/en/latest/
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)