@classmethod
def get_available_fields(cls, model, db_fields_only=False):
    """
        Returns a list of all the fields that can be used in the API for the
        specified model class.

        Setting db_fields_only to True will remove all fields that do not have
        an underlying column in the database (eg, type/detail_url and any custom
        fields that are callables)
        """
    fields = cls.get_body_fields_names(model) + cls.get_meta_fields_names(model
        )
    if db_fields_only:
        database_fields = set()
        for field in model._meta.get_fields():
            database_fields.add(field.name)
            if hasattr(field, 'attname'):
                database_fields.add(field.attname)
        fields = [field for field in fields if field in database_fields]
    return fields
