-
Notifications
You must be signed in to change notification settings - Fork 0
/
fixtures.py
78 lines (63 loc) · 1.76 KB
/
fixtures.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
from django.core.serializers import serialize
from placements.models import Student, Company, JobPosting, Placement
# Students
students = [
Student(
name="John Smith",
email="[email protected]",
roll_number="001",
status="Available",
),
Student(
name="Jane Doe", email="[email protected]", roll_number="002", status="Placed"
),
]
data = serialize("json", students)
with open("data_students.json", "w") as f:
f.write(data)
# Companies
companies = [
Company(name="Google", website="https://www.google.com", email="[email protected]"),
Company(
name="Facebook", website="https://www.facebook.com", email="[email protected]"
),
]
data = serialize("json", companies)
with open("data_companies.json", "w") as f:
f.write(data)
# Job Postings
job_postings = [
JobPosting(
company=companies[0],
title="Software Engineer",
description="Looking for a software engineer to join our team.",
qualifications="Bachelor's degree in computer science.",
),
JobPosting(
company=companies[1],
title="Data Analyst",
description="Looking for a data analyst to join our team.",
qualifications="Master's degree in statistics.",
),
]
data = serialize("json", job_postings)
with open("data_job_postings.json", "w") as f:
f.write(data)
# Placements
placements = [
Placement(
student=students[0],
job_posting=job_postings[0],
date="2022-01-01",
is_accepted=False,
),
Placement(
student=students[1],
job_posting=job_postings[1],
date="2022-01-02",
is_accepted=True,
),
]
data = serialize("json", placements)
with open("data_placements.json", "w") as f:
f.write(data)