Code

#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

Attachments (0)

Change History (2)

comment:1 Changed 17 months ago by anonymous

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 17 months ago by aaugustin

  • Resolution set to invalid
  • Status changed from new to closed

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.