'Returns the correct field type, instantiated with applicable settings'

def get_django_field(self):

    settings = [(s.name, s.value) for s in self.settings.all()]
    settings = dict(settings)
    if (u'primary_key' in settings):
        settings[u'primary_key'] = bool(settings[u'primary_key'])
    if (u'blank' in settings):
        settings[u'blank'] = bool(settings[u'blank'])
    if (u'null' in settings):
        settings[u'null'] = bool(settings[u'null'])
    if (u'max_length' in settings):
        settings[u'max_length'] = int(settings[u'max_length'])
    field_type = getattr(models, self.type)
    return field_type(**settings)
