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
Show 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
...
@@ -4,8 +4,11 @@ from django.urls import reverse
class
Name
(
models
.
Model
):
class
Name
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
100
,
unique
=
True
,
default
=
"test"
)
name
=
models
.
CharField
(
max_length
=
100
,
unique
=
True
,
default
=
"test"
)
nickname
=
models
.
CharField
(
max_length
=
50
,
default
=
'Your nickname'
)
nickname
=
models
.
CharField
(
max_length
=
50
,
default
=
'Your nickname'
)
bio
=
models
.
CharField
(
max_length
=
200
,
default
=
'A short bio about yourself'
)
bio
=
models
.
CharField
(
max_length
=
200
,
default
=
'A short bio about you'
)
image
=
models
.
ImageField
(
upload_to
=
'profilepictures'
,
default
=
'static/img/default.jpg'
)
image
=
models
.
ImageField
(
upload_to
=
'profilepictures'
,
default
=
'static/img/default.jpg'
)
def
__str__
(
self
):
def
__str__
(
self
):
return
'{} {} {}'
.
format
(
self
.
name
,
self
.
nickname
,
self
.
bio
)
return
'{} {} {}'
.
format
(
self
.
name
,
self
.
nickname
,
self
.
bio
)
...
...
mysite/bulletjournal/views.py
View file @
9d2ae9ed
...
@@ -44,6 +44,7 @@ class HomePageView(View):
...
@@ -44,6 +44,7 @@ class HomePageView(View):
return
render
(
request
,
'index.html'
,
{
'form'
:
form
})
return
render
(
request
,
'index.html'
,
{
'form'
:
form
})
def
home
(
request
):
def
home
(
request
):
all_names
=
Name
.
objects
.
all
()
if
len
(
name_dict
)
==
1
:
if
len
(
name_dict
)
==
1
:
return
render
(
request
,
'index.html'
,
name_dict
)
return
render
(
request
,
'index.html'
,
name_dict
)
elif
request
.
method
==
'POST'
:
elif
request
.
method
==
'POST'
:
...
@@ -51,7 +52,7 @@ def home(request):
...
@@ -51,7 +52,7 @@ def home(request):
if
form
.
is_valid
():
if
form
.
is_valid
():
name_dict
[
'name'
]
=
form
.
cleaned_data
[
'name'
]
name_dict
[
'name'
]
=
form
.
cleaned_data
[
'name'
]
try
:
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
)
return
render
(
request
,
'index.html'
,
name_dict
)
except
:
except
:
person_info
=
Name
(
name
=
name_dict
[
'name'
])
person_info
=
Name
(
name
=
name_dict
[
'name'
])
...
@@ -80,7 +81,13 @@ def profile(request):
...
@@ -80,7 +81,13 @@ def profile(request):
picture
=
info
.
image
picture
=
info
.
image
info
.
save
()
info
.
save
()
test
.
delete
()
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
)
return
render
(
request
,
'profile.html'
,
info_dict
)
elif
len
(
request
.
POST
)
==
2
:
elif
len
(
request
.
POST
)
==
2
:
x
=
''
x
=
''
...
@@ -90,19 +97,37 @@ def profile(request):
...
@@ -90,19 +97,37 @@ def profile(request):
info
.
nickname
=
request
.
POST
[
'nickname'
]
info
.
nickname
=
request
.
POST
[
'nickname'
]
nickname
=
info
.
nickname
nickname
=
info
.
nickname
info
.
save
()
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
)
return
render
(
request
,
'profile.html'
,
info_dict
)
else
:
else
:
info
.
bio
=
request
.
POST
[
'bio'
]
info
.
bio
=
request
.
POST
[
'bio'
]
bio
=
info
.
bio
bio
=
info
.
bio
info
.
save
()
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
)
return
render
(
request
,
'profile.html'
,
info_dict
)
else
:
else
:
form1
=
Picture
()
form1
=
Picture
()
form2
=
Nickname
(
use_required_attribute
=
False
)
form2
=
Nickname
(
use_required_attribute
=
False
)
form3
=
Bio
(
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
)
return
render
(
request
,
'profile.html'
,
info_dict
)
...
@@ -111,7 +136,8 @@ def key(request):
...
@@ -111,7 +136,8 @@ def key(request):
if
request
.
method
==
'POST'
:
if
request
.
method
==
'POST'
:
form
=
Keys
(
request
.
POST
)
form
=
Keys
(
request
.
POST
)
if
form
.
is_valid
():
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
()
new_key
.
save
()
key_dict
=
{
'form'
:
form
}
key_dict
=
{
'form'
:
form
}
the_keys
=
[
str
(
x
)
for
x
in
Key
.
objects
.
all
()]
the_keys
=
[
str
(
x
)
for
x
in
Key
.
objects
.
all
()]
...
@@ -129,7 +155,9 @@ def thisweek(request):
...
@@ -129,7 +155,9 @@ def thisweek(request):
if
request
.
method
==
'POST'
:
if
request
.
method
==
'POST'
:
form
=
Task
(
request
.
POST
)
form
=
Task
(
request
.
POST
)
if
form
.
is_valid
():
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
()
new_task
.
save
()
return
redirect
(
'thisweek'
)
return
redirect
(
'thisweek'
)
else
:
else
:
...
@@ -151,7 +179,9 @@ def today(request):
...
@@ -151,7 +179,9 @@ def today(request):
if
request
.
method
==
'POST'
:
if
request
.
method
==
'POST'
:
form
=
Today
(
request
.
POST
)
form
=
Today
(
request
.
POST
)
if
form
.
is_valid
():
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
()
new_task
.
save
()
return
redirect
(
'today'
)
return
redirect
(
'today'
)
else
:
else
:
...
...
mysite/mysite/templates/index.html
View file @
9d2ae9ed
...
@@ -3,7 +3,6 @@
...
@@ -3,7 +3,6 @@
{% load static %}
{% load static %}
{% block title %} Your Bujo {% endblock %}
{% block title %} Your Bujo {% endblock %}
{% block styles %}
{% block styles %}
<link
rel=
"stylesheet"
href=
"{% static 'css/styles.css' %}"
type=
'text/css'
>
{% endblock %}
{% endblock %}
{% block content %}
{% block content %}
...
...
mysite/mysite/templates/key.html
View file @
9d2ae9ed
...
@@ -3,7 +3,6 @@
...
@@ -3,7 +3,6 @@
{% load static %}
{% load static %}
{% block title %} Keys {% endblock %}
{% block title %} Keys {% endblock %}
{% block styles %}
{% block styles %}
<link
rel=
"stylesheet"
href=
"{% static 'css/styles.css' %}"
type=
'text/css'
>
{% endblock %}
{% endblock %}
{% block content %}
{% block content %}
...
@@ -20,7 +19,10 @@
...
@@ -20,7 +19,10 @@
<p>
No keys.
</p>
<p>
No keys.
</p>
{% endif %}
{% endif %}
</ul>
</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"
>
<dialog
id=
"form"
>
<form
action=
"{% url 'key'%}"
method=
"post"
>
<form
action=
"{% url 'key'%}"
method=
"post"
>
{% csrf_token %}
{% csrf_token %}
...
...
mysite/mysite/templates/profile.html
View file @
9d2ae9ed
...
@@ -3,7 +3,6 @@
...
@@ -3,7 +3,6 @@
{% load static %}
{% load static %}
{% block title %} Profile {% endblock %}
{% block title %} Profile {% endblock %}
{% block styles %}
{% block styles %}
<link
rel=
"stylesheet"
href=
"{% static 'css/styles.css' %}"
type=
'text/css'
>
{% endblock %}
{% endblock %}
{% block content %}
{% block content %}
...
...
mysite/mysite/templates/thisweek.html
View file @
9d2ae9ed
...
@@ -3,7 +3,6 @@
...
@@ -3,7 +3,6 @@
{% load static %}
{% load static %}
{% block title %} This Week {% endblock %}
{% block title %} This Week {% endblock %}
{% block styles %}
{% block styles %}
<link
rel=
"stylesheet"
href=
"{% static 'css/styles.css' %}"
type=
'text/css'
>
{% endblock %}
{% endblock %}
{% block content %}
{% block content %}
...
@@ -14,20 +13,47 @@
...
@@ -14,20 +13,47 @@
{% for Tasks in object_list %}
{% for Tasks in object_list %}
{% if Tasks.key.key == "Task" %}
{% if Tasks.key.key == "Task" %}
<li>
<li>
<span
id=
"{{forloop.counter}}"
>
{{Tasks.key.key}} : {{Tasks.task}}
</span>
<span
id=
"{{forloop.counter}}"
>
<a
href=
"{{Tasks.get_absolute_url}}"
><button
type=
'button'
>
Edit
</button></a>
{{Tasks.key.key}} : {{Tasks.task}}
<a
href=
"{{Tasks.get_absolute_url}}"
><button
type=
'button'
>
Delete
</button></a>
</span>
<button
type=
'button'
onclick=
'document.getElementById("{{forloop.counter}}").innerHTML="Task Done"'
>
Mark as Done
</button>
<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>
</li>
{% else %}
{% else %}
<li>
<li>
{{Tasks.key.key}} : {{Tasks.task}}
{{Tasks.key.key}} : {{Tasks.task}}
<a
href=
"{{Tasks.get_absolute_url}}"
><button
type=
'button'
>
Edit
</button></a>
<a
href=
"{{Tasks.get_absolute_url}}"
>
<a
href=
"{{Tasks.get_absolute_url}}"
><button
type=
'button'
>
Delete
</button></a>
<button
type=
'button'
>
Edit
</button>
</a>
<a
href=
"{{Tasks.get_absolute_url}}"
>
<button
type=
'button'
>
Delete
</button>
</a>
</li>
</li>
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
{% endif %}
{% endif %}
</ul>
</ul>
<a
href =
"{% url 'addtask' %}"
><button
type=
'button'
>
Add Item
</button></a>
<a
href =
"{% url 'addtask' %}"
>
<button
type=
'button'
>
Add Item
</button>
</a>
{% endblock %}
{% endblock %}
\ No newline at end of file
mysite/mysite/templates/today.html
View file @
9d2ae9ed
...
@@ -3,7 +3,6 @@
...
@@ -3,7 +3,6 @@
{% load static %}
{% load static %}
{% block title %} Today {% endblock %}
{% block title %} Today {% endblock %}
{% block styles %}
{% block styles %}
<link
rel=
"stylesheet"
href=
"{% static 'css/styles.css' %}"
type=
'text/css'
>
{% endblock %}
{% endblock %}
{% block content %}
{% block content %}
...
@@ -14,20 +13,46 @@
...
@@ -14,20 +13,46 @@
{% for Today in object_list %}
{% for Today in object_list %}
{% if Today.key.key == "Task" %}
{% if Today.key.key == "Task" %}
<li>
<li>
<span
id=
"{{forloop.counter}}"
>
{{Today.key.key}} : {{Today.task}}
</span>
<span
id=
"{{forloop.counter}}"
>
<a
href=
"{{Today.get_absolute_url}}"
><button
type=
'button'
>
Edit
</button></a>
{{Today.key.key}} : {{Today.task}}
<a
href=
"{{Today.get_absolute_url}}"
><button
type=
'button'
>
Delete
</button></a>
</span>
<button
type=
'button'
onclick=
'document.getElementById("{{forloop.counter}}").innerHTML="Task Done"'
>
Mark as Done
</button>
<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>
</li>
{% else %}
{% else %}
<li>
<li>
{{Today.key.key}} : {{Today.task}}
{{Today.key.key}} : {{Today.task}}
<a
href=
"{{Today.get_absolute_url}}"
><button
type=
'button'
>
Edit
</button></a>
<a
href=
"{{Today.get_absolute_url}}"
>
<a
href=
"{{Today.get_absolute_url}}"
><button
type=
'button'
>
Delete
</button></a>
<button
type=
'button'
>
Edit
</button>
</a>
<a
href=
"{{Today.get_absolute_url}}"
>
<button
type=
'button'
>
Delete
</button>
</a>
</li>
</li>
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
{% endif %}
{% endif %}
</ul>
</ul>
<a
href =
"{% url 'addtoday' %}"
><button
type=
'button'
>
Add Item
</button></a>
<a
href =
"{% url 'addtoday' %}"
>
<button
type=
'button'
>
Add Item
</button>
</a>
{% endblock %}
{% 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