Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor 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-Core
Commits
aec973fb
Verified
Commit
aec973fb
authored
5 years ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
Add context processor and helpers for passing default school to templates
parent
6be70234
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!143
Add base template for printing views
Pipeline
#762
failed
5 years ago
Stage: test
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/core/models.py
+4
-0
4 additions, 0 deletions
aleksis/core/models.py
aleksis/core/util/core_helpers.py
+9
-0
9 additions, 0 deletions
aleksis/core/util/core_helpers.py
with
13 additions
and
0 deletions
aleksis/core/models.py
+
4
−
0
View file @
aec973fb
...
...
@@ -30,6 +30,10 @@ class School(ExtensibleModel):
logo
=
ImageCropField
(
verbose_name
=
_
(
"
School logo
"
),
blank
=
True
,
null
=
True
)
logo_cropping
=
ImageRatioField
(
"
logo
"
,
"
600x600
"
,
size_warning
=
True
)
@classmethod
def
get_default
(
cls
):
return
cls
.
objects
.
first
()
@property
def
current_term
(
self
):
return
SchoolTerm
.
objects
.
get
(
current
=
True
)
...
...
This diff is collapsed.
Click to expand it.
aleksis/core/util/core_helpers.py
+
9
−
0
View file @
aec973fb
...
...
@@ -139,3 +139,12 @@ def path_and_rename(instance, filename: str, upload_to: str = "files") -> str:
# return the whole path to the file
return
os
.
path
.
join
(
upload_to
,
new_filename
)
def
school_information_processor
(
request
:
HttpRequest
)
->
dict
:
"""
Provides default School object in all templates
"""
from
..models
import
School
return
{
"
SCHOOL
"
:
School
.
get_default
,
}
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