Update main screen
Now that the blog module is finished, this card can be opened. Also some slight changes to translations and views.
- Author
- Maarten 'Vngngdn' Vangeneugden
- Date
- Oct. 19, 2017, 4:15 p.m.
- Hash
- 1c3c61afc92feea39bd6c8f6fd3c86ee4969a801
- Parent
- 063736bddbffaec05557637b86e97c4bed62dbd7
- Modified files
- locale/nl/LC_MESSAGES/django.po
- templates/about/index.html
- templates/about/main_content.html
- views.py
locale/nl/LC_MESSAGES/django.po ¶
0 additions and 7 deletions.
View changes Hide changes
1 |
1 |
# Copyright © 2017 Maarten "Vingy" Vangeneugden |
2 |
2 |
# This file is distributed under the same license as the vingy-main package. |
3 |
3 |
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. |
4 |
4 |
# |
5 |
5 |
#, fuzzy |
6 |
6 |
msgid "" |
7 |
7 |
msgstr "" |
8 |
8 |
"Project-Id-Version: PACKAGE VERSION\n" |
9 |
9 |
"Report-Msgid-Bugs-To: \n" |
10 |
10 |
"POT-Creation-Date: 2017-10-18 20:08+0200\n" |
11 |
11 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
12 |
12 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
13 |
13 |
"Language-Team: LANGUAGE <LL@li.org>\n" |
14 |
14 |
"Language: \n" |
15 |
15 |
"MIME-Version: 1.0\n" |
16 |
16 |
"Content-Type: text/plain; charset=UTF-8\n" |
17 |
17 |
"Content-Transfer-Encoding: 8bit\n" |
18 |
18 |
"Plural-Forms: nplurals=2; plural=(n != 1);\n" |
19 |
19 |
|
20 |
20 |
#: about/views.py:109 |
21 |
21 |
msgid "❤ Spending time with someone very special... ❤" |
22 |
22 |
msgstr "❤ Tijd aan het doorbrengen met een zeer speciaal iemand... ❤" |
23 |
23 |
|
24 |
24 |
#: about/views.py:111 |
25 |
25 |
msgid "I'm in love. Best thing that ever happened to me... ❤" |
26 |
26 |
msgstr "Ik ben verliefd. Werkelijk het beste dat mij ooit is overkomen... ❤" |
27 |
27 |
|
28 |
28 |
#: about/views.py:116 |
29 |
29 |
msgid "Studying Mathematics @ C104. See you around noon!" |
30 |
30 |
msgstr "Wiskunde studeren @ C104. Ben er weer deze middag!" |
31 |
31 |
|
32 |
32 |
#: about/views.py:118 |
33 |
33 |
msgid "Following college: Informatics Management @ A101." |
34 |
34 |
msgstr "Hoorcollege aan het volgen van Beleidsinformatica @ A101." |
35 |
35 |
|
36 |
36 |
#: about/views.py:121 |
37 |
37 |
msgid "Studying Computer Graphics @ C105. Back in C24 at noon!" |
38 |
38 |
msgstr "" |
39 |
39 |
"Computer Graphics aan het volgen in C105. Deze middag vind je me weer in de " |
40 |
40 |
"C24!" |
41 |
41 |
|
42 |
42 |
#: about/views.py:125 |
43 |
43 |
msgid "Trying to understand Artificial Intelligence @ H1..." |
44 |
44 |
msgstr "Proberen Artificiële Intelligentie te snappen in H1..." |
45 |
45 |
|
46 |
46 |
#: about/views.py:128 |
47 |
47 |
msgid "Engineering the Software @ A7. Tough nut to crack..." |
48 |
48 |
msgstr "Software Engineering in A7. 't Moet niet veel moeilijker worden..." |
49 |
49 |
|
50 |
50 |
#: about/views.py:130 |
51 |
51 |
msgid "" |
52 |
52 |
"Fighting boredom of Informatics Management. Looking forward to " |
53 |
53 |
"the weekend!" |
54 |
54 |
msgstr "" |
55 |
55 |
"Mezelf aan het vervelen bij Beleidsinformatica. Ik kijk al uit naar " |
56 |
56 |
"hetweekend!" |
57 |
57 |
|
58 |
58 |
#: about/views.py:137 |
59 |
59 |
msgid "I'm asleep. See you tomorrow! =D" |
60 |
60 |
msgstr "Aan het slapen. Tot morgen! =D" |
61 |
61 |
|
62 |
62 |
#: about/views.py:140 |
63 |
63 |
msgid "Having lunch in C24. I'm available if you need me!" |
64 |
64 |
msgstr "Aan het lunchen in C24. Als je me nodig hebt, ik ben beschikbaar!" |
65 |
65 |
|
66 |
66 |
#: about/views.py:142 |
67 |
67 |
msgid "At UHasselt! Studying in C24. Come by for a chat, or email me!" |
68 |
68 |
msgstr "" |
69 |
69 |
"Op UHasselt, en aan het studeren in C24. Kom langs voor een babbel, ofstuur " |
70 |
70 |
"me een mail!" |
71 |
71 |
|
72 |
72 |
#: about/views.py:145 |
73 |
73 |
msgid "Studying from home, or other work. Perhaps I'll see you in the evening?" |
74 |
74 |
msgstr "" |
75 |
75 |
"Thuis aan 't studeren, of ander werk aan het verrichten. Misschien dat ik je " |
76 |
76 |
"vanavond opnieuw zie?" |
77 |
77 |
|
78 |
78 |
#: about/views.py:148 |
79 |
79 |
msgid "Relaxing, and enjoying my free time. Feel free to talk! 😃" |
80 |
80 |
msgstr "" |
81 |
81 |
"Aan het relaxen en genieten van mijn vrije tijd. Voel je vrij om te " |
82 |
82 |
"babbelen! 😃" |
83 |
83 |
|
84 |
84 |
#: about/views.py:151 |
85 |
85 |
msgid "Probably chilling a bit. Feel free to talk! ❤" |
86 |
86 |
msgstr "" |
87 |
87 |
"Waarschijnlijk een beetje aan het ontspannen. Wees vrij om met mij te " |
88 |
88 |
"praten! ❤" |
89 |
89 |
|
90 |
90 |
#: about/views.py:158 |
91 |
91 |
msgid "Current status/location:" |
92 |
92 |
msgstr "Huidige status/locatie:" |
93 |
93 |
|
94 |
- | #~ msgid "" |
95 |
- | #~ "Good morning my love. How do you like it? I'll be with you soon enough " |
96 |
- | #~ "again... ❤❤" |
97 |
- | #~ msgstr "" |
98 |
- | #~ "Goeiemorgen lieve mop. 'k Hoop dat je goed geslapen hebt. Hoe vind je " |
99 |
- | #~ "het? Over enkele uurtjes ben ik weer bij jou... ❤❤" |
100 |
- |
templates/about/index.html ¶
2 additions and 4 deletions.
View changes Hide changes
1 |
1 |
{% load i18n %} |
2 |
2 |
|
3 |
3 |
{% block title %}{% trans "Maarten | Main page" %}{% endblock title %} |
4 |
4 |
{% block header %} |
5 |
5 |
{#{% include "website/navbar.html" %}#} |
6 |
6 |
{#{{ block.super }}#} |
7 |
7 |
{% comment %}{% if quote.link %} |
8 |
8 |
<p class="container white-text"> |
9 |
9 |
<a class="white-text" href="{{ quote.link }}" target="_blank"> |
10 |
10 |
{% endif %} |
11 |
11 |
{{ quote.author }} |
12 |
12 |
{% if quote.link %} |
13 |
13 |
</a> |
14 |
14 |
{% endif %} |
15 |
15 |
</p> |
16 |
16 |
{% endcomment %} |
17 |
17 |
</div> |
18 |
18 |
{% endblock header %} |
19 |
19 |
{% block description %}{% blocktrans %}Maarten's personal place on the internet. Make yourself at home!{% endblocktrans %} |
20 |
20 |
{% endblock description %} |
21 |
21 |
{% block main %} |
22 |
22 |
{% with mdac=materialDesign_accentColor %} {# You'll see why this is handy shortly. #} |
23 |
- | {% with mdc=materialDesign_color %} {# You'll see why this is handy shortly. #} |
24 |
- | <div class="parallax--"> |
+ |
23 |
<div class="parallax--"> |
25 |
24 |
<div class="parallax_group"> |
26 |
25 |
<div class="parallax_layer parallax_layer-base"> |
27 |
26 |
<header> |
28 |
27 |
{% include "website/navbar.html" %} |
29 |
28 |
</header> |
30 |
29 |
<div class="section {{ materialDesign_color }} lighten-2"> |
31 |
30 |
<p class="flow-text container white-text">{{ status }}</p> |
32 |
31 |
</div> |
33 |
32 |
{# TODO: Make the "quote section" less obtrusive, i.e. make it smaller #} |
34 |
33 |
<div class="section {{ materialDesign_color }} z-depth-3"> |
35 |
34 |
<div class="container"> |
36 |
35 |
<div class="white-text"> |
37 |
36 |
<h3>{% trans "Welcome!" %}</h3> |
38 |
37 |
<p> |
39 |
38 |
{% blocktrans %}Hello there! I'm Maarten, a happy |
40 |
39 |
hacker from Belgium, and this is my amazing personal website. |
41 |
- | I like a lot of things, and I share some of those in here. Take |
+ |
40 |
I like a lot of things, and I share some of those in here. Take |
42 |
41 |
a look around, read a bit, talk with me, and most importantly, |
43 |
42 |
enjoy your stay!{% endblocktrans %} |
44 |
43 |
</p> |
45 |
44 |
</div> |
46 |
45 |
</div> |
47 |
46 |
</div> |
48 |
47 |
</div> |
49 |
48 |
<div class="parallax_layer parallax_layer-back"> |
50 |
49 |
{{ parallax_src|safe }} |
51 |
50 |
</div> |
52 |
51 |
<!--</div> |
53 |
52 |
<div class="parallax_group">--> |
54 |
53 |
<div class="parallax_layer parallax_layer-base"></div> |
55 |
54 |
</div> |
56 |
55 |
<div class="parallax_group"> |
57 |
56 |
<div class="parallax_layer parallax_layer-base"> |
58 |
57 |
<div class="section white"> |
59 |
58 |
{% include "about/main_content.html" %} |
60 |
59 |
</div> |
61 |
60 |
{% include "website/footer.html" %} |
62 |
61 |
</div> |
63 |
62 |
</div> |
64 |
63 |
</div> |
65 |
64 |
{% endwith %} |
66 |
65 |
{% endwith %} |
67 |
- | {% endblock main %} |
68 |
66 |
|
69 |
67 |
{% block footer %} |
70 |
68 |
{% endblock footer %} |
71 |
69 |
templates/about/main_content.html ¶
5 additions and 5 deletions.
View changes Hide changes
1 |
1 |
{% load static %} |
2 |
2 |
<div class="container section"> |
3 |
3 |
<div class="row"> |
4 |
4 |
{# Blog card #} |
5 |
5 |
<div class="col s12 offset-m1 m10 l6"> |
6 |
6 |
<div class="card hoverable large brown light-2"> |
7 |
7 |
<div class="card-image"> |
8 |
8 |
{#<img src="{% get_media_prefix %}/main/blog.jpg" />#} |
9 |
9 |
<img src="/media/main/blog.jpg" /> |
10 |
10 |
<span class="card-title">{% trans "Blog (Under construction)" %}</span> |
11 |
- | </div> |
+ |
11 |
</div> |
12 |
12 |
<div class="white-text card-content"> |
13 |
13 |
{% blocktrans %}I'm currently working on a nice blog system for |
14 |
- | myself, something pretty with Markdown and stuff. (ETA end of |
15 |
- | February 2017){% endblocktrans %} |
16 |
- | </div> |
+ |
14 |
on which I ramble about everything I like. Highly recommended |
+ |
15 |
while eating breakfast.{% endblocktrans %} |
+ |
16 |
</div> |
17 |
17 |
<div class="card-action"> |
18 |
18 |
<a class="btn-flat disabled grey-text">{% trans "Visit blog" %}</a> |
19 |
- | </div> |
+ |
19 |
</div> |
20 |
20 |
</div> |
21 |
21 |
</div> |
22 |
22 |
|
23 |
23 |
{# Gitar card #} |
24 |
24 |
<div class="col s12 offset-m1 m10 l6"> |
25 |
25 |
<div class="card hoverable large blue-grey"> |
26 |
26 |
<div class="card-image"> |
27 |
27 |
<img src="/media/main/gitar.png" /> |
28 |
28 |
<!-- HAHAHAA I CAN'T DESIGN LOGOS --> |
29 |
29 |
<span class="card-title">Gitar</span> |
30 |
30 |
</div> |
31 |
31 |
<div class="white-text card-content"> |
32 |
32 |
{% blocktrans %}I actually don't use GitHub to host my code, |
33 |
33 |
contrary to a lot of other coders. Instead, I've been trying to |
34 |
34 |
create something that's just fit to my taste. I host a couple of |
35 |
35 |
archive repositories there, as well as dotfiles, and that jazz. It's |
36 |
36 |
a continuing work, so don't flip your desk if the layout is upside |
37 |
37 |
down tomorrow =3{% endblocktrans %} |
38 |
38 |
</div> |
39 |
39 |
<div class="card-action"> |
40 |
40 |
<a class="btn-flat waves-green green-text text-accent-3 waves-effect" href="{% url "gitar-index" %}">{% trans "Check code" %}</a> |
41 |
41 |
</div> |
42 |
42 |
</div> |
43 |
43 |
</div> |
44 |
44 |
|
45 |
45 |
{# About myself card #} |
46 |
46 |
<div class="col s12 offset-m1 m10 l6"> |
47 |
47 |
<div class="card hoverable large"> |
48 |
48 |
<div class="card-image"> |
49 |
49 |
<img src="/media/about/images/parallax.png" /> |
50 |
50 |
<!-- I still don't have a good picture or still life about |
51 |
51 |
myself, so yes, I'm copying my parallax for a while. Sorry! |
52 |
52 |
--> |
53 |
53 |
<span class="card-title">{% trans "About me" %}</span> |
54 |
54 |
</div> |
55 |
55 |
<div class="card-content"> |
56 |
56 |
{% blocktrans %}Well, if you wish to know more of me, I have a page |
57 |
57 |
where I describe myself in a couple more sentences. You know, because I can =) |
58 |
58 |
{% endblocktrans %} |
59 |
59 |
</div> |
60 |
60 |
<div class="card-action"> |
61 |
61 |
<a class="btn-flat waves-{{ mdac }} {{ mdac }}-text text-accent-4 |
62 |
62 |
waves-effect" href="{% url "main-myself" %}">{% trans "Read on" %}</a> |
63 |
63 |
</div> |
64 |
64 |
</div> |
65 |
65 |
</div> |
66 |
66 |
|
67 |
67 |
{# Quotebook card #} |
68 |
68 |
<div class="col s12 offset-m1 m10 l6"> |
69 |
69 |
<div class="card deep-purple hoverable large"> |
70 |
70 |
<div class="card-image"> |
71 |
71 |
<img src="/media/main/Quotebook.jpg" /><!--Image © CC-BY 2014 |
72 |
72 |
Karel Hemerijckx |
73 |
73 |
(https://nl.wikipedia.org/wiki/Universiteit_Hasselt#/media/File:Campus_Diepenbeek.jpg)--> |
74 |
74 |
<span class="bold black-text card-title">{# trans "Quotebook" #}</span> |
75 |
75 |
</div> |
76 |
76 |
<div class="white-text card-content"> |
77 |
77 |
{% blocktrans %}A special treat for my buddies at Hasselt |
78 |
78 |
University: The one and the only Quotebook of Informatics! |
79 |
79 |
(Authorization required, Dutch only) |
80 |
80 |
{% endblocktrans %} |
81 |
81 |
</div> |
82 |
82 |
<div class="card-action"> |
83 |
83 |
<a class="btn-flat waves-yellow amber-text waves-effect" href="{% url "ITdays-index" %}">{% trans "Open quotebook" %}</a> |
84 |
84 |
</div> |
85 |
85 |
</div> |
86 |
86 |
</div> |
87 |
87 |
</div> |
88 |
88 |
|
89 |
89 |
<div class="row"> |
90 |
90 |
{# Furry card owo #} |
91 |
91 |
<div class="col m12"> |
92 |
92 |
<div class="card hoverable deep-orange"> |
93 |
93 |
<div class="card-content"> |
94 |
94 |
<span class="card-title white-text">???</span> |
95 |
95 |
<!-- OwO what's this? Seems like somebody found it out! ❤ --> |
96 |
96 |
<p class="white-text"> |
97 |
97 |
{% blocktrans %}What could this possibly lead to? Some may know, |
98 |
98 |
some may not. Don't beat yourself over it, it's some small |
99 |
99 |
side project of myself, and could probably take months |
100 |
100 |
before it gets released.{% endblocktrans %} |
101 |
101 |
</p> |
102 |
102 |
</div> |
103 |
103 |
<div class="card-action"> |
104 |
104 |
<a class="btn-flat disabled grey-text">{% trans "View project" %}</a> |
105 |
105 |
</div> |
106 |
106 |
</div> |
107 |
107 |
</div> |
108 |
108 |
</div> |
109 |
109 |
</div> |
110 |
110 |
{% comment %} |
111 |
111 |
<div class="row"> |
112 |
112 |
{% for card, mediumSize, largeSize in cards %} |
113 |
113 |
<div class="col s12 m6 l4"> |
114 |
114 |
<div class="card hoverable white"> |
115 |
115 |
{% if card.image %} |
116 |
116 |
<div class="card-image"> |
117 |
117 |
<img src="/media/{{ card.image }}" /> |
118 |
118 |
<span class="card-title orange-text">Material Design</span> |
119 |
119 |
</div> |
120 |
120 |
{% endif %} |
121 |
121 |
<div class="card-content"> |
122 |
122 |
{% if not card.image %} |
123 |
123 |
<span class="card-title">{{ card.title }}</span> |
124 |
124 |
{% endif %} |
125 |
125 |
<p> |
126 |
126 |
{{ card.description }} |
127 |
127 |
</p> |
128 |
128 |
</div> |
129 |
129 |
{% if card.link1 %} |
130 |
130 |
<div class="card-action"> |
131 |
131 |
{% if card.link1 %} |
132 |
132 |
<a class="waves-effect waves-{{ mdac }} btn-flat |
133 |
133 |
{{ mdac }}-text text-accent-4" href="{% url card.link1 %}">{{ card.linkName1 }}</a> |
134 |
134 |
{% endif %} |
135 |
135 |
{% if card.link2 %} |
136 |
136 |
<a class="waves-effect waves-{{ mdac }} btn-flat |
137 |
137 |
{{ mdac }}-text text-accent-4" href="{% url card.link2 %}">{{ card.linkName2 }}</a> |
138 |
138 |
{% endif %} |
139 |
139 |
</div> |
140 |
140 |
{% endif %} |
141 |
141 |
</div> |
142 |
142 |
</div> |
143 |
143 |
{% endfor %} |
144 |
144 |
|
145 |
145 |
|
146 |
146 |
</div> |
147 |
147 |
</div> |
148 |
148 |
{% endcomment %} |
149 |
149 |
views.py ¶
2 additions and 96 deletions.
View changes Hide changes
1 |
1 |
from datetime import date |
2 |
2 |
from django.utils import timezone |
3 |
3 |
from django.shortcuts import get_object_or_404, render # This allows to render the template with the view here. It's pretty cool and important. |
4 |
4 |
from django.http import HttpResponseRedirect, HttpResponse # Why? |
5 |
5 |
from django.core.urlresolvers import reverse # Why? |
6 |
6 |
from django.utils.translation import ugettext as _ |
7 |
7 |
from .models import * |
8 |
8 |
|
9 |
9 |
# First, I list some standard variables that are common for most of the sites of this app. |
10 |
10 |
|
11 |
11 |
def get_age(): |
12 |
12 |
"""Returns my current age.""" |
13 |
13 |
today = date.today() |
14 |
14 |
birthday = date(1996, 8, 28) |
15 |
15 |
age = today - birthday |
16 |
16 |
years = str(int(age.days / 365)) |
17 |
17 |
return years |
18 |
18 |
|
19 |
19 |
def footer_description(): |
20 |
20 |
years = get_age() |
21 |
21 |
|
22 |
22 |
""" |
23 |
23 |
Grandpa easter egg: The Dutch version of the most ingenius algorithm I ever wrote: |
24 |
24 |
vandaag = datum.vandaag() |
25 |
25 |
geboortedatum = datum(28-08-1996) |
26 |
26 |
leeftijd = vandaag - geboortedatum |
27 |
27 |
jaren = leeftijd.jaren() |
28 |
28 |
This will help me explain what programming has brought me. =3 |
29 |
29 |
""" |
30 |
30 |
|
31 |
31 |
return "Main pages of Maarten's website, a " + years + " year old Belgian programmer. Also an undergraduate informatics student @ UHasselt." |
32 |
32 |
|
33 |
33 |
def footer_links(): |
34 |
34 |
footer_links = [ |
35 |
35 |
["Contact", "mailto:maarten.vangeneugden@student.uhasselt.be"], |
36 |
36 |
["UHasselt", "https://www.uhasselt.be"], |
37 |
37 |
] |
38 |
38 |
return footer_links |
39 |
39 |
|
40 |
40 |
# TODO: Move this stuff to the template module. This is basically a description |
41 |
41 |
# of HOW to display data, but the view module is only responsible for WHAT data |
42 |
42 |
# to display. |
43 |
43 |
def standard_context(): |
44 |
44 |
context = { |
45 |
45 |
'materialDesign_color': "blue", |
46 |
46 |
'materialDesign_accentColor': "orange", |
47 |
47 |
'navbar_backArrow': True, |
48 |
48 |
'footer_title': "Home pages", |
49 |
49 |
'footer_description': footer_description(), |
50 |
50 |
'footer_links': footer_links(), |
51 |
51 |
} |
52 |
52 |
return context |
53 |
53 |
|
54 |
54 |
def get_current_status(dt = None): |
55 |
55 |
"""Returns a string specifying my current state (and sometimes location). |
56 |
56 |
|
57 |
57 |
This function is actually based on my weekly schedule. I'd normally hook it |
58 |
58 |
up to my iCal files, but that doesn't include things like sleeping. Not to |
59 |
59 |
mention my university has a hard time following standards like "Put the |
60 |
60 |
location in the location field, not in the title of the appointment". I |
61 |
61 |
figured a simple function would do the job just as well. |
62 |
62 |
|
63 |
63 |
Keyword arguments: |
64 |
64 |
dt -- The datetime object of the day to check (defaults to current local time) |
65 |
65 |
""" |
66 |
66 |
|
67 |
67 |
""" Readable standard schedule of my week (00:00 - 08:00 is always sleep): |
68 |
68 |
Monday: |
69 |
69 |
09:00 - 11:30: Mathematics @ C104 |
70 |
70 |
13:00 - 15:00: Informatics Management @ A101 |
71 |
71 |
Tuesday: |
72 |
72 |
10:00 - 11:30: Computer Graphics @ C105 |
73 |
73 |
13:30 - 15:30: AI @ H1 |
74 |
74 |
Wednesday: Free! |
75 |
75 |
Thursday: |
76 |
76 |
10:00 - 12:00: Software Engineering @ A7 (Temporary; prone to change!) |
77 |
77 |
13:00 - 15:00: Beleidsinformatica @ <variable> |
78 |
78 |
Friday - Sunday: Free! |
79 |
79 |
On free days, the planning is usually this: |
80 |
80 |
14:00 - 19:00: Studying / general work |
81 |
81 |
20:00 - 23:59: Leisure =D |
82 |
82 |
|
83 |
83 |
Temporary addition: My lovely nightfox <3 |
84 |
84 |
Friday: |
85 |
85 |
17:30 - 23:59: Time with Jonathan |
86 |
86 |
""" |
87 |
87 |
|
88 |
88 |
# I fixed my server, so for now, it's this: |
89 |
89 |
|
90 |
90 |
if dt == None: |
91 |
91 |
timezone.activate("Europe/Brussels") |
92 |
92 |
dt = timezone.localtime(timezone.now()) |
93 |
93 |
|
94 |
94 |
day = dt.weekday() |
95 |
95 |
hour = dt.time().hour |
96 |
96 |
print(hour) |
97 |
97 |
minute = dt.time().minute |
98 |
98 |
|
99 |
99 |
""" Note on usage of the range() function: |
100 |
100 |
range(x, y) returns a list, beginning from x, but excluding y. So if a |
101 |
101 |
course runs from 13:00 to 15:00, then y should still be 15. Why? Because |
102 |
102 |
that makes it so that 14:59 is included, but 15:00 is not. if y would be 16, |
103 |
103 |
then 15:30 would also be included. |
104 |
104 |
""" |
105 |
105 |
|
106 |
106 |
if day == 4: # Friday... <3 |
107 |
107 |
if hour >= 17: |
108 |
108 |
return _("❤ Spending time with someone very special... ❤") |
109 |
109 |
if day == 5: |
110 |
110 |
return _("I'm in love. Best thing that ever happened to me... ❤") |
111 |
111 |
|
112 |
112 |
|
113 |
113 |
if day == 0: # Monday |
114 |
114 |
if hour in [9, 10] or (hour == 11 and minute <= 30): |
115 |
115 |
return _("Studying Mathematics @ C104. See you around noon!") |
116 |
116 |
if hour in range(13, 15): |
117 |
117 |
return _("Following college: Informatics Management @ A101.") |
118 |
118 |
if day == 1: # Tuesday |
119 |
119 |
if hour == 10 or (hour == 11 and minute <= 30): |
120 |
120 |
return _("Studying Computer Graphics @ C105. Back in C24 at noon!") |
121 |
121 |
if (hour == 13 and minute >= 30) or \ |
122 |
122 |
(hour == 14) or \ |
123 |
123 |
(hour == 15 and minute < 30): |
124 |
124 |
return _("Trying to understand Artificial Intelligence @ H1...") |
125 |
125 |
if day == 3: # Thursday |
126 |
126 |
if hour in range(10, 12): |
127 |
127 |
return _("Engineering the Software @ A7. Tough nut to crack...") |
128 |
128 |
if hour in range(13, 15): |
129 |
129 |
return _("Fighting boredom of Informatics Management. Looking \ |
130 |
130 |
forward to the weekend!") |
131 |
131 |
|
132 |
132 |
# General answers that span over multiple days |
133 |
133 |
# They may overlap with previous tests, but that means they fill in gaps |
134 |
134 |
# like study time |
135 |
135 |
if hour <= 8: |
136 |
136 |
return _("I'm asleep. See you tomorrow! =D") |
137 |
137 |
if day in [0, 1, 3]: |
138 |
138 |
if hour == 12: |
139 |
139 |
return _("Having lunch in C24. I'm available if you need me!") |
140 |
140 |
elif hour in range(9, 18): |
141 |
141 |
return _("At UHasselt! Studying in C24. Come by for a chat, or email me!") |
142 |
142 |
if day in [2, 4, 5, 6]: |
143 |
143 |
if hour in range(13, 19): |
144 |
144 |
return _("Studying from home, or other work. Perhaps I'll see you in the evening?") |
145 |
145 |
elif hour in range(19, 24): |
146 |
146 |
#return _("Relaxing, and enjoying my free time. Feel free to talk! 😃") |
147 |
147 |
return _("Relaxing, and enjoying my free time. Feel free to talk! 😃") |
148 |
148 |
|
149 |
149 |
# If nothing's returned by now, return a general response |
150 |
150 |
return _("Probably chilling a bit. Feel free to talk! ❤") |
151 |
151 |
|
152 |
152 |
# Views: |
153 |
153 |
|
154 |
154 |
def index(request): |
155 |
155 |
timezone.activate("Europe/Brussels") |
156 |
156 |
time_string = timezone.localtime(timezone.now()).strftime(" (%H:%M) ") |
157 |
157 |
status = _("Current status/location:") + time_string + get_current_status() |
158 |
158 |
template = "about/index.html" |
159 |
159 |
|
160 |
160 |
cards = Card.objects.order_by('?') # The '?' indicates the objects must be ordered randomly. |
161 |
161 |
quotes = Quote.objects.all() |
162 |
162 |
randomQuote = random.choice(quotes) |
163 |
163 |
|
164 |
164 |
largeSizes = [] |
165 |
165 |
mediumSizes = [] |
166 |
166 |
for i in range(0, len(cards)): |
167 |
167 |
newLargeSizes = [6, 4, 2] |
168 |
168 |
newMediumSizes = [8, 4] |
169 |
169 |
random.shuffle(newLargeSizes) |
170 |
170 |
random.shuffle(newMediumSizes) |
171 |
171 |
largeSizes.extend(newLargeSizes) |
172 |
172 |
mediumSizes.extend(newMediumSizes) |
173 |
173 |
|
174 |
174 |
contextList = [] |
175 |
175 |
i = 0 |
176 |
176 |
for card in cards: |
177 |
177 |
contextList.append([card, mediumSizes[i], largeSizes[i]]) |
178 |
178 |
i += 1 |
179 |
179 |
|
180 |
180 |
# TODO: Move this stuff to the template module. This is basically a description |
181 |
181 |
# of HOW to display data, but the view module is only responsible for WHAT data |
182 |
182 |
# to display. |
183 |
183 |
context = { |
184 |
184 |
'status': status, |
185 |
185 |
'materialDesign_color': "blue", |
186 |
186 |
'materialDesign_accentColor': "orange", |
187 |
187 |
'navbar_title': "Maarten's website", |
188 |
- | 'navbar_fixed': False, |
+ |
188 |
'navbar_fixed': False, |
189 |
189 |
'parallax_src': "<img style=\"wdith:100vw;\" src=\"/media/about/images/parallax.png\">", |
190 |
190 |
'footer_title': "Home pages", |
191 |
191 |
'footer_description': footer_description, |
192 |
192 |
'footer_links': footer_links, |
193 |
193 |
'cards': contextList, |
194 |
194 |
'quote': randomQuote, |
195 |
195 |
} |
196 |
196 |
|
197 |
197 |
return render(request, template, context) |
198 |
198 |
|
199 |
199 |
def myself(request): |
200 |
200 |
template = "about/about.html" |
201 |
201 |
|
202 |
- | context = { |
+ |
202 |
context = { |
203 |
203 |
'subject': "Myself", |
204 |
204 |
'navbar_title': "Myself", |
205 |
205 |
'age': get_age(), |
206 |
206 |
} |
207 |
207 |
context.update(standard_context()) |
208 |
208 |
return render(request, template, context) |
209 |
209 |
|
210 |
- | def principles(request): |
211 |
- | template = "about/principles.html" |
212 |
- | |
213 |
- | data = Principle.objects.order_by('title') |
214 |
- | |
215 |
- | context = { |
216 |
- | 'subject': "principles", |
217 |
- | 'navbar_title': "Principles", |
218 |
- | 'data': data, |
219 |
- | } |
220 |
- | context.update(standard_context()) |
221 |
- | return render(request, template, context) |
222 |
- | |
223 |
- | def hacking(request): |
224 |
- | template = "about/hacking.html" |
225 |
- | |
226 |
- | data = Hack.objects.order_by('title') |
227 |
- | |
228 |
- | context = { |
229 |
- | 'subject': "hacking", |
230 |
- | 'navbar_title': "Hacking", |
231 |
- | 'data': data, |
232 |
- | } |
233 |
- | context.update(standard_context()) |
234 |
- | return render(request, template, context) |
235 |
- | |
236 |
- | def me(request): |
237 |
- | template = "about/me.html" |
238 |
- | |
239 |
- | data = AboutMe.objects.order_by('title') |
240 |
- | |
241 |
- | context = { |
242 |
- | 'subject': "me", |
243 |
- | 'navbar_title': "Me", |
244 |
- | 'data': data, |
245 |
- | } |
246 |
- | context.update(standard_context()) |
247 |
- | return render(request, template, context) |
248 |
- | |
249 |
- | def webstack(request): |
250 |
- | template = "about/webstack.html" |
251 |
- | |
252 |
- | data = Stack.objects.order_by('title') |
253 |
- | |
254 |
- | context = { |
255 |
- | 'subject': "web stack", |
256 |
- | 'navbar_title': "Web stack", |
257 |
- | 'data': data, |
258 |
- | } |
259 |
- | context.update(standard_context()) |
260 |
- | return render(request, template, context) |
261 |
- | |
262 |
- | def software(request): |
263 |
- | template = "about/software.html" |
264 |
- | |
265 |
- | data = Program.objects.order_by('title') |
266 |
- | |
267 |
- | context = { |
268 |
- | 'subject': "software", |
269 |
- | 'navbar_title': "Software", |
270 |
- | 'data': data, |
271 |
- | } |
272 |
- | context.update(standard_context()) |
273 |
- | return render(request, template, context) |
274 |
- | # WARNING: |
275 |
- | # Because I haven't been able to figure out yet how to add colors to hyperlinks, I put them hardcoded in the database. IF YOU FIND A WAY TO DO IT RIGHT, DO SO ASAP! |
276 |
- | |
277 |
- | def security(request): |
278 |
- | template = "about/security.html" |
279 |
- | |
280 |
- | data = SecurityMeasure.objects.order_by('title') |
281 |
- | |
282 |
- | context = { |
283 |
- | 'subject': "security", |
284 |
- | 'navbar_title': "Security", |
285 |
- | 'data': data, |
286 |
- | } |
287 |
- | context.update(standard_context()) |
288 |
- | return render(request, template, context) |
289 |
- | |
290 |
- | def roadmap(request): |
291 |
- | template = "about/roadmap.html" |
292 |
- | |
293 |
- | data = Goal.objects.order_by('title') |
294 |
- | |
295 |
- | context = { |
296 |
- | 'subject': "roadmap", |
297 |
- | 'navbar_title': "Roadmap", |
298 |
- | 'data': data, |
299 |
- | } |
300 |
- | context.update(standard_context()) |
301 |
- | return render(request, template, context) |
302 |
- | |
303 |
- |