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
3131 from flask import Flask
3232 from flask_combo_jsonapi import Api, ResourceDetail, ResourceList
3333 from flask_sqlalchemy import SQLAlchemy
34+ from marshmallow import pre_load
3435 from marshmallow_jsonapi.flask import Schema
3536 from marshmallow_jsonapi import fields
3637
@@ -62,18 +63,18 @@ A minimal API
6263 id = fields.Integer(as_string = True , dump_only = True )
6364 name = fields.String()
6465
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
7778
7879 # Create resource managers
7980 class PersonList (ResourceList ):
Original file line number Diff line number Diff line change 11from flask import Flask
2- from marshmallow import pre_load
3-
42from flask_combo_jsonapi import Api , ResourceDetail , ResourceList
53from flask_sqlalchemy import SQLAlchemy
4+ from marshmallow import pre_load
65from marshmallow_jsonapi .flask import Schema
76from marshmallow_jsonapi import fields
87
You can’t perform that action at this time.
0 commit comments