when i try to add a post method in my app it shows this message :
Method not allowed (Post): HTTP/1.1 405 0
Views.py:
class AddTeamView(View):
def get(self, request):
form = TeamForm()
context = {'form': form}
return render(request, 'add_team.html', context)
add_team.html :
{% extends 'base.html' %}
{% block title %}
Add a Team
{% endblock %}
{% block content %}
<form action="/add_team/" method="post">
{% csrf_token %}
<!-- this form content is called from the view.py/context-->
{{ form }}
<input type="submit" value="اضافة "/>
</form>
{% endblock %}
urls.py:
urlpatterns =[
url(r'^admin/', admin.site.urls),
url(r'add_team/$', AddTeamView.as_view(), name='add-team-view'),
]
settings.py:
STATIC_URL = '/static/'
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
)
forms.py :
from django import forms
class TeamForm(forms.Form):
name = forms.CharField(label='اسم الفريق')
details = forms.CharField(label='تفاصيل الفريق')
can anyone help plz?