Guest User

Untitled

a guest
Jul 18th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. def user_registration(request):
  2. from accounts.forms import UserRegistrationForm
  3. form = UserRegistrationForm(request.POST)
  4. if not form.is_valid():
  5. return {
  6. 'errors': form.errors.as_json(escape_html=False)
  7. }
  8. ### This can still return error, how to handle it? try catch?
  9. user = form.save()
  10. return {
  11. 'user': user.id,
  12. }
Add Comment
Please, Sign In to add comment