Forms in Django, help?

Asked

Viewed 59 times

0

Is there any way to work with Forms in a practical way in Django?

The point is that I am creating a site on my own and as I already knew Python, so I decided to use Django. "Everything" was fine, until I tried to create a form of registration for such site. I’ve seen several tutorials on Youtube and I can’t do the blessed form and when I can, I can’t integrate it into the CSS.

The fact that while doing front of the site I created this form:

<form method="post">
  <label class="#">Nome completo:</label>
  <input class="#" type="text" name="">
  <div class=#></div>
  <label class="#">Email:</label>
  <input class="#" type="text" name="">
  <div style="#"></div>
  <label class="#">Senha:</label>
  <input class="#" type="password" name="" autocomplete="off">
  <div style="#"></div>
  <label class="#">Confirmar senha:</label>
  <input class="#" type="password" name="" autocomplete="off">
  <div style="#"></div>
  <label class="#">País:</label>
  <input class="#" type="text" name="">
  <div style="#"></div>
  <label class="#">Cidade:</label>
  <input class="#" type="text" name="">
  <div style="#"></div>
  <label class="#">Data de Nascimento:</label>
  <input class=# type="text" name="">
  <div style="#"></div>
  <input style="#" type="submit" value="Confirmar cadastro" id="cadastrar" name="cadastrar">
</form>

My question is: Is there any way I create a DB with the respective fields and say basically

"Nome completo" == Nome,
"Cidade" == cidade
    ...
def save(): #Função pra salvar na DB
  • 1

    The model doesn’t exactly do that? And Django has tools to work with forms.

  • Django Forms basically does this

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.