Django View Throwing HttpResponseError -
i trying map view path in urls.py
, when try throws error:
registration didn't return httpresponse object
urls.py
urlpatterns = patterns('', (r'^register/$', registration), (r'^newuser/$', processregistration), )
views.py
def registration(request): regform = registrationform(request.post or none) if request.method == 'post': if regform.is_valid(): clearusername = regform.cleaned_data['usernm'] clearpass = regform.cleaned_data['userpass'] regform.save() try: return httpresponseredirect('/newuser/?usernm=' + clearusername) except: raise validationerror(('invalid request'), code='300') ## [ todo ]: add custom error page here. else: regform = registrationform() return render(request, 'va/reuse/register.html', { 'regform': regform }) def processregistration(request): clearusername = request.get.get('usernm') return httpresponse("wee")
when visit /register
, throws above error.
any idea why not working? returning response of wee
the validators=[]
usernm
messing within models.py . doing:
class client(models.model): usernm = models.emailfield(verbose_name="email",max_length=50,unique=true,validators=[regexvalidator('^\w{6,50}$','format: invalid username','invalid entry')]) userpass = models.charfield(verbose_name="password", max_length=50)
i changed usernm
declaration to:
usernm = models.emailfield(verbose_name="email",max_length=50,unique=true)
Comments
Post a Comment