Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
esguerra_lab1
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
James Esguerra
esguerra_lab1
Commits
f995d5a7
Commit
f995d5a7
authored
Mar 16, 2021
by
James Esguerra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added function to render 'profile' template'
parent
228ef982
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
4 deletions
+31
-4
urls.cpython-38.pyc
pages/__pycache__/urls.cpython-38.pyc
+0
-0
views.cpython-38.pyc
pages/__pycache__/views.cpython-38.pyc
+0
-0
urls.py
pages/urls.py
+2
-1
views.py
pages/views.py
+5
-0
base.html
templates/base.html
+4
-3
profile.html
templates/profile.html
+20
-0
No files found.
pages/__pycache__/urls.cpython-38.pyc
View file @
f995d5a7
No preview for this file type
pages/__pycache__/views.cpython-38.pyc
View file @
f995d5a7
No preview for this file type
pages/urls.py
View file @
f995d5a7
...
@@ -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'
)
]
]
pages/views.py
View file @
f995d5a7
...
@@ -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
})
templates/base.html
View file @
f995d5a7
...
@@ -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=
'/
K
ey'
>
Key
</a>
<a
href=
'/
k
ey'
>
Key
</a>
</div>
</div>
<div>
<div>
<a
href=
'/
This W
eek'
>
This Week
</a>
<a
href=
'/
this_w
eek'
>
This Week
</a>
</div>
</div>
<div>
<div>
<a
href=
'/
T
oday'
>
Today
</a>
<a
href=
'/
t
oday'
>
Today
</a>
</div>
</div>
</div>
</div>
</header>
</header>
...
...
templates/profile.html
0 → 100644
View file @
f995d5a7
{% 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 %}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment