Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Rex Dri
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
32
Issues
32
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Rex Dri
Rex Dri
Commits
1bb46723
Commit
1bb46723
authored
Sep 04, 2018
by
Florent Chehab
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Admin access bug corrected
parent
10ef6018
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
7 deletions
+15
-7
backend/load_data/loading_scripts/loadAdminUser.py
backend/load_data/loading_scripts/loadAdminUser.py
+15
-7
No files found.
backend/load_data/loading_scripts/loadAdminUser.py
View file @
1bb46723
...
...
@@ -3,13 +3,21 @@ from django.contrib.auth.models import User
class
LoadAdminUser
(
object
):
def
__init__
(
self
):
self
.
admin
=
User
.
objects
.
get_or_create
(
username
=
"admin"
,
defaults
=
{
'email'
:
'null@null.fr'
,
'password'
:
'admin'
,
'is_staff'
:
True
})[
0
]
"""
Creating admin user by creating a user and setting is_staff is True
didn't enable access to the admin system for an unkown reason.
Need to use create_superuser.
"""
user
=
User
.
objects
.
filter
(
username
=
"admin"
)
if
len
(
user
)
>
0
:
self
.
admin
=
user
[
0
]
else
:
User
.
objects
.
create_superuser
(
username
=
"admin"
,
email
=
'null@null.fr'
,
password
=
'admin'
,
)
self
.
admin
=
User
.
objects
.
filter
(
username
=
"admin"
)[
0
]
def
get
(
self
):
return
self
.
admin
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