mirror of https://github.com/gmbrax/Pilgrim.git
Merge pull request #83 from gmbrax/fix/add-photos-list-to-entry-model
Fix to add a photo list to the constructor of the entry model
This commit is contained in:
commit
92ee47cff3
|
|
@ -1,5 +1,6 @@
|
|||
from typing import Any
|
||||
from typing import Any, List
|
||||
|
||||
from pilgrim.models.photo import Photo
|
||||
from pilgrim.models.photo_in_entry import photo_entry_association
|
||||
from sqlalchemy import Column, Integer, String, ForeignKey, DateTime
|
||||
from sqlalchemy.orm import relationship
|
||||
|
|
@ -21,9 +22,12 @@ class Entry(Base):
|
|||
fk_travel_diary_id = Column(Integer, ForeignKey("travel_diaries.id"), nullable=False)
|
||||
travel_diary = relationship("TravelDiary", back_populates="entries")
|
||||
|
||||
def __init__(self, title: str, text: str, date: str, travel_diary_id: int, **kw: Any):
|
||||
def __init__(self, title: str, text: str, date: Any, travel_diary_id: int, photos: List[Photo] = None, **kw: Any):
|
||||
super().__init__(**kw)
|
||||
self.title = title
|
||||
self.text = text
|
||||
self.date = date
|
||||
self.fk_travel_diary_id = travel_diary_id
|
||||
if photos is not None:
|
||||
self.photos = photos
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue