Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Alsijil
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-Alsijil
Commits
eb2f42e7
Verified
Commit
eb2f42e7
authored
4 years ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
Prefetch form select data
parent
cbe2050b
No related branches found
No related tags found
1 merge request
!90
Performance optimizations
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/apps/alsijil/forms.py
+8
-1
8 additions, 1 deletion
aleksis/apps/alsijil/forms.py
aleksis/apps/alsijil/models.py
+7
-1
7 additions, 1 deletion
aleksis/apps/alsijil/models.py
with
15 additions
and
2 deletions
aleksis/apps/alsijil/forms.py
+
8
−
1
View file @
eb2f42e7
...
...
@@ -46,6 +46,11 @@ class PersonalNoteForm(forms.ModelForm):
if
self
.
instance
and
getattr
(
self
.
instance
,
"
person
"
,
None
):
self
.
fields
[
"
person_name
"
].
initial
=
str
(
self
.
instance
.
person
)
self
.
fields
[
"
extra_marks
"
].
choices
=
[(
e
.
id
,
str
(
e
))
for
e
in
ExtraMark
.
all
]
self
.
fields
[
"
excuse_type
"
].
choices
=
[(
None
,
"
-----
"
)]
+
[
(
e
.
id
,
str
(
e
))
for
e
in
ExcuseType
.
all
]
class
SelectForm
(
forms
.
Form
):
layout
=
Layout
(
Row
(
"
group
"
,
"
teacher
"
))
...
...
@@ -164,7 +169,9 @@ class RegisterAbsenceForm(forms.Form):
)
)
)
self
.
fields
[
"
person
"
].
queryset
=
Person
.
objects
.
filter
(
pk__in
=
list
(
persons_qs
.
values_list
(
"
pk
"
,
flat
=
True
)))
self
.
fields
[
"
person
"
].
queryset
=
Person
.
objects
.
filter
(
pk__in
=
list
(
persons_qs
.
values_list
(
"
pk
"
,
flat
=
True
))
)
self
.
fields
[
"
from_period
"
].
choices
=
period_choices
self
.
fields
[
"
to_period
"
].
choices
=
period_choices
...
...
This diff is collapsed.
Click to expand it.
aleksis/apps/alsijil/models.py
+
7
−
1
View file @
eb2f42e7
from
cache_memoize
import
cache_memoize
from
django.db
import
models
from
django.utils.decorators
import
classproperty
from
django.utils.formats
import
date_format
from
django.utils.translation
import
gettext_lazy
as
_
from
cache_memoize
import
cache_memoize
from
calendarweek
import
CalendarWeek
from
aleksis.apps.alsijil.managers
import
PersonalNoteManager
...
...
@@ -36,6 +36,12 @@ class ExcuseType(ExtensibleModel):
def
count_label
(
self
):
return
f
"
{
self
.
short_name
}
_count
"
@classproperty
@cache_memoize
(
3600
)
def
all
(
cls
):
qs
=
cls
.
objects
.
all
()
return
qs
class
Meta
:
ordering
=
[
"
name
"
]
verbose_name
=
_
(
"
Excuse type
"
)
...
...
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