mirror of
https://github.com/spiral-project/ihatemoney.git
synced 2025-04-29 09:52:36 +02:00
Fixed public project creation flag in API creation #246
This commit is contained in:
parent
3085221e03
commit
8beb8c3ccf
1 changed files with 3 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from flask import Blueprint, request
|
from flask import Blueprint, request, current_app
|
||||||
from flask_restful import Resource, Api, abort
|
from flask_restful import Resource, Api, abort
|
||||||
from flask_cors import CORS
|
from flask_cors import CORS
|
||||||
from wtforms.fields.core import BooleanField
|
from wtforms.fields.core import BooleanField
|
||||||
|
@ -39,7 +39,7 @@ def need_auth(f):
|
||||||
class ProjectsHandler(Resource):
|
class ProjectsHandler(Resource):
|
||||||
def post(self):
|
def post(self):
|
||||||
form = ProjectForm(meta={'csrf': False})
|
form = ProjectForm(meta={'csrf': False})
|
||||||
if form.validate():
|
if form.validate() and current_app.config.get("ALLOW_PUBLIC_PROJECT_CREATION"):
|
||||||
project = form.save()
|
project = form.save()
|
||||||
db.session.add(project)
|
db.session.add(project)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
@ -60,7 +60,7 @@ class ProjectHandler(Resource):
|
||||||
|
|
||||||
def put(self, project):
|
def put(self, project):
|
||||||
form = EditProjectForm(meta={'csrf': False})
|
form = EditProjectForm(meta={'csrf': False})
|
||||||
if form.validate():
|
if form.validate() and current_app.config.get("ALLOW_PUBLIC_PROJECT_CREATION"):
|
||||||
form.update(project)
|
form.update(project)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
return "UPDATED"
|
return "UPDATED"
|
||||||
|
|
Loading…
Reference in a new issue