From d2d193e58ff0aec20e852e2e3f3f60cf8d15b91c Mon Sep 17 00:00:00 2001 From: Roland Haroutiounian Date: Wed, 23 Sep 2015 14:47:06 +0200 Subject: [PATCH] [#50] Added the management of "integer" AND "int" in EmField (in the get_field_class method) --- EditorialModel/fields.py | 6 +++++- EditorialModel/fieldtypes/int.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/EditorialModel/fields.py b/EditorialModel/fields.py index e83da5d..1f469df 100644 --- a/EditorialModel/fields.py +++ b/EditorialModel/fields.py @@ -57,7 +57,11 @@ class EmField(EmComponent): # @throw When not found # @see EmField::fieldtypes() def get_field_class(ftype, **kwargs): - ftype_module = importlib.import_module('EditorialModel.fieldtypes.%s'%ftype) + if ftype == 'integer': + ftype_module = importlib.import_module('EditorialModel.fieldtypes.int') + else: + ftype_module = importlib.import_module('EditorialModel.fieldtypes.%s'%ftype) + return ftype_module.fclass @staticmethod diff --git a/EditorialModel/fieldtypes/int.py b/EditorialModel/fieldtypes/int.py index f664334..efb2a3b 100644 --- a/EditorialModel/fieldtypes/int.py +++ b/EditorialModel/fieldtypes/int.py @@ -10,6 +10,6 @@ class EmFieldInt(EmField): help = 'Basic integer field' def __init__(self, **kwargs): - super(EmFieldChar, self).__init__(**kwargs) + super(EmFieldInt, self).__init__(**kwargs) fclass=EmFieldInt