Add Importer.fields_active()
convenience method
This commit is contained in:
parent
e5425274a4
commit
8ebb667976
|
@ -94,6 +94,16 @@ class Importer(object):
|
|||
self.model_name = self.model_class.__name__
|
||||
self._setup(**kwargs)
|
||||
|
||||
def fields_active(self, fields):
|
||||
"""
|
||||
Convenience method to check if any of the given fields are currently
|
||||
"active" for the importer. Returns ``True`` or ``False``.
|
||||
"""
|
||||
for field in fields:
|
||||
if field in self.fields:
|
||||
return True
|
||||
return False
|
||||
|
||||
def _setup(self, **kwargs):
|
||||
self.create = kwargs.pop('create', self.allow_create) and self.allow_create
|
||||
self.update = kwargs.pop('update', self.allow_update) and self.allow_update
|
||||
|
|
Loading…
Reference in a new issue