Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
make None default
  • Loading branch information
saschahofmann committed Feb 2, 2022
commit fd29e5147f078ae667a711fe332490b113cc1ffa
18 changes: 9 additions & 9 deletions model_clone/mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ class CloneMixin(object):
_clone_o2o_fields = [] # type: List[str]

# Excluded fields
_clone_excluded_fields = [] # type: List[str]
_clone_excluded_m2m_fields = [] # type: List[str]
_clone_excluded_m2o_or_o2m_fields = [] # type: List[str]
_clone_excluded_o2o_fields = [] # type: List[str]
_clone_excluded_fields = None # type: Optional[List[str]]
_clone_excluded_m2m_fields = None # type: Optional[List[str]]
_clone_excluded_m2o_or_o2m_fields = None # Optional[type: List[str]]
_clone_excluded_o2o_fields = None # type: Optional[List[str]]

DUPLICATE_SUFFIX = "copy" # type: str
USE_DUPLICATE_SUFFIX_FOR_NON_UNIQUE_FIELDS = False # type: bool
Expand Down Expand Up @@ -443,7 +443,7 @@ def __duplicate_o2o_fields(self, duplicate, using=None):
[
f.name in self._clone_o2o_fields
and f not in self._meta.concrete_fields,
self._clone_excluded_o2o_fields
self._clone_excluded_o2o_fields is not None
and f.name not in self._clone_excluded_o2o_fields
and f not in self._meta.concrete_fields,
]
Expand Down Expand Up @@ -477,7 +477,7 @@ def __duplicate_o2m_fields(self, duplicate, using=None):
if any(
[
f.get_accessor_name() in self._clone_m2o_or_o2m_fields,
self._clone_excluded_m2o_or_o2m_fields
self._clone_excluded_m2o_or_o2m_fields is not None
and f.get_accessor_name()
not in self._clone_excluded_m2o_or_o2m_fields,
]
Expand Down Expand Up @@ -522,7 +522,7 @@ def __duplicate_m2o_fields(self, duplicate, using=None):
if any(
[
f.name in self._clone_m2o_or_o2m_fields,
self._clone_excluded_m2o_or_o2m_fields
self._clone_excluded_m2o_or_o2m_fields is not None
and f.name not in self._clone_excluded_m2o_or_o2m_fields,
]
):
Expand Down Expand Up @@ -555,7 +555,7 @@ def __duplicate_m2m_fields(self, duplicate, using=None):
if any(
[
f.name in self._clone_m2m_fields,
self._clone_excluded_m2m_fields
self._clone_excluded_m2m_fields is not None
and f.name not in self._clone_excluded_m2m_fields,
]
):
Expand All @@ -566,7 +566,7 @@ def __duplicate_m2m_fields(self, duplicate, using=None):
if any(
[
f.get_accessor_name() in self._clone_m2m_fields,
self._clone_excluded_m2m_fields
self._clone_excluded_m2m_fields is not None
and f.get_accessor_name()
not in self._clone_excluded_m2m_fields,
]
Expand Down