Commit f995d5a7 authored by James Esguerra's avatar James Esguerra

Added function to render 'profile' template'

parent 228ef982
...@@ -3,5 +3,6 @@ from django.urls import path ...@@ -3,5 +3,6 @@ from django.urls import path
from . import views from . import views
urlpatterns = [ urlpatterns = [
path('home/', views.ShowHome, name='home') path('home/', views.ShowHome, name='home'),
path('profile/', views.ShowProfile, name='profile')
] ]
...@@ -7,8 +7,13 @@ def ShowHome(request): ...@@ -7,8 +7,13 @@ def ShowHome(request):
if request.method == 'POST': if request.method == 'POST':
form = HomeForm(request.POST) form = HomeForm(request.POST)
if form.is_valid(): if form.is_valid():
global name
name = form.cleaned_data['name'] name = form.cleaned_data['name']
return render(request, 'home2.html', {'name': name}) return render(request, 'home2.html', {'name': name})
form = HomeForm() form = HomeForm()
return render(request, 'home.html', {'form': form}) return render(request, 'home.html', {'form': form})
def ShowProfile(request):
return render(request, 'profile.html', {'name': name})
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
<div id='page-header'> <div id='page-header'>
{% block header %} {% endblock %} {% block header %} {% endblock %}
</div> </div>
<br>
<div id='navbar'> <div id='navbar'>
<div> <div>
<a href='/home'> Home </a> <a href='/home'> Home </a>
...@@ -19,13 +20,13 @@ ...@@ -19,13 +20,13 @@
<a href='/profile'> Profile </a> <a href='/profile'> Profile </a>
</div> </div>
<div> <div>
<a href='/Key'> Key </a> <a href='/key'> Key </a>
</div> </div>
<div> <div>
<a href='/This Week'> This Week </a> <a href='/this_week'> This Week </a>
</div> </div>
<div> <div>
<a href='/Today'> Today </a> <a href='/today'> Today </a>
</div> </div>
</div> </div>
</header> </header>
......
{% extends 'base.html' %}
{% block title %} Profile {% endblock %}
{% block header %} Profile {% endblock %}
{% block content %}
<div>
<div>
<p> {{ name }} </p>
<p> My name is {{ name }} and I love playing computer games. </p>
</div>
<div>
<p> picture here </p>
</div>
</div>
{% endblock %}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment