added test containers and items to testdata
This commit is contained in:
parent
e8a92b26fa
commit
04f42a8747
1 changed files with 11 additions and 1 deletions
|
@ -3,7 +3,7 @@ import os
|
||||||
|
|
||||||
def setup():
|
def setup():
|
||||||
from authentication.models import ExtendedUser, EventPermission
|
from authentication.models import ExtendedUser, EventPermission
|
||||||
from inventory.models import Event
|
from inventory.models import Event, Container, Item
|
||||||
from django.contrib.auth.models import Permission, Group
|
from django.contrib.auth.models import Permission, Group
|
||||||
permissions = ['add_item', 'view_item', 'view_file', 'delete_item', 'change_item']
|
permissions = ['add_item', 'view_item', 'view_file', 'delete_item', 'change_item']
|
||||||
if not ExtendedUser.objects.filter(username='admin').exists():
|
if not ExtendedUser.objects.filter(username='admin').exists():
|
||||||
|
@ -38,6 +38,16 @@ def setup():
|
||||||
start='2024-12-18 00:00:00.000000', end='2024-12-27 00:00:00.000000',
|
start='2024-12-18 00:00:00.000000', end='2024-12-27 00:00:00.000000',
|
||||||
pre_start='2024-12-31 00:00:00.000000', post_end='2025-01-04 00:00:00.000000')[
|
pre_start='2024-12-31 00:00:00.000000', post_end='2025-01-04 00:00:00.000000')[
|
||||||
0]
|
0]
|
||||||
|
|
||||||
|
container1 ,_= Container.objects.get_or_create(id=1, name='Box1')
|
||||||
|
container2 ,_= Container.objects.get_or_create(id=2, name='Box2')
|
||||||
|
|
||||||
|
testitem1 ,_= Item.objects.get_or_create(id=1, event=event1, description="Test item 1",uid_deprecated=111)
|
||||||
|
testitem1.container = container1
|
||||||
|
testitem2 ,_= Item.objects.get_or_create(id=2, event=event2, description="Test item 2",uid_deprecated=112)
|
||||||
|
testitem2.container = container1
|
||||||
|
testitem3 ,_= Item.objects.get_or_create(id=3, event=event2, description="Test item 3",uid_deprecated=113)
|
||||||
|
testitem3.container = container2
|
||||||
|
|
||||||
# for permission in permissions:
|
# for permission in permissions:
|
||||||
# EventPermission.objects.create(event=event_37c3, user=foo,
|
# EventPermission.objects.create(event=event_37c3, user=foo,
|
||||||
|
|
Loading…
Add table
Reference in a new issue