MyReadings/Book.py

25 lines
1015 B
Python
Raw Permalink Normal View History

2024-08-05 15:14:49 -04:00
class Book:
2024-08-06 08:45:37 -04:00
def __init__(self, name: str, author: str, description: str, image: str, review: str, release_date: str, reading_date: str) -> None:
2024-08-05 15:14:49 -04:00
self.name: str = name
self.description: str = description
self.image: str = image
self.review: str = review
2024-08-06 07:12:55 -04:00
self.release_date: str = release_date
self.reading_date: str = reading_date
2024-08-06 08:45:37 -04:00
self.author: str = author
2024-08-05 15:14:49 -04:00
def to_html(self) -> str:
return f"""
<tr>
2024-08-05 16:15:47 -04:00
<td class="image-div"><img src="img/{self.image}"></td>
<td class="namedesc-div">
2024-08-06 08:45:37 -04:00
<p class="author">{self.author}</p>
2024-08-05 16:15:47 -04:00
<p class="name">{self.name}</p>
<p class="description">{self.description}</p>
2024-08-06 07:12:55 -04:00
<p class="release-date">{self.release_date}</p>
2024-08-05 16:15:47 -04:00
</td>
<td class="review-div">{self.review}</td>
2024-08-06 07:12:55 -04:00
<td class="reading-date">{self.reading_date}</td>
2024-08-05 15:14:49 -04:00
</tr>
"""