Skip to content

Commit eec5f36

Browse files
committed
Deprecate ORM module
1 parent 07cde59 commit eec5f36

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

flask_mongoengine/wtf/orm.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from wtforms import fields as f
1212
from wtforms import validators
1313

14+
from flask_mongoengine.decorators import orm_deprecated
1415
from flask_mongoengine.wtf.fields import (
1516
BinaryField,
1617
DictField,
@@ -26,6 +27,7 @@
2627
)
2728

2829

30+
@orm_deprecated
2931
def converts(*args):
3032
def _inner(func):
3133
func._converter_for = frozenset(args)
@@ -35,6 +37,7 @@ def _inner(func):
3537

3638

3739
class ModelConverter(object):
40+
@orm_deprecated
3841
def __init__(self, converters=None):
3942
if not converters:
4043
converters = {}
@@ -47,6 +50,7 @@ def __init__(self, converters=None):
4750

4851
self.converters = converters
4952

53+
@orm_deprecated
5054
def _generate_convert_base_kwargs(self, field, field_args) -> dict:
5155
kwargs: dict = {
5256
"label": getattr(field, "verbose_name", field.name),
@@ -70,6 +74,7 @@ def _generate_convert_base_kwargs(self, field, field_args) -> dict:
7074

7175
return kwargs
7276

77+
@orm_deprecated
7378
def _process_convert_for_choice_fields(self, field, field_class, kwargs):
7479
kwargs["choices"] = field.choices
7580
kwargs["coerce"] = self.coerce(field_class)
@@ -79,6 +84,7 @@ def _process_convert_for_choice_fields(self, field, field_class, kwargs):
7984
return f.RadioField(**kwargs)
8085
return f.SelectField(**kwargs)
8186

87+
@orm_deprecated
8288
def convert(self, model, field, field_args):
8389
if hasattr(field, "to_form_field"):
8490
return field.to_form_field(model, field_args)
@@ -235,6 +241,7 @@ def conv_GenericReference(self, model, field, kwargs):
235241
def conv_File(self, model, field, kwargs):
236242
return f.FileField(**kwargs)
237243

244+
@orm_deprecated
238245
def coerce(self, field_type):
239246
coercions = {
240247
"IntField": int,
@@ -246,6 +253,7 @@ def coerce(self, field_type):
246253
return coercions.get(field_type, str)
247254

248255

256+
@orm_deprecated
249257
def _get_fields_names(
250258
model,
251259
only: Optional[List[str]],
@@ -269,6 +277,7 @@ def _get_fields_names(
269277
return field_names
270278

271279

280+
@orm_deprecated
272281
def model_fields(
273282
model: Type[BaseDocument],
274283
only: Optional[List[str]] = None,
@@ -300,6 +309,7 @@ def model_fields(
300309
return form_fields_dict
301310

302311

312+
@orm_deprecated
303313
def model_form(
304314
model: Type[BaseDocument],
305315
base_class: Type[ModelForm] = ModelForm,

0 commit comments

Comments
 (0)