Why not render the form?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
16 views
Not renderit form
views
def contact_Form(request): if request.method == "POST": form = contactForm(request.POST) return render(request, 'about/about.html', {'form':form})

fomrs
class contactForm(forms.ModelForm): class Meta: models = contact fields = ('name', 'email', 'text')

model
class contact(models.Model): name = models.CharField(verbose_name = "Name", max_length=60, blank=True, default=None) email = models.EmailField() text = models.TextField(blank=True, default=None)

Template
{{ form.as_p }} 
by | 16 views

1 Answer

0 like 0 dislike
After ‘aboutPost5’: ...
Add ‘form’: contactForm.

Also Google "PEP8" and read.
And one more thing. If You assign variables aboutPost1-5 means You are doing something wrong. Add a model field that will combine all the records and filter on it.
by

Related questions

0 like 0 dislike
1 answer
asked Apr 29, 2019 by ma3xak
0 like 0 dislike
1 answer
0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
110,608 questions
257,187 answers
0 comments
40,796 users