开发者

Simple post and get methods in Django

开发者 https://www.devze.com 2023-01-26 13:03 出处:网络
I\'m a newbie in Django and I have stupid question. I\'ve seen a lot of tutorials, but I can\'t understand how to work with post data in Django.

I'm a newbie in Django and I have stupid question. I've seen a lot of tutorials, but I can't understand how to work with post data in Django. I have a form with 1 text field and 1 'choose' field, after that I press 'Submit' button and

Django displays me messages about certificat开发者_运维知识库es and other sh1... So please give me example with forms, post data, and get data. Another question is - how to add information in database, from values that user input in forms. I can add static info, but it doesn't work for me.

I know that this should be simple, but I'm seems to be stupid.

It will helps many others I think.


To add information into the db from forms, you should be using ModelForms. It's all very well documented here.


The data from a form that is posted to your view is available in request.POST. See http://docs.djangoproject.com/en/dev/ref/request-response/ for more info.

I would strongly suggest you work through the tutorial. It will answer all your questions and more. http://docs.djangoproject.com/en/dev/intro/tutorial01/

0

精彩评论

暂无评论...
验证码 换一张
取 消