Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
campaign
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
La Quadrature du Net
piphone
campaign
Commits
13441dbf
Commit
13441dbf
authored
Sep 14, 2017
by
okhin
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing the formfield function in case of superuser.
parent
c3984fb3
Pipeline
#1239
passed with stage
in 54 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
picampaign/campaign/admin.py
picampaign/campaign/admin.py
+6
-3
No files found.
picampaign/campaign/admin.py
View file @
13441dbf
...
...
@@ -32,6 +32,9 @@ class CampaignAdmin(TranslationAdmin):
def
formfield_for_foreignkey
(
self
,
db_field
,
request
,
**
kwargs
):
if
db_field
.
name
==
"organization"
:
if
request
.
user
.
is_superuser
:
kwargs
[
"queryset"
]
=
Organization
.
objects
.
all
()
else
:
query
=
{
'id__in'
:
[
x
.
id
for
x
in
request
.
user
.
organizations
.
all
()]}
kwargs
[
"queryset"
]
=
Organization
.
objects
.
filter
(
**
query
)
...
...
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