Does it work?
On Mon, Jan 15, 2018 at 5:05 AM, Amitkumar Satpute <
[email protected]> wrote:
>
> 1.
> 2.
> 3.
> 4. views.py
> 5. -------------------------------------------
> 6. class UpdateUser(View):
> 7. def post(self,request,pk):
> 8. user=get_object_or_404(User,pk=pk)
> 9. userinfo=get_object_or_404(UserCreation,user=user)
> 10. user_form=UserUpdateForm(request.POST,instance=user)
> 11. user_creation_form=UserCreationForm(request.POST,instance=userinfo)
> 12. if user_form.is_valid() and user_creation_form.is_valid():
> 13. user=user_form.save(commit=False)
> 14. user.save()
> 15. user_create=user_creation_form.save(commit=False)
> 16. user_create.modified_date()
> 17. user_create.save()
> 18. return redirect('adminaccount:add_user')
> 19. return render(request,'adminaccount/add_new_user.html',{'user_form'
> :user_form,'user_creation_form':user_creation_form,'btn':'Update'})
> 20.
> 21. def get(self,request,pk):
> 22. user=get_object_or_404(User,pk=pk)
> 23. userinfo=get_object_or_404(UserCreation,user=user)
> 24. user_form=UserUpdateForm(instance=user)
> 25. user_creation_form=UserCreationForm(instance=userinfo)
> 26. return render(request,'adminaccount/add_new_user.html',{'user_form'
> :user_form,'user_creation_form':user_creation_form,'btn':'Update'})
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/ef2efcff-ed34-4fd6-8764-6af4aba4ad5a%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/ef2efcff-ed34-4fd6-8764-6af4aba4ad5a%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/CA%2BFDnhJ6ZqzhZc-CR8n-R4yj_%2B_WjHt9AB7YYeT9ewCT11ROnw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.