mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-12 10:05:39 +00:00
Adds a management command to rebuild MPTT models
- Important to do after importing records / fixtures! - Otherwise very strange things might happen especially when you try to use the API...
This commit is contained in:
12
tasks.py
12
tasks.py
@ -129,6 +129,14 @@ def wait(c):
|
||||
|
||||
manage(c, "wait_for_db")
|
||||
|
||||
@task
|
||||
def rebuild(c):
|
||||
"""
|
||||
Rebuild database models with MPTT structures
|
||||
"""
|
||||
|
||||
manage(c, "rebuild_models")
|
||||
|
||||
@task
|
||||
def migrate(c):
|
||||
"""
|
||||
@ -311,7 +319,7 @@ def export_records(c, filename='data.json'):
|
||||
print("Data export completed")
|
||||
|
||||
|
||||
@task(help={'filename': 'Input filename'})
|
||||
@task(help={'filename': 'Input filename'}, post=[rebuild])
|
||||
def import_records(c, filename='data.json'):
|
||||
"""
|
||||
Import database records from a file
|
||||
@ -354,7 +362,7 @@ def import_records(c, filename='data.json'):
|
||||
|
||||
print("Data import completed")
|
||||
|
||||
@task
|
||||
@task(post=[rebuild])
|
||||
def import_fixtures(c):
|
||||
"""
|
||||
Import fixture data into the database.
|
||||
|
Reference in New Issue
Block a user