Jan Vorcak
Jan Vorcak

Reputation: 20029

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?

Thank you so much

Upvotes: 2

Views: 160

Answers (1)

DrTyrsa
DrTyrsa

Reputation: 31991

Use ModelForms

Upvotes: 2

Related Questions