Add about contact form page
This commit is contained in:
parent
fee3b39eb6
commit
1db8e2910f
3 changed files with 16 additions and 5 deletions
|
@ -1,8 +1,8 @@
|
|||
from django.conf.urls import include, url
|
||||
from .views import page_view, index_view
|
||||
from .views import page_view, index_view, AboutView
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^(?P<path>.*)/', page_view, name='page'),
|
||||
url(r'^$', index_view, name='page'),
|
||||
url(r'^about/?$', AboutView.as_view(), name='about'),
|
||||
url(r'^(?P<path>.*)', page_view, name='page'),
|
||||
]
|
||||
|
|
|
@ -29,3 +29,14 @@ def page_view(request, path):
|
|||
|
||||
def index_view(request):
|
||||
return page_view(request, 'index')
|
||||
|
||||
|
||||
class AboutView(FormView):
|
||||
template_name = 'about/index.html'
|
||||
success_url = '/about/?sent'
|
||||
form_class = ContactForm
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = dict(super().get_context_data(**kwargs), **get_context('/about'))
|
||||
context['sent'] = 'sent' not in self.request.GET
|
||||
return context
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
Some info about my website, which clearly works well as you're using it right now!
|
||||
</p>
|
||||
<p>
|
||||
<a href="{% url 'about:website' %}" class="btn btn-primary btn-block">More Info</a>
|
||||
<a href="/about/website/" class="btn btn-primary btn-block">More Info</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -37,7 +37,7 @@
|
|||
Some info about me. Although not very much. Because Privacy!
|
||||
</p>
|
||||
<p>
|
||||
<a href="{% url 'about:me'%}" class="btn btn-primary btn-block">More Info</a>
|
||||
<a href="/about/me/" class="btn btn-primary btn-block">More Info</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Reference in a new issue