La version 5 de Planète Casio. Regroupe le forum, les programmes, les tutoriel, les sprites et tous les autres outils développés par nos soins.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

28 lines
854 B

from app import db
from datetime import datetime
class Notification(db.Model):
""" A long-term `flash` notification. It is deleted when watched """
__tablename__ = 'notification'
id = db.Column(db.Integer, primary_key=True)
text = db.Column(db.UnicodeText)
href = db.Column(db.UnicodeText)
date = db.Column(db.DateTime, default=datetime.now())
owner_id = db.Column(db.Integer, db.ForeignKey('member.id'),
nullable=False, index=True)
owner = db.relationship('Member', backref='notifications',
foreign_keys=owner_id)
def __init__(self, owner, text, href=None):
self.text = text
self.href = href
self.owner = owner
def __repr__(self):
return f'<Notification to {self.owner.name}: {self.text} ({self.href})>'
def delete(self):
db.session.delete(self)