File tree Expand file tree Collapse file tree 2 files changed +14
-14
lines changed Expand file tree Collapse file tree 2 files changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ A minimal API
31
31
from flask import Flask
32
32
from flask_combo_jsonapi import Api, ResourceDetail, ResourceList
33
33
from flask_sqlalchemy import SQLAlchemy
34
+ from marshmallow import pre_load
34
35
from marshmallow_jsonapi.flask import Schema
35
36
from marshmallow_jsonapi import fields
36
37
@@ -62,18 +63,18 @@ A minimal API
62
63
id = fields.Integer(as_string = True , dump_only = True )
63
64
name = fields.String()
64
65
65
- @pre_load
66
- def remove_id_before_deserializing (self , data , ** kwargs ):
67
- """
68
- We don't want to allow editing ID on POST / PATCH
69
-
70
- Related issues:
71
- https://github.com/AdCombo/flask-combo-jsonapi/issues/34
72
- https://github.com/miLibris/flask-rest-jsonapi/issues/193
73
- """
74
- if ' id' in data:
75
- del data[' id' ]
76
- return data
66
+ @pre_load
67
+ def remove_id_before_deserializing (self , data , ** kwargs ):
68
+ """
69
+ We don't want to allow editing ID on POST / PATCH
70
+
71
+ Related issues:
72
+ https://github.com/AdCombo/flask-combo-jsonapi/issues/34
73
+ https://github.com/miLibris/flask-rest-jsonapi/issues/193
74
+ """
75
+ if ' id' in data:
76
+ del data[' id' ]
77
+ return data
77
78
78
79
# Create resource managers
79
80
class PersonList (ResourceList ):
Original file line number Diff line number Diff line change 1
1
from flask import Flask
2
- from marshmallow import pre_load
3
-
4
2
from flask_combo_jsonapi import Api , ResourceDetail , ResourceList
5
3
from flask_sqlalchemy import SQLAlchemy
4
+ from marshmallow import pre_load
6
5
from marshmallow_jsonapi .flask import Schema
7
6
from marshmallow_jsonapi import fields
8
7
You can’t perform that action at this time.
0 commit comments