File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 66from django .db .models .query import QuerySet
77from ninja_extra .shortcuts import get_object_or_none
88
9+ from easy .controller .meta_conf import ModelMetaConfig
910from easy .exception import BaseAPIException
1011
1112logger = logging .getLogger (__name__ )
@@ -47,10 +48,15 @@ def crud_filter_exclude(self, **kwargs: Any) -> QuerySet:
4748class DjangoOrmModel (CrudModel ):
4849 def __init__ (self , model : Type [models .Model ]):
4950 self .model = model
51+ config = ModelMetaConfig ()
52+ exclude_list = config .get_final_excluded_list (self .model ())
5053 self .m2m_fields_list : List = list (
5154 _field
5255 for _field in self .model ._meta .get_fields (include_hidden = True )
53- if isinstance (_field , models .ManyToManyField )
56+ if (
57+ isinstance (_field , models .ManyToManyField )
58+ and ((_field not in exclude_list ) if exclude_list else True )
59+ )
5460 )
5561 super ().__init__ (model )
5662
You can’t perform that action at this time.
0 commit comments