mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-17 12:35:46 +00:00
Add some unit tests
- Saving a model automatically updates the reference_int field - Data migrations are correctly applied
This commit is contained in:
@ -10,12 +10,8 @@ def build_refs(apps, schema_editor):
|
||||
Rebuild the integer "reference fields" for existing Build objects
|
||||
"""
|
||||
|
||||
print("\n - Rebuilding reference field for BuildOrder model...")
|
||||
|
||||
BuildOrder = apps.get_model('build', 'build')
|
||||
|
||||
n = BuildOrder.objects.count()
|
||||
|
||||
for build in BuildOrder.objects.all():
|
||||
|
||||
ref = 0
|
||||
@ -31,9 +27,6 @@ def build_refs(apps, schema_editor):
|
||||
build.reference_int = ref
|
||||
build.save()
|
||||
|
||||
print(f" - Updated {n} BuildOrder objects")
|
||||
print(f" - COMPLETE! -")
|
||||
|
||||
def unbuild_refs(apps, schema_editor):
|
||||
"""
|
||||
Provided only for reverse migration compatibility
|
||||
|
Reference in New Issue
Block a user