mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add fixture for users / groups
This commit is contained in:
parent
e13850515d
commit
f766711838
53
InvenTree/users/fixtures/users.yaml
Normal file
53
InvenTree/users/fixtures/users.yaml
Normal file
@ -0,0 +1,53 @@
|
||||
- model: auth.group
|
||||
pk: 1
|
||||
fields:
|
||||
name: "Viewers"
|
||||
|
||||
- model: auth.group
|
||||
pk: 2
|
||||
fields:
|
||||
name: "Engineers"
|
||||
|
||||
- model: auth.group
|
||||
pk: 3
|
||||
fields:
|
||||
name: "Sales"
|
||||
|
||||
- model: auth.user
|
||||
pk: 1
|
||||
fields:
|
||||
username: "sue_the_superuser"
|
||||
is_superuser: true
|
||||
|
||||
- model: auth.user
|
||||
pk: 2
|
||||
fields:
|
||||
username: "engineer_eddie"
|
||||
groups:
|
||||
- 2
|
||||
is_active: true
|
||||
is_staff: false
|
||||
is_superuser: false
|
||||
|
||||
- model: auth.user
|
||||
pk: 3
|
||||
fields:
|
||||
username: "alanallgroup"
|
||||
first_name: "Alan"
|
||||
last_name: "Allgroup"
|
||||
is_active: false
|
||||
groups:
|
||||
- 1
|
||||
- 2
|
||||
- 3
|
||||
|
||||
- model: auth.user
|
||||
pk: 4
|
||||
fields:
|
||||
username: "sam"
|
||||
first_name: "Samuel"
|
||||
last_name: "Salesperson"
|
||||
groups:
|
||||
- 3
|
||||
is_staff: true
|
||||
is_superuser: true
|
5
tasks.py
5
tasks.py
@ -286,6 +286,8 @@ def export_records(c, filename='data.json'):
|
||||
# Dump data to temporary file
|
||||
manage(c, cmd, pty=True)
|
||||
|
||||
print("Running data post-processing step...")
|
||||
|
||||
# Post-process the file, to remove any "permissions" specified for a group
|
||||
with open(tmpfile, "r") as f_in:
|
||||
data = json.loads(f_in.read())
|
||||
@ -365,6 +367,9 @@ def import_fixtures(c):
|
||||
'location',
|
||||
'stock_tests',
|
||||
'stock',
|
||||
|
||||
# Users
|
||||
'users'
|
||||
]
|
||||
|
||||
command = 'loaddata ' + ' '.join(fixtures)
|
||||
|
Loading…
Reference in New Issue
Block a user