Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django_pazdziernikowe
Overview
Overview
Details
Activity
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
Patryk Czarnik
django_pazdziernikowe
Commits
3270ef5c
Commit
3270ef5c
authored
Oct 16, 2025
by
Patryk Czarnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
szablon czasu
parent
afeb8d24
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
2 deletions
+33
-2
szablon_czasu.html
aplikacja/templates/szablon_czasu.html
+14
-0
views.py
aplikacja/views.py
+15
-0
urls.py
webowy/urls.py
+4
-2
No files found.
aplikacja/templates/szablon_czasu.html
0 → 100644
View file @
3270ef5c
<!DOCTYPE html>
<html
lang=
"pl"
>
<head>
<meta
charset=
"UTF-8"
>
<title>
Która godzina
</title>
</head>
<body>
<h1>
Nagłówek strony
</h1>
<p>
To jest zwykły tekst.
</p>
<p>
Teraz jest {{now}}
</p>
<p>
Dzień miesiąca to {{now.day}} a sekunda {{now.second}}
</p>
</body>
</html>
aplikacja/views.py
View file @
3270ef5c
...
...
@@ -10,3 +10,18 @@ def hello(request):
def
daj_czas
(
request
):
return
HttpResponse
(
datetime
.
now
())
def
czas_html
(
request
):
godzina
=
datetime
.
now
()
.
strftime
(
'
%
H:
%
M:
%
S'
)
html
=
f
'''<!DOCTYPE html>
<html><head>
<title>Która godzina</title>
</head>
<body style="background-color: #FFFFDD">
<p>Teraz jest późna godzina <strong style="color:purple">{godzina}</strong></p>
</body>
</html>
'''
return
HttpResponse
(
html
,
content_type
=
'text/html;charset=UTF-8'
)
def
czas_szablon
(
request
):
return
render
(
request
,
'szablon_czasu.html'
,
{
'now'
:
datetime
.
now
()})
webowy/urls.py
View file @
3270ef5c
...
...
@@ -17,10 +17,12 @@ Including another URLconf
from
django.contrib
import
admin
from
django.urls
import
path
from
aplikacja.views
import
hello
,
daj_czas
from
aplikacja.views
import
*
urlpatterns
=
[
path
(
"admin/"
,
admin
.
site
.
urls
),
path
(
"hello"
,
hello
),
path
(
"czas"
,
daj_czas
),
path
(
"czas1"
,
daj_czas
),
path
(
"czas2"
,
czas_html
),
path
(
"czas3"
,
czas_szablon
),
]
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