-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsample.py
66 lines (49 loc) · 2.05 KB
/
sample.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
from random import choice
from estate import Apartment, House, Store
from user import User
from region import Region
from advertisement import ApartmentSell, HouseSell
FIRST_NAMES = ['Meysam', 'Kambiz', 'Jamshid']
LAST_NAMES = ['Ariaei', 'Alipour', 'Nazmi']
MOBILES = ['09123456789', '09123456788', '09123456787', '09123456786', '09123456786']
def create_samples():
for mobile in MOBILES:
User(choice(FIRST_NAMES), choice(LAST_NAMES), mobile)
# for user in User.object_list:
# print(f"{user.id}\t {user.fullname}")
reg1 = Region(name="R1")
reg2 = Region(name="R2")
# apt1 = Apartment(
# user=User.object_list[0], area=80, rooms_count=2, built_year=1393,
# has_elevator=True, has_parking=True, floor=2, region=reg1,
# address="Some text..."
# )
# house = House(
# has_yard=True, floor_count=1, user=User.object_list[2], area=400,
# rooms_count=6, built_year=1370, region=reg1, address="Some text..."
# )
# store = Store(
# user=User.object_list[-1], area=30,
# rooms_count=1, built_year=1390, region=reg1, address="Some text..."
# )
# apt1.show_description()
# house.show_description()
# store.show_description()
apartment_sell = ApartmentSell(
user=User.object_list[0], area=80, rooms_count=2, built_year=1393,
has_elevator=True, has_parking=True, floor=2, region=reg1,
address="Some text...", convertable=False, discountable=True,
price_per_meter=10
)
apartment_sell.show_detail()
# house_sell = HouseSell(
# has_yard=True, floor_count=1, user=User.object_list[2], area=400,
# rooms_count=6, built_year=1370, region=reg1, address="Some text...",
# convertable=True, discountable=True, price_per_meter=20
# )
# house_sell.show_detail()
search_result = ApartmentSell.manager.search(region=reg1, price_per_meter__min=6, price_per_meter__max=11)
# print(search_result)
# print(ApartmentSell.manager)
# print(HouseSell.manager)
print('Samples created')