开发者

django - create user from request

开发者 https://www.devze.com 2023-03-11 01:21 出处:网络
I need some help with django request I want to add a custom form proccessing to add a user (or any other model instance)

I need some help with django request I want to add a custom form proccessing to add a user (or any other model instance)

I don't want to create it like this

tagName = request.POST["tagname"]
        new_tag = Tag()
        new_tag.name = tagName
        new_tag.save()

because I would need to rewrite this code everythime something changes in the model Is there any way how can I create a model instance from the request? What is the way django-admin do this?

Than开发者_运维知识库k you so much


Use ModelForms

0

精彩评论

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