Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
Bullet Journal
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
Franz Leonard Atanacio
Bullet Journal
Commits
9d2ae9ed
Commit
9d2ae9ed
authored
Apr 15, 2021
by
Franz Leonard Atanacio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
final but hopefully with pep8
parent
cf6e3aa2
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
134 additions
and
50 deletions
+134
-50
models.py
mysite/bulletjournal/models.py
+5
-2
views.py
mysite/bulletjournal/views.py
+38
-8
index.html
mysite/mysite/templates/index.html
+0
-1
key.html
mysite/mysite/templates/key.html
+4
-2
profile.html
mysite/mysite/templates/profile.html
+0
-1
thisweek.html
mysite/mysite/templates/thisweek.html
+44
-18
today.html
mysite/mysite/templates/today.html
+43
-18
No files found.
mysite/bulletjournal/models.py
View file @
9d2ae9ed
...
...
@@ -4,8 +4,11 @@ from django.urls import reverse
class
Name
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
100
,
unique
=
True
,
default
=
"test"
)
nickname
=
models
.
CharField
(
max_length
=
50
,
default
=
'Your nickname'
)
bio
=
models
.
CharField
(
max_length
=
200
,
default
=
'A short bio about yourself'
)
image
=
models
.
ImageField
(
upload_to
=
'profilepictures'
,
default
=
'static/img/default.jpg'
)
bio
=
models
.
CharField
(
max_length
=
200
,
default
=
'A short bio about you'
)
image
=
models
.
ImageField
(
upload_to
=
'profilepictures'
,
default
=
'static/img/default.jpg'
)
def
__str__
(
self
):
return
'{} {} {}'
.
format
(
self
.
name
,
self
.
nickname
,
self
.
bio
)
...
...
mysite/bulletjournal/views.py
View file @
9d2ae9ed
...
...
@@ -44,6 +44,7 @@ class HomePageView(View):
return
render
(
request
,
'index.html'
,
{
'form'
:
form
})
def
home
(
request
):
all_names
=
Name
.
objects
.
all
()
if
len
(
name_dict
)
==
1
:
return
render
(
request
,
'index.html'
,
name_dict
)
elif
request
.
method
==
'POST'
:
...
...
@@ -51,7 +52,7 @@ def home(request):
if
form
.
is_valid
():
name_dict
[
'name'
]
=
form
.
cleaned_data
[
'name'
]
try
:
if
Name
.
objects
.
get
(
name
=
name_dict
[
'name'
])
in
Name
.
objects
.
all
()
:
if
Name
.
objects
.
get
(
name
=
name_dict
[
'name'
])
in
all_names
:
return
render
(
request
,
'index.html'
,
name_dict
)
except
:
person_info
=
Name
(
name
=
name_dict
[
'name'
])
...
...
@@ -80,7 +81,13 @@ def profile(request):
picture
=
info
.
image
info
.
save
()
test
.
delete
()
info_dict
=
{
'name'
:
name_dict
[
'name'
],
'nickname'
:
nickname
,
'bio'
:
bio
,
'picture'
:
picture
,
'form1'
:
form1
,
'form2'
:
form2
,
'form3'
:
form3
}
info_dict
=
{
'name'
:
name_dict
[
'name'
],
'nickname'
:
nickname
,
'bio'
:
bio
,
'picture'
:
picture
,
'form1'
:
form1
,
'form2'
:
form2
,
'form3'
:
form3
}
return
render
(
request
,
'profile.html'
,
info_dict
)
elif
len
(
request
.
POST
)
==
2
:
x
=
''
...
...
@@ -90,19 +97,37 @@ def profile(request):
info
.
nickname
=
request
.
POST
[
'nickname'
]
nickname
=
info
.
nickname
info
.
save
()
info_dict
=
{
'name'
:
name_dict
[
'name'
],
'nickname'
:
nickname
,
'bio'
:
bio
,
'picture'
:
picture
,
'form1'
:
form1
,
'form2'
:
form2
,
'form3'
:
form3
}
info_dict
=
{
'name'
:
name_dict
[
'name'
],
'nickname'
:
nickname
,
'bio'
:
bio
,
'picture'
:
picture
,
'form1'
:
form1
,
'form2'
:
form2
,
'form3'
:
form3
}
return
render
(
request
,
'profile.html'
,
info_dict
)
else
:
info
.
bio
=
request
.
POST
[
'bio'
]
bio
=
info
.
bio
info
.
save
()
info_dict
=
{
'name'
:
name_dict
[
'name'
],
'nickname'
:
nickname
,
'bio'
:
bio
,
'picture'
:
picture
,
'form1'
:
form1
,
'form2'
:
form2
,
'form3'
:
form3
}
info_dict
=
{
'name'
:
name_dict
[
'name'
],
'nickname'
:
nickname
,
'bio'
:
bio
,
'picture'
:
picture
,
'form1'
:
form1
,
'form2'
:
form2
,
'form3'
:
form3
}
return
render
(
request
,
'profile.html'
,
info_dict
)
else
:
form1
=
Picture
()
form2
=
Nickname
(
use_required_attribute
=
False
)
form3
=
Bio
(
use_required_attribute
=
False
)
info_dict
=
{
'name'
:
name_dict
[
'name'
],
'nickname'
:
nickname
,
'bio'
:
bio
,
'picture'
:
picture
,
'form1'
:
form1
,
'form2'
:
form2
,
'form3'
:
form3
}
info_dict
=
{
'name'
:
name_dict
[
'name'
],
'nickname'
:
nickname
,
'bio'
:
bio
,
'picture'
:
picture
,
'form1'
:
form1
,
'form2'
:
form2
,
'form3'
:
form3
}
return
render
(
request
,
'profile.html'
,
info_dict
)
...
...
@@ -111,7 +136,8 @@ def key(request):
if
request
.
method
==
'POST'
:
form
=
Keys
(
request
.
POST
)
if
form
.
is_valid
():
new_key
=
Key
(
key
=
form
.
cleaned_data
[
'key'
],
description
=
form
.
cleaned_data
[
'description'
])
new_key
=
Key
(
key
=
form
.
cleaned_data
[
'key'
],
description
=
form
.
cleaned_data
[
'description'
])
new_key
.
save
()
key_dict
=
{
'form'
:
form
}
the_keys
=
[
str
(
x
)
for
x
in
Key
.
objects
.
all
()]
...
...
@@ -129,7 +155,9 @@ def thisweek(request):
if
request
.
method
==
'POST'
:
form
=
Task
(
request
.
POST
)
if
form
.
is_valid
():
new_task
=
Tasks
(
name
=
Name
.
objects
.
get
(
name
=
name_dict
[
'name'
]),
key
=
form
.
cleaned_data
[
'key'
],
task
=
form
.
cleaned_data
[
'task'
])
new_task
=
Tasks
(
name
=
Name
.
objects
.
get
(
name
=
name_dict
[
'name'
]),
key
=
form
.
cleaned_data
[
'key'
],
task
=
form
.
cleaned_data
[
'task'
])
new_task
.
save
()
return
redirect
(
'thisweek'
)
else
:
...
...
@@ -151,7 +179,9 @@ def today(request):
if
request
.
method
==
'POST'
:
form
=
Today
(
request
.
POST
)
if
form
.
is_valid
():
new_task
=
Today
(
name
=
Name
.
objects
.
get
(
name
=
name_dict
[
'name'
]),
key
=
form
.
cleaned_data
[
'key'
],
task
=
form
.
cleaned_data
[
'task'
])
new_task
=
Today
(
name
=
Name
.
objects
.
get
(
name
=
name_dict
[
'name'
]),
key
=
form
.
cleaned_data
[
'key'
],
task
=
form
.
cleaned_data
[
'task'
])
new_task
.
save
()
return
redirect
(
'today'
)
else
:
...
...
mysite/mysite/templates/index.html
View file @
9d2ae9ed
...
...
@@ -3,7 +3,6 @@
{% load static %}
{% block title %} Your Bujo {% endblock %}
{% block styles %}
<link
rel=
"stylesheet"
href=
"{% static 'css/styles.css' %}"
type=
'text/css'
>
{% endblock %}
{% block content %}
...
...
mysite/mysite/templates/key.html
View file @
9d2ae9ed
...
...
@@ -3,7 +3,6 @@
{% load static %}
{% block title %} Keys {% endblock %}
{% block styles %}
<link
rel=
"stylesheet"
href=
"{% static 'css/styles.css' %}"
type=
'text/css'
>
{% endblock %}
{% block content %}
...
...
@@ -20,7 +19,10 @@
<p>
No keys.
</p>
{% endif %}
</ul>
<button
type=
"button"
onclick=
"document.getElementById('form').open='open'"
>
Add Key
</button>
<button
type=
"button"
onclick=
"document.getElementById('form').open='open'"
>
Add Key
</button>
<dialog
id=
"form"
>
<form
action=
"{% url 'key'%}"
method=
"post"
>
{% csrf_token %}
...
...
mysite/mysite/templates/profile.html
View file @
9d2ae9ed
...
...
@@ -3,7 +3,6 @@
{% load static %}
{% block title %} Profile {% endblock %}
{% block styles %}
<link
rel=
"stylesheet"
href=
"{% static 'css/styles.css' %}"
type=
'text/css'
>
{% endblock %}
{% block content %}
...
...
mysite/mysite/templates/thisweek.html
View file @
9d2ae9ed
...
...
@@ -3,7 +3,6 @@
{% load static %}
{% block title %} This Week {% endblock %}
{% block styles %}
<link
rel=
"stylesheet"
href=
"{% static 'css/styles.css' %}"
type=
'text/css'
>
{% endblock %}
{% block content %}
...
...
@@ -11,23 +10,50 @@
<p>
03.29.MON - 04.04.SUN
</p>
<ul>
{% if object_list %}
{% for Tasks in object_list %}
{% if Tasks.key.key == "Task" %}
<li>
<span
id=
"{{forloop.counter}}"
>
{{Tasks.key.key}} : {{Tasks.task}}
</span>
<a
href=
"{{Tasks.get_absolute_url}}"
><button
type=
'button'
>
Edit
</button></a>
<a
href=
"{{Tasks.get_absolute_url}}"
><button
type=
'button'
>
Delete
</button></a>
<button
type=
'button'
onclick=
'document.getElementById("{{forloop.counter}}").innerHTML="Task Done"'
>
Mark as Done
</button>
</li>
{% else %}
<li>
{{Tasks.key.key}} : {{Tasks.task}}
<a
href=
"{{Tasks.get_absolute_url}}"
><button
type=
'button'
>
Edit
</button></a>
<a
href=
"{{Tasks.get_absolute_url}}"
><button
type=
'button'
>
Delete
</button></a>
</li>
{% endif %}
{% endfor %}
{% for Tasks in object_list %}
{% if Tasks.key.key == "Task" %}
<li>
<span
id=
"{{forloop.counter}}"
>
{{Tasks.key.key}} : {{Tasks.task}}
</span>
<a
href=
"{{Tasks.get_absolute_url}}"
>
<button
type=
'button'
>
Edit
</button>
</a>
<a
href=
"{{Tasks.get_absolute_url}}"
>
<button
type=
'button'
>
Delete
</button>
</a>
<button
type=
'button'
onclick=
'document.getElementById(
"{{forloop.counter}}"
).innerHTML="Task Done"'
>
Mark as Done
</button>
</li>
{% else %}
<li>
{{Tasks.key.key}} : {{Tasks.task}}
<a
href=
"{{Tasks.get_absolute_url}}"
>
<button
type=
'button'
>
Edit
</button>
</a>
<a
href=
"{{Tasks.get_absolute_url}}"
>
<button
type=
'button'
>
Delete
</button>
</a>
</li>
{% endif %}
{% endfor %}
{% endif %}
</ul>
<a
href =
"{% url 'addtask' %}"
><button
type=
'button'
>
Add Item
</button></a>
<a
href =
"{% url 'addtask' %}"
>
<button
type=
'button'
>
Add Item
</button>
</a>
{% endblock %}
\ No newline at end of file
mysite/mysite/templates/today.html
View file @
9d2ae9ed
...
...
@@ -3,7 +3,6 @@
{% load static %}
{% block title %} Today {% endblock %}
{% block styles %}
<link
rel=
"stylesheet"
href=
"{% static 'css/styles.css' %}"
type=
'text/css'
>
{% endblock %}
{% block content %}
...
...
@@ -11,23 +10,49 @@
<p>
04.10 SAT
</p>
<ul>
{% if object_list %}
{% for Today in object_list %}
{% if Today.key.key == "Task" %}
<li>
<span
id=
"{{forloop.counter}}"
>
{{Today.key.key}} : {{Today.task}}
</span>
<a
href=
"{{Today.get_absolute_url}}"
><button
type=
'button'
>
Edit
</button></a>
<a
href=
"{{Today.get_absolute_url}}"
><button
type=
'button'
>
Delete
</button></a>
<button
type=
'button'
onclick=
'document.getElementById("{{forloop.counter}}").innerHTML="Task Done"'
>
Mark as Done
</button>
</li>
{% else %}
<li>
{{Today.key.key}} : {{Today.task}}
<a
href=
"{{Today.get_absolute_url}}"
><button
type=
'button'
>
Edit
</button></a>
<a
href=
"{{Today.get_absolute_url}}"
><button
type=
'button'
>
Delete
</button></a>
</li>
{% endif %}
{% endfor %}
{% for Today in object_list %}
{% if Today.key.key == "Task" %}
<li>
<span
id=
"{{forloop.counter}}"
>
{{Today.key.key}} : {{Today.task}}
</span>
<a
href=
"{{Today.get_absolute_url}}"
>
<button
type=
'button'
>
Edit
</button>
</a>
<a
href=
"{{Today.get_absolute_url}}"
>
<button
type=
'button'
>
Delete
</button>
</a>
<button
type=
'button'
onclick=
'document.getElementById(
"{{forloop.counter}}"
).innerHTML="Task Done"'
>
Mark as Done
</button>
</li>
{% else %}
<li>
{{Today.key.key}} : {{Today.task}}
<a
href=
"{{Today.get_absolute_url}}"
>
<button
type=
'button'
>
Edit
</button>
</a>
<a
href=
"{{Today.get_absolute_url}}"
>
<button
type=
'button'
>
Delete
</button>
</a>
</li>
{% endif %}
{% endfor %}
{% endif %}
</ul>
<a
href =
"{% url 'addtoday' %}"
><button
type=
'button'
>
Add Item
</button></a>
<a
href =
"{% url 'addtoday' %}"
>
<button
type=
'button'
>
Add Item
</button>
</a>
{% endblock %}
\ No newline at end of file
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