Somewhere in the paths of error,but where?


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
10 views
urls.py(main)
from django.contrib import admin admin.autodiscover() mapping includes = patterns(", # ... # let's connect urls.py app contact url(r'^contact/', include('contact.urls')),


urls.py directory contact
rom django.conf.urls import patterns, include, url mapping includes = patterns[ url(r'^$', 'views.contact', name='contact'), ]


views.py
from django.shortcuts import render from django.http import HttpResponse def contact(request): errors = [] form = {} if request.POST: form['name'] = request.POST.get('name') form['email'] = request.POST.get('email') form['message'] = request.POST.get('message') if not form['name']: errors.append('Complete name') if '@' not in form['email']: errors.append('please Enter a valid e-mail') if not form['message']: errors.append('Enter a message') if not errors: # ... saving data in database return HttpResponse('Thanks for your message!') return render(request, 'contact.html', {'errors': errors, 'form':form})
by | 10 views

2 Answers

0 like 0 dislike
Error here:
mapping includes = patterns[
url(r'^$', 'views.contact', name='contact'),
]

patterns is a function where the first argument is the prefix. But in General he deprecated a long time ago and you can just use.
by
0 like 0 dislike
Proportionate views and remove quotes from 'views.contact'

from contact import views #... url(r'^$', views.contact, name='contact'), # ...
by

Related questions

0 like 0 dislike
4 answers
asked Jun 6, 2019 by AntonBrock
0 like 0 dislike
5 answers
110,608 questions
257,186 answers
0 comments
35,574 users