Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
Official
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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
7ingannisdo
Official
Commits
c4474646
Verified
Commit
c4474646
authored
3 years ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
Add distinct to permission-related queries in FilterRegisterObjectForm and AssignGroupRoleForm
parent
02b1b695
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGELOG.rst
+1
-0
1 addition, 0 deletions
CHANGELOG.rst
aleksis/apps/alsijil/forms.py
+6
-4
6 additions, 4 deletions
aleksis/apps/alsijil/forms.py
with
7 additions
and
4 deletions
CHANGELOG.rst
+
1
−
0
View file @
c4474646
...
@@ -13,6 +13,7 @@ Fixed
...
@@ -13,6 +13,7 @@ Fixed
~~~~~
~~~~~
* The _Delete personal note_ action didn't work due to wrong usage of ``bulk_update``.
* The _Delete personal note_ action didn't work due to wrong usage of ``bulk_update``.
* Groups and persons were shown multiple times in some forms due to filtering by permissions.
`2.0rc4`_ - 2021-08-01
`2.0rc4`_ - 2021-08-01
----------------------
----------------------
...
...
This diff is collapsed.
Click to expand it.
aleksis/apps/alsijil/forms.py
+
6
−
4
View file @
c4474646
...
@@ -256,11 +256,13 @@ class AssignGroupRoleForm(forms.ModelForm):
...
@@ -256,11 +256,13 @@ class AssignGroupRoleForm(forms.ModelForm):
)
)
else
:
else
:
persons
=
persons
.
filter
(
member_of__owners
=
self
.
request
.
user
.
person
)
persons
=
persons
.
filter
(
member_of__owners
=
self
.
request
.
user
.
person
)
self
.
fields
[
"
person
"
].
queryset
=
persons
self
.
fields
[
"
person
"
].
queryset
=
persons
.
distinct
()
if
"
groups
"
not
in
initial
:
if
"
groups
"
not
in
initial
:
groups
=
Group
.
objects
.
for_current_school_term_or_all
().
filter
(
groups
=
(
owners
=
self
.
request
.
user
.
person
Group
.
objects
.
for_current_school_term_or_all
()
.
filter
(
owners
=
self
.
request
.
user
.
person
)
.
distinct
()
)
)
self
.
fields
[
"
groups
"
].
queryset
=
groups
self
.
fields
[
"
groups
"
].
queryset
=
groups
...
@@ -332,7 +334,7 @@ class FilterRegisterObjectForm(forms.Form):
...
@@ -332,7 +334,7 @@ class FilterRegisterObjectForm(forms.Form):
|
Q
(
lessons__lesson_periods__substitutions__teachers
=
person
)
|
Q
(
lessons__lesson_periods__substitutions__teachers
=
person
)
|
Q
(
events__teachers
=
person
)
|
Q
(
events__teachers
=
person
)
|
Q
(
extra_lessons__teachers
=
person
)
|
Q
(
extra_lessons__teachers
=
person
)
)
)
.
distinct
()
elif
not
for_person
:
elif
not
for_person
:
groups
=
Group
.
objects
.
all
()
groups
=
Group
.
objects
.
all
()
self
.
fields
[
"
group
"
].
queryset
=
groups
self
.
fields
[
"
group
"
].
queryset
=
groups
...
...
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