forked from Alexey/DAS_2024_1
17 lines
460 B
Python
17 lines
460 B
Python
from flask_sqlalchemy import SQLAlchemy
|
|
from datetime import datetime
|
|
|
|
db = SQLAlchemy()
|
|
|
|
class University(db.Model):
|
|
id = db.Column(db.Integer, primary_key=True)
|
|
name = db.Column(db.String(100), nullable=False)
|
|
established_at = db.Column(db.DateTime, default=datetime.utcnow)
|
|
|
|
def to_dict(self):
|
|
return {
|
|
"id": self.id,
|
|
"name": self.name,
|
|
"established_at": self.established_at.isoformat()
|
|
}
|