Fixing __repr__ for RightmoveListing and adding a small testing script

This commit is contained in:
Kadir Tugan 2023-11-18 13:25:00 +02:00
parent 8698b41e0e
commit f30115eecd
2 changed files with 16 additions and 5 deletions

View file

@ -1,6 +1,6 @@
from sqlalchemy import create_engine
from sqlalchemy.orm import Session
from sqlalchemy import Column, Integer, String, JSON, FLOAT
from sqlalchemy import Column, Integer, JSON, FLOAT
from sqlalchemy.orm import declarative_base
engine = create_engine("sqlite:///sqlite.db", echo=True)
@ -26,10 +26,11 @@ class RightmoveListing(Base):
session.commit()
def __repr__(self):
return "<User(name='%s', fullname='%s', nickname='%s')>" % (
self.name,
self.fullname,
self.nickname,
return "<RightMoveListing(id='{}', price='{}', lat={}, lon={}')>".format(
self.id,
self.price,
self.lat,
self.lon,
)