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 EditProjectName(View):
- """
- edit a projects name
- """
- # pylint: disable=arguments-differ
- methods = ['POST']
- def dispatch_request(self, identifier):
- # extract request data
- data = request.get_json(force=True)
- if data.get('name') is None:
- return abort(400)
- # find project
- project = Project.query.get(identifier)
- if project is None:
- return abort(404)
- # set name
- project.name = data['name']
- project.commit()
- NotificationManager.edited("project", project.id, Project)
- return make_response()
|