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
19e5e4e9
Commit
19e5e4e9
authored
Apr 06, 2021
by
James Esguerra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added KeyForm to "add_key" view
parent
0caea6b5
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
32 additions
and
3 deletions
+32
-3
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
+1
-0
views.py
pages/views.py
+14
-2
add_key.html
templates/add_key.html
+16
-0
key.html
templates/key.html
+1
-1
No files found.
pages/__pycache__/urls.cpython-38.pyc
View file @
19e5e4e9
No preview for this file type
pages/__pycache__/views.cpython-38.pyc
View file @
19e5e4e9
No preview for this file type
pages/urls.py
View file @
19e5e4e9
...
@@ -6,6 +6,7 @@ urlpatterns = [
...
@@ -6,6 +6,7 @@ urlpatterns = [
path
(
'home/'
,
views
.
ShowHome
,
name
=
'home'
),
path
(
'home/'
,
views
.
ShowHome
,
name
=
'home'
),
path
(
'profile/'
,
views
.
ShowProfile
,
name
=
'profile'
),
path
(
'profile/'
,
views
.
ShowProfile
,
name
=
'profile'
),
path
(
'key/'
,
views
.
ShowKey
,
name
=
'key'
),
path
(
'key/'
,
views
.
ShowKey
,
name
=
'key'
),
path
(
'add_key/'
,
views
.
ShowAddKey
,
name
=
'add_key'
),
path
(
'this_week/'
,
views
.
ShowThisWeek
,
name
=
'this_week'
),
path
(
'this_week/'
,
views
.
ShowThisWeek
,
name
=
'this_week'
),
path
(
'today/'
,
views
.
ShowToday
,
name
=
'today'
),
path
(
'today/'
,
views
.
ShowToday
,
name
=
'today'
),
]
]
pages/views.py
View file @
19e5e4e9
import
datetime
import
datetime
from
django.shortcuts
import
render
from
django.shortcuts
import
render
,
redirect
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
from
.forms
import
HomeForm
from
.forms
import
HomeForm
,
KeyForm
def
ShowHome
(
request
):
def
ShowHome
(
request
):
...
@@ -25,6 +25,18 @@ def ShowKey(request):
...
@@ -25,6 +25,18 @@ def ShowKey(request):
return
render
(
request
,
'key.html'
)
return
render
(
request
,
'key.html'
)
def
ShowAddKey
(
request
):
form
=
KeyForm
()
if
request
.
method
==
'POST'
:
form
=
KeyForm
(
request
.
POST
)
if
form
.
is_valid
():
form
.
save
()
return
redirect
(
'key'
)
return
render
(
request
,
'add_key.html'
,
{
'form'
:
form
})
def
ShowThisWeek
(
request
):
def
ShowThisWeek
(
request
):
return
render
(
request
,
'this_week.html'
)
return
render
(
request
,
'this_week.html'
)
...
...
templates/add_key.html
0 → 100644
View file @
19e5e4e9
{% extends 'base.html' %}
{% load static %}
{% block title %} Key {% endblock %}
{% block header %} Key {% endblock %}
{% block content %}
<form
action=
''
method=
'POST'
>
{% csrf_token %}
{{ form }}
<input
type=
'submit'
name=
'Submit'
value=
'Add'
>
</form>
{% endblock %}
templates/key.html
View file @
19e5e4e9
...
@@ -7,6 +7,6 @@
...
@@ -7,6 +7,6 @@
{% block content %}
{% block content %}
<a
href=
'{% url '
home
'
%}'
><button
type=
'button'
>
Add Key
</button></a>
<a
href=
'{% url '
add_key
'
%}'
><button
type=
'button'
>
Add Key
</button></a>
{% endblock %}
{% 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