Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FoD
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
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Schmitz
FoD
Commits
ce1536e9
Commit
ce1536e9
authored
13 years ago
by
Leonidas Poulopoulos
Browse files
Options
Downloads
Patches
Plain Diff
Added custom admin actions to User model
parent
1b897754
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
flowspec/admin.py
+15
-0
15 additions, 0 deletions
flowspec/admin.py
with
15 additions
and
0 deletions
flowspec/admin.py
+
15
−
0
View file @
ce1536e9
...
...
@@ -65,7 +65,22 @@ class UserProfileInline(admin.StackedInline):
model
=
UserProfile
class
UserProfileAdmin
(
UserAdmin
):
actions
=
[
'
deactivate
'
,
'
activate
'
]
list_display
=
(
'
username
'
,
'
email
'
,
'
first_name
'
,
'
last_name
'
,
'
is_staff
'
,
'
is_active
'
,
'
get_userprofile_peer
'
)
inlines
=
[
UserProfileInline
]
def
deactivate
(
self
,
request
,
queryset
):
queryset
=
queryset
.
update
(
is_active
=
False
)
deactivate
.
short_description
=
"
Deactivate Selected Users
"
def
activate
(
self
,
request
,
queryset
):
queryset
=
queryset
.
update
(
is_active
=
True
)
activate
.
short_description
=
"
Activate Selected Users
"
def
get_userprofile_peer
(
self
,
instance
):
# instance is User instance
return
instance
.
get_profile
().
peer
get_userprofile_peer
.
short_description
=
"
User Peer
"
# fields = ('name', 'applier', 'expires')
#def formfield_for_dbfield(self, db_field, **kwargs):
...
...
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