Hello,

Newbie in need of a little shove. It seems I need to review the purpose of 
the urls.py file. At present I am getting an HTTP Error 405 with the 
following:

urls.py:
path('', views.show_site, name = 'home'),
path('site-view', views.List.as_view(), name='site-view')

views.py
class List(ListView):
    def get_queryset(self, *args, **kwargs):
        return Profile.objects.filter(sitename_id=self.kwargs['pk'])
def show_site(request):
    form = SelectSite()
    if request.method == 'POST':
        form = SelectSite(request.POST)
        if form.is_valid():
            pass
    else:
        form = SelectSite()
    return render(request, 'app/home.html', {'form': form})

home.html
{% extends 'app\base.html' %}

{% block title %}Site Home{% endblock %}
{% block content %}
<h1>This Form is Terrible</h1>
<form action={% url 'site-view' %} method="post">{% csrf_token %}
    <p> {{form}} </p>
<input type="submit" value="Submit"/>
</form>
{% endblock %}

Any guidance would be greatly appreciated.

Thank You

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/10be0e68-da3f-42cd-a095-96d6d2a5617f%40googlegroups.com.

Reply via email to