Add files via upload
This commit is contained in:
@@ -8,6 +8,7 @@ class Project(db.Model):
|
||||
name = db.Column(db.String(200), nullable=False)
|
||||
color = db.Column(db.String(7), nullable=False, default='#C9A84C')
|
||||
description = db.Column(db.Text)
|
||||
drive_url = db.Column(db.String(500))
|
||||
created_at = db.Column(db.DateTime, default=datetime.utcnow)
|
||||
|
||||
deliverables = db.relationship(
|
||||
@@ -21,6 +22,7 @@ class Project(db.Model):
|
||||
'name': self.name,
|
||||
'color': self.color,
|
||||
'description': self.description,
|
||||
'drive_url': self.drive_url,
|
||||
'created_at': self.created_at.isoformat() if self.created_at else None,
|
||||
}
|
||||
if include_deliverables:
|
||||
|
||||
@@ -22,6 +22,7 @@ def create_project():
|
||||
name=data['name'],
|
||||
color=data.get('color', '#C9A84C'),
|
||||
description=data.get('description', ''),
|
||||
drive_url=data.get('drive_url', ''),
|
||||
)
|
||||
db.session.add(project)
|
||||
db.session.flush()
|
||||
@@ -40,7 +41,7 @@ def create_project():
|
||||
def update_project(id):
|
||||
project = Project.query.get_or_404(id)
|
||||
data = request.get_json()
|
||||
for field in ('name', 'color', 'description'):
|
||||
for field in ('name', 'color', 'description', 'drive_url'):
|
||||
if field in data:
|
||||
setattr(project, field, data[field])
|
||||
db.session.commit()
|
||||
|
||||
Reference in New Issue
Block a user