mirror of https://github.com/gmbrax/Pilgrim.git
Added one more model: Photo.py and edited the Entry.py to add the Many-to-Many relationship to the Photo.py Model
This commit is contained in:
parent
385cdffead
commit
983489d57f
|
|
@ -5,10 +5,9 @@
|
|||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="0a7f92e2-b44a-4dfe-8e01-136d1c0c18be" name="Changes" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/src/Pilgrim/Models/__init__.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/Pilgrim.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/Pilgrim.iml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/Pilgrim/Models/Photo.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Pilgrim/TravelDiary.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/Pilgrim/Models/TravelDiary.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Pilgrim/Models/Entry.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/Pilgrim/Models/Entry.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Pilgrim/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/Pilgrim/__init__.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
|
|
@ -24,20 +23,25 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_BRANCH_BY_REPOSITORY">
|
||||
<map>
|
||||
<entry key="$PROJECT_DIR$" value="proposed_changes" />
|
||||
</map>
|
||||
</option>
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="GitHubPullRequestSearchHistory"><![CDATA[{
|
||||
"lastFilter": {
|
||||
"state": "OPEN",
|
||||
"assignee": "gmbrax"
|
||||
<component name="GitHubPullRequestSearchHistory">{
|
||||
"lastFilter": {
|
||||
"state": "OPEN",
|
||||
"assignee": "gmbrax"
|
||||
}
|
||||
}]]></component>
|
||||
<component name="GithubPullRequestsUISettings"><![CDATA[{
|
||||
"selectedUrlAndAccountId": {
|
||||
"url": "https://github.com/gmbrax/Pilgrim.git",
|
||||
"accountId": "213d8456-c67d-4cfd-99a6-337d47c35b4a"
|
||||
}</component>
|
||||
<component name="GithubPullRequestsUISettings">{
|
||||
"selectedUrlAndAccountId": {
|
||||
"url": "https://github.com/gmbrax/Pilgrim.git",
|
||||
"accountId": "213d8456-c67d-4cfd-99a6-337d47c35b4a"
|
||||
}
|
||||
}]]></component>
|
||||
}</component>
|
||||
<component name="ProjectColorInfo">{
|
||||
"associatedIndex": 0
|
||||
}</component>
|
||||
|
|
@ -54,7 +58,7 @@
|
|||
"Python.main.executor": "Run",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"RunOnceActivity.git.unshallow": "true",
|
||||
"git-widget-placeholder": "proposed__changes",
|
||||
"git-widget-placeholder": "master",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.detected.package.tslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
|
|
|
|||
|
|
@ -1,8 +1,14 @@
|
|||
from sqlalchemy import Column, Integer, String, ForeignKey
|
||||
from sqlalchemy import Column, Integer, String, ForeignKey, Table
|
||||
|
||||
from Pilgrim import Base
|
||||
|
||||
|
||||
photo_entry_association = Table('photo_entry_association', Base.metadata,
|
||||
Column('id', Integer, primary_key=True, autoincrement=True),
|
||||
Column('fk_Photo_id', Integer, ForeignKey('photo.id')),
|
||||
Column('fk_Entry_id', Integer, ForeignKey('Entry.id')))
|
||||
|
||||
|
||||
class Entry(Base):
|
||||
__tablename__ = "Entry"
|
||||
id = Column(Integer, primary_key=True)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
from sqlalchemy import Column, Integer, String
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
from Pilgrim import Base
|
||||
from Pilgrim.Models.Entry import photo_entry_association
|
||||
|
||||
|
||||
class Photo(Base):
|
||||
__tablename__ = "photo"
|
||||
id = Column(Integer, primary_key=True)
|
||||
filepath = Column(String)
|
||||
name = Column(String)
|
||||
addition_date = Column(String)
|
||||
caption = Column(String)
|
||||
entries = relationship(
|
||||
"Entry",
|
||||
secondary=photo_entry_association,
|
||||
back_populates="photos"
|
||||
)
|
||||
|
|
@ -2,5 +2,7 @@ from Pilgrim.Application import Application
|
|||
from Pilgrim.command import main
|
||||
from Pilgrim.Database import Database, Base
|
||||
from Pilgrim.Models.TravelDiary import TravelDiary
|
||||
from Pilgrim.Models.Entry import Entry
|
||||
from Pilgrim.Models.Photo import Photo
|
||||
|
||||
__all__ = ["Application", "Database", "TravelDiary", "main", "Base"]
|
||||
__all__ = ["Application", "Database", "TravelDiary", "Entry", "Photo", "main", "Base"]
|
||||
|
|
|
|||
Loading…
Reference in New Issue