forked from JasonGrace2282/INVESTigator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_fake_cases.py
executable file
·45 lines (39 loc) · 952 Bytes
/
create_fake_cases.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env python3
import subprocess
import sys
from pathlib import Path
import lorem
if not __file__.endswith("shell.py"):
subprocess.call(
[
sys.executable,
Path(__file__).resolve().parent / "manage.py",
"shell",
"-c",
open(__file__).read(),
]
)
exit()
from case.models import Case
DATA = [
{
"lead": "John Doe",
"name": "Mystery of the Hat",
"description": "\n".join((lorem.paragraph(), lorem.paragraph())),
},
{
"lead": "Billy Bob",
"name": "Mall Mystery",
"description": "\n".join((lorem.paragraph(), lorem.paragraph())),
},
{
"lead": "Geoffery Jack",
"name": "Murder of the Cat",
"description": lorem.paragraph(),
}
]
for case_data in DATA:
obj, created = Case.objects.get_or_create(**case_data)
if not created:
continue
obj.save()