Fix flake8
This commit is contained in:
@@ -1,11 +1,9 @@
|
||||
__author__ = 'RemiZOffAlex'
|
||||
__copyright__ = '(c) RemiZOffAlex'
|
||||
__license__ = 'MIT'
|
||||
__email__ = 'remizoffalex@mail.ru'
|
||||
__url__ = 'http://remizoffalex.ru'
|
||||
|
||||
import datetime
|
||||
from sqlalchemy import Column, Boolean, Integer, ForeignKey, String, DateTime
|
||||
from sqlalchemy import Column, Integer, ForeignKey, String, DateTime
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
from . import Base
|
||||
@@ -20,8 +18,8 @@ class Note(Base):
|
||||
user_id = Column(Integer, ForeignKey('user.id'))
|
||||
title = Column(String)
|
||||
body = Column(String, default='')
|
||||
created = Column(DateTime) # Дата создания
|
||||
updated = Column(DateTime) # Дата обновления
|
||||
created = Column(DateTime) # Дата создания
|
||||
updated = Column(DateTime) # Дата обновления
|
||||
|
||||
# Связи
|
||||
user = relationship(
|
||||
@@ -31,9 +29,8 @@ class Note(Base):
|
||||
)
|
||||
tags = relationship("TagNote", primaryjoin="Note.id==TagNote.note_id")
|
||||
|
||||
|
||||
def __init__(self, user, title):
|
||||
assert type(user).__name__=='User', app.logger.info('Не передан объект User')
|
||||
assert type(user).__name__ == 'User', 'Не передан объект User'
|
||||
self.user_id = user.id
|
||||
self.title = title
|
||||
self.created = datetime.datetime.now()
|
||||
@@ -53,15 +50,23 @@ class TagNote(Base):
|
||||
id = Column(Integer, primary_key=True)
|
||||
note_id = Column(Integer, ForeignKey('note.id'))
|
||||
tag_id = Column(Integer, ForeignKey('tag.id'))
|
||||
created = Column(DateTime) # Дата создания
|
||||
created = Column(DateTime) # Дата создания
|
||||
|
||||
# Связи
|
||||
note = relationship("Note", primaryjoin="TagNote.note_id==Note.id", uselist=False)
|
||||
tag = relationship("Tag", primaryjoin="TagNote.tag_id==Tag.id", uselist=False)
|
||||
note = relationship(
|
||||
"Note",
|
||||
primaryjoin="TagNote.note_id==Note.id",
|
||||
uselist=False
|
||||
)
|
||||
tag = relationship(
|
||||
"Tag",
|
||||
primaryjoin="TagNote.tag_id==Tag.id",
|
||||
uselist=False
|
||||
)
|
||||
|
||||
def __init__(self, note, tag):
|
||||
assert type(note).__name__=='Note', app.logger.info('Не передан объект Note')
|
||||
assert type(tag).__name__=='Tag', app.logger.info('Не передан объект Tag')
|
||||
assert type(note).__name__ == 'Note', 'Не передан объект Note'
|
||||
assert type(tag).__name__ == 'Tag', 'Не передан объект Tag'
|
||||
self.note_id = note.id
|
||||
self.tag_id = tag.id
|
||||
self.created = datetime.datetime.now()
|
||||
|
||||
Reference in New Issue
Block a user