Vote count:
0
I need to check if a checkbox on a template is checked, then perform some function into views.py.
So far I don't know if I'm doing it right, but it seems it doesn't checks for the checkbox so it doesn't perform anything.
For example, this function on views.py:
if existente is not None and existente != '':
projects = Proyecto.objects.filter(nombre_proyecto=name)
ctx = {"projects" : projects}
return render_to_response('scppp/proyecto.html', ctx, context_instance=RequestContext(request))
Here, existente is a BooleanField already declared on models.py and forms.py, and in my template it goes like this:
<tr><td>
<input class="check-style" type="checkbox" name="existente" value="existente" >Existente</input>
</td></tr>
If this is checked, perform the function, but so far it isn't working, it even throws an NameError existente field is not defined
Should I do something else to make it work?
Thanks in advance!
asked 39 secs ago
Passing an argument from template to function - Django
Aucun commentaire:
Enregistrer un commentaire