# Path: rest/model_tools.py
# def get_object_id(instance):
#     ct = get_ct(instance)
#     config = ct.get_config()
#     if config and 'lookup' in config:
#         return getattr(instance, config['lookup'])
#     return instance.pk
# 
# Path: rest/exceptions.py
# class ImproperlyConfigured(ImproperlyConfigured):
#     pass


from rest_framework import serializers
from django.core.exceptions import ImproperlyConfigured
    from django.contrib.gis.db import models as model_fields
    from django.contrib.gis.geos import GEOSGeometry
    from django.db import models as model_fields
from django.utils import timezone
from django.core.exceptions import FieldDoesNotExist
from collections import OrderedDict
from django.conf import settings
from rest_framework.utils import model_meta
from html_json_forms.serializers import JSONFormSerializer
from .model_tools import get_object_id
from .exceptions import ImproperlyConfigured
        import json
        import json
            import pystache
        if value is None:
            return None
        if value.tzinfo:
            value = timezone.localtime(value)
        return value.strftime('%Y-%m-%d %I:%M %p')


MODEL_BOOLEAN_FIELDS = (
    model_fields.BooleanField,
    model_fields.NullBooleanField,
)


class BooleanLabelField(serializers.ReadOnlyField):
    def to_representation(self, value):
        if value is None:
            return None
        elif value:
            return 'Yes'
        else:
            return 'No'


class BlankCharField(serializers.CharField):
    def run_validation(self, data=serializers.empty):
        if self.allow_blank and data is None:
            return ''
        return super(BlankCharField, self).run_validation(data)



# Path: rest/model_tools.py
# def get_object_id(instance):
#     ct = get_ct(instance)
#     config = ct.get_config()
#     if config and 'lookup' in config:
#         return getattr(instance, config['lookup'])
#     return instance.pk
# 
# Path: rest/exceptions.py
# class ImproperlyConfigured(ImproperlyConfigured):
#     pass


# Path: rest/serializers.py
from rest_framework import serializers
from django.core.exceptions import ImproperlyConfigured
    from django.contrib.gis.db import models as model_fields
    from django.contrib.gis.geos import GEOSGeometry
    from django.db import models as model_fields
from django.utils import timezone
from django.core.exceptions import FieldDoesNotExist
from collections import OrderedDict
from django.conf import settings
from rest_framework.utils import model_meta
from html_json_forms.serializers import JSONFormSerializer
from .model_tools import get_object_id
from .exceptions import ImproperlyConfigured
        import json
        import json
            import pystache

        if value is None:
            return None
        if value.tzinfo:
            value = timezone.localtime(value)
        return value.strftime('%Y-%m-%d %I:%M %p')


MODEL_BOOLEAN_FIELDS = (
    model_fields.BooleanField,
    model_fields.NullBooleanField,
)


class BooleanLabelField(serializers.ReadOnlyField):
    def to_representation(self, value):
        if value is None:
            return None
        elif value:
            return 'Yes'
        else:
            return 'No'


class BlankCharField(serializers.CharField):
    def run_validation(self, data=serializers.empty):
        if self.allow_blank and data is None:
            return ''
        return super(BlankCharField, self).run_validation(data)



def is_empty_or_url(data):