def number_field_choices(field):
    """
        Given a field, returns the number of choices.
    """
    try:
        return len(field.get_flat_choices())
    except AttributeError:
        return 0