开发者

django - create user from request

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜