python - create a django form object and save it -


i have signup form object i'm using create signup page. i'm trying add guest user feature app. want create user account automatically when user visits page. i'm trying create form object in backend, populate , call save method explicitly. couldn't find way populate fields backend. how can achieve this?

if want create model instance (in case user) in view data doesn't come post or data, don't use forms, rather model's api.

for instance user class provides helper function (example taken documentation) :

from django.contrib.auth.models import user  user = user.objects.create_user('john', 'lennon@thebeatles.com', 'johnpassword') 

more details here : https://docs.djangoproject.com/en/1.7/topics/auth/default/#user-objects

and here : https://docs.djangoproject.com/en/1.7/ref/contrib/auth/#django.contrib.auth.models.usermanager.create_user

this works model class. can use create guest user dynamically if don't know client, while log him/her otherwise.

the part when decide whether know client or not interesting think it's out of question's scope.


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -