Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Chronos
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Official
AlekSIS-App-Chronos
Commits
d1b7229a
Verified
Commit
d1b7229a
authored
5 years ago
by
Nik | Klampfradler
Browse files
Options
Downloads
Patches
Plain Diff
Add template helpers to work with weekdays.
Advances BiscuIT-App-Alsijil#9.
parent
561d370c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
biscuit/apps/chronos/templatetags/week_helpers.py
+11
-1
11 additions, 1 deletion
biscuit/apps/chronos/templatetags/week_helpers.py
biscuit/apps/chronos/util.py
+4
-0
4 additions, 0 deletions
biscuit/apps/chronos/util.py
with
15 additions
and
1 deletion
biscuit/apps/chronos/templatetags/week_helpers.py
+
11
−
1
View file @
d1b7229a
...
...
@@ -2,7 +2,7 @@ from datetime import date
from
django
import
template
from
..util
import
week_days
from
..util
import
week_days
,
week_weekday_to_date
register
=
template
.
Library
()
...
...
@@ -16,3 +16,13 @@ def week_start(week: int) -> date:
@register.filter
def
week_end
(
week
:
int
)
->
date
:
return
week_days
(
week
)[
-
1
]
@register.simple_tag
def
weekday_to_date
(
week
:
int
,
weekday
:
int
)
->
date
:
return
week_weekday_to_date
(
week
,
weekday
)
@register.simple_tag
def
today
()
->
date
:
return
date
.
today
()
This diff is collapsed.
Click to expand it.
biscuit/apps/chronos/util.py
+
4
−
0
View file @
d1b7229a
...
...
@@ -34,3 +34,7 @@ def current_lesson_periods(when: Optional[datetime] = None) -> models.query.Quer
def
week_weekday_from_date
(
when
:
date
)
->
Sequence
[
int
]:
return
(
int
(
when
.
strftime
(
'
%V
'
)),
int
(
when
.
strftime
(
'
%u
'
)))
def
week_weekday_to_date
(
week
:
int
,
weekday
:
int
)
->
date
:
return
week_days
(
week
)[
weekday
]
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment