دریافت ارور 'NoneType' object has no attribute 'search'
حل شده توسط
امیرحسین سبزه ئی
با سلام
بنده اسکریپت رو مانند استاد در قسمت منیجر، بیس پیاده کردم اما در انتهای کلاس با ارور بالا رو به رو شدم و نمیدونم چرا بیس ست نمیشه......
سلام وقت بخیر لطفا سورس کد خودتون رو اپلود کنید که بررسی کنیم
Reza Mobaraki۳۱ خرداد ۱۴۰۳، ۱۳:۲۸
from user import User
from random import choice
from estate import Apartment,house,Store
from region import region
from advertisment import Apartment_Sell,Apartment_rent,house_sell,house_rent,store_sell,store_rent
if __name__ == "__main__":
name=['amir','reza','taghi']
last_name=['mahdavi','torabi','naghavi']
mobiles=['09106515684','09186248942','09218087777'
,'09186243333','09186308888']
for mobile in mobiles:
User(choice(name),choice(last_name),mobile)
for user in User.object_list:
print(f'{user.id}\t{user.fullname}')
# print('----------------------------------------------------')
rg1=region('tehransar')
rg2=region('darya')
apartmentsel1=Apartment_Sell(True,False,3,user.object_list[0],80,2,1395,rg1,'malek ashtar',7,True,False)
apartmentrent1=Apartment_rent(True,False,3,user.object_list[0],80,2,1395,rg1,'malek ashtar',6996,555)
house_sell1=house_sell(True,False,3,user.object_list[0],80,2,1395,rg1,'malek ashtar',99999)
house_rent1=house_rent(True,False,3,user.object_list[0],80,2,1395,rg1,'malek ashtar',919191)
print(Apartment_Sell.manager,'ddd',Apartment_rent.manager)
apartmentsel2 = Apartment_Sell(True, False, 3, user.object_list[0], 80, 2, 1395, rg1, 'malek ashtar', 4, True, False)
apartmentsel3 = Apartment_Sell(True, False, 3, user.object_list[0], 80, 2, 1395, rg1, 'malek ashtar', 9, True, False)
print(Apartment_Sell.manager,'ddd',Apartment_rent.manager)
print(apartmentsel1.manager.search(area__min=80))
print(Apartment_Sell.mro())
from deal import sell,rent
from estate import Apartment,house,Store
from base import BaseClass
class Apartment_Sell(BaseClass, Apartment,sell):
def show_detail(self):
self.show_describtion()
self.show_price()
class Apartment_rent(BaseClass,Apartment,rent):
pass
class house_sell(BaseClass,house,sell):
pass
class house_rent(BaseClass,house,rent):
pass
class store_sell(BaseClass,Store,sell):
pass
class store_rent(BaseClass,Store,rent):
pass
from abc import ABC
from manager import Manager
class BaseClass(ABC):
_id = 0
object_list = None
manager = None
def __init__(self, *args, **kwargs):
self.id = self.generate_id()
self.set_manager
self.store(self)
super().__init__(*args, **kwargs)
@classmethod
def generate_id(cls):
cls._id += 1
return cls._id
@classmethod
def set_manager(cls):
if cls.manager is None:
cls.manager=Manager(cls)
@classmethod
def store(cls, obj):
if cls.object_list is None:
cls.object_list=[]
cls.object_list.append(obj)