-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdriver.py
31 lines (26 loc) · 814 Bytes
/
driver.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
from models import House, AddressData, AddressParts
def main():
my_house = House(
address=[
AddressData(
address_data=[
AddressParts(
house_number=1023,
street_name="Main Street",
city_name="Anytown"
)
]
)
]
)
# also called automatically when `.save()` is called
my_house.full_clean()
# clean also automatically wraps dicts in appropriate classes so this is
# also acceptable:
my_house = House(address=[{'address_data': [{
'house_number': 1023,
'street_name': "Main Street",
'city_name': "Anytown"
}]}])
my_house.full_clean()
main()