예제 #1
0
 def test_registration_form(self):
     """ Test that a registration form validates properly. """
     data = {"name": "TESTING", "email": "*****@*****.**",
             "password": "******", "confirm_password": "******"}
     form = RegistrationForm(data)
     self.assertTrue(form.is_valid())
     self.assertEqual(data, form.clean())
     profile = form.save()
     self.assertEqual(profile.email, profile.user.username)
     self.assertTrue(profile.user.check_password(data["password"]))
     form = RegistrationForm(data)
     self.assertTrue(form.is_valid())
     self.assertRaises(IntegrityError, form.save)
예제 #2
0
def register_austinpython_post(request):
    """ Handle PUT requests for registration. """
    form = RegistrationForm(request.POST)
    profile = form.save()
    url = "/profiles/%s" % profile.user.id
    return redirect(url)