12345678910111213141516171819202122232425262728293031323334 |
- from flask import make_response, abort
- from flask.views import View, request
- from pycs.database.Project import Project
- from pycs.frontend.notifications.NotificationManager import NotificationManager
- class EditProjectDescription(View):
- """
- edit a projects description
- """
-
- methods = ['POST']
- def dispatch_request(self, identifier):
-
- data = request.get_json(force=True)
- if data.get('description') is None:
- return abort(400)
-
- project = Project.query.get(identifier)
- if project is None:
- return abort(404)
-
- project.description = data['description']
- project.commit()
- NotificationManager.edited("project", project.id, Project)
- return make_response()
|