Opened 12 years ago

Closed 12 years ago

#19790 closed Uncategorized (invalid)

myform.is_valid() is always giving me false!

Reported by: anonymous Owned by: nobody
Component: Uncategorized Version: 1.4
Severity: Normal Keywords: is_valis()
Cc: samantoutita@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

here's what I have in models.py class Recipe(models.Model):

name = models.CharField(max_length=200)

prep_steps = models.TextField()
time_to_prepare = models.IntegerField()



class RecipeForm(ModelForm):

class Meta:

model = Recipe

and in views.py I have

def add(request):

if 'name' in request.POST:

form = RecipeForm(request.POST)
if form.is_valid():

r.save(force_insert=True)
return HttpResponse("it's working")

else:

return render_to_response('create_recipe.html', {'error': True})

return HttpResponse("it's NOT working")

for some reason the form.is_valid() is always false.
Can someone see what I can fix in it ?

Thanks

Change History (2)

comment:1 by anonymous, 12 years ago

comment:2 by Aymeric Augustin, 12 years ago

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top