Django. Add from html forms into a model?

Welcome, comrades.
I here suffer a possible Django and stumbled for a moment.
I need from the HTML form of the five fields to add data to the model. Later, pull all the data in the list view.
Please help. As an example, or knowledge, anything goes.
Just ask not to throw Slippers all cookies and good ^_^
July 8th 19 at 16:17
1 answer
July 8th 19 at 16:19
Solution
Here working with forms, of documentation. djbook.ru/rel1.9/intro/tutorial04.html

His own example of working with forms.

a model:
class Start(models.Model):
 number_starts = models.TextField(verbose_name='Number',blank=True)
 date = models.DateTimeField(auto_now_add=True)
 result = models.TextField(verbose_name='the Result')
 def __str__(self):
 return str(self.number_starts)


Create the form.
class Form_Start(ModelForm):

 class Meta:
 model = Start
 fields = ('number_starts','result')

 ###The styles field,a creation start
 widgets = {
 'number_starts': forms.Textarea(attrs={'class': 'form-control', 'rows': '1'}),
 'result': forms.Textarea(attrs={'class': 'form-control', 'rows': '3'}),
 }


Submission(vyuha)
#Create start
def Create_Start(request,slug):
 if request.method == "POST":
 form = Form_Start(request.POST)
 if form.is_valid():
 form_valid = form.save(commit=False) #do not save completed forms
 here I have my checking and processing
form_valid.save()
 return redirect('/'+slug+'/')
else:
 return render(request, "html/create_start.html", {})
else:
 form = Form_Start()

 return render(request, "html/create_start.html", {'form':form,
'slug':slug,
 })


The template looks something like this
<form method="post">
 {% csrf_token %}{{ form.as_p }}<br>
 <input type="button" class="btn btn-default" onclick="history.back()" value="Back">
 <input type="submit" class="btn btn-default" value="Save">
 </form>
Thanks, will try :) - Zelma_Block5 commented on July 8th 19 at 16:22

Find more questions by tags HTMLPythonDjango