These are chat archives for django/django

Jun 2016
Robin Ury
Jun 19 2016 12:44
Jun 19 2016 14:38

how I get values from a form ?
In my html file I use a couple of input boxes ... It is a registration sort of form , the goal is to save the data entered into the DB
My view look like this :

a = MyTable( field1 = request.POST.get([value of name field 1 from the input box] , '') ,
... ,
fieldn = request.POST.get([value of name field n from the input box] , ''))

No error but the table gets populated but with empty values ...

Filip Figiel
Jun 19 2016 14:44
@QbasicFan you could use django.forms.Form for that
form = MyForm(data=request.POST)
if form.is_valid():
  print form.cleaned_data
also consider using a FormView, it makes building complex views much easier!
Jun 19 2016 14:50
@megapctr thanks
David Weir
Jun 19 2016 21:37
Is good you have a channel on here I am a fan of this PS one of the organisations I volunteer for makes sites using Django