コード例 #1
0
    def api_field_from_django_field(cls, f, default=fields.CharField):
        """
        Returns the field type that would likely be associated with each
        Django type.
        """
        result = default
        internal_type = f.get_internal_type()

        if internal_type in ('JSONField'):
            return JSONApiField
        else:
            return ModelResource.api_field_from_django_field(f, default)
コード例 #2
0
    def api_field_from_django_field(cls, f, default=fields.CharField):
        """
        Returns the field type that would likely be associated with each
        Django type.
        """
        result = default
        internal_type = f.get_internal_type()

        if internal_type in ('JSONField'):
            return JSONApiField
        else:
            return ModelResource.api_field_from_django_field(f, default)
コード例 #3
0
ファイル: api.py プロジェクト: nnseva/django-tastycake
 def api_field_from_django_field(cls, f, default=fields.CharField):
     # TODO: extensions
     r = ModelResource.api_field_from_django_field(f, default=default)
     return r
コード例 #4
0
 def test_model_resource_correct_association(self):
     api_field = ModelResource.api_field_from_django_field(models.DecimalField())
     self.assertEqual(api_field, DecimalField)
コード例 #5
0
 def test_model_resource_correct_association(self):
     api_field = ModelResource.api_field_from_django_field(
         models.DecimalField())
     self.assertEqual(api_field, DecimalField)
コード例 #6
0
ファイル: api.py プロジェクト: NightBrownie/ebank-client
 def api_field_from_django_field(cls, f, **kwargs):
     internal_type = f.get_internal_type()
     if internal_type == "BigIntegerField":
         return fields.IntegerField
     return ModelResource.api_field_from_django_field(f, **kwargs)