Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Arkindex
Backend
Commits
d2291a3b
Commit
d2291a3b
authored
4 years ago
by
Valentin Rigal
Browse files
Options
Downloads
Patches
Plain Diff
Update admin
parent
90b842ce
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
arkindex/users/admin.py
+15
-5
15 additions, 5 deletions
arkindex/users/admin.py
with
15 additions
and
5 deletions
arkindex/users/admin.py
+
15
−
5
View file @
d2291a3b
...
...
@@ -2,10 +2,10 @@ from django import forms
from
django.contrib
import
admin
from
django.contrib.auth.admin
import
UserAdmin
as
BaseUserAdmin
from
django.contrib.auth.forms
import
ReadOnlyPasswordHashField
from
django.contrib.auth.models
import
Group
from
django.contrib.auth.models
import
Group
as
BaseGroup
from
enumfields.admin
import
EnumFieldListFilter
from
arkindex.users.models
import
CorpusRight
,
User
,
UserScope
from
arkindex.users.models
import
CorpusRight
,
Group
,
User
,
UserScope
class
UserCreationForm
(
forms
.
ModelForm
):
...
...
@@ -90,8 +90,18 @@ class UserScopeAdmin(admin.ModelAdmin):
list_filter
=
[(
'
scope
'
,
EnumFieldListFilter
),
]
# Now register the new UserAdmin...
class
MembershipInline
(
admin
.
TabularInline
):
model
=
Group
.
users
.
through
class
GroupAdmin
(
admin
.
ModelAdmin
):
list_display
=
(
'
id
'
,
'
name
'
,
'
public
'
)
inlines
=
(
MembershipInline
,
)
admin
.
site
.
register
(
User
,
UserAdmin
)
# and hide the unused Group admin
admin
.
site
.
unregister
(
Group
)
# Register the custom GroupAdmin
admin
.
site
.
register
(
Group
,
GroupAdmin
)
# and hide base GroupAdmin form contrib.auth
admin
.
site
.
unregister
(
BaseGroup
)
admin
.
site
.
register
(
UserScope
,
UserScopeAdmin
)
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