def get_choices(field):
empty_label = getattr(field.field, "<STR_LIT>", False)<EOL>needs_empty_value = False<EOL>choices = []<EOL>if hasattr(field.field, "<STR_LIT>"):<EOL><INDENT>choices = field.field._choices<EOL><DEDENT>elif hasattr(field.field, "<STR_LIT>"):<EOL><INDENT>queryset = field.field._queryset<EOL>field_name = getattr(field.field, "<STR_LIT>") or "<STR_LIT>"<EOL>choices += ((getattr(obj, field_name), str(obj)) for obj in queryset)<EOL><DEDENT>if choices and (choices[<NUM_LIT:0>][<NUM_LIT:1>] == BLANK_CHOICE_DASH[<NUM_LIT:0>][<NUM_LIT:1>] or choices[<NUM_LIT:0>][<NUM_LIT:0>]):<EOL><INDENT>needs_empty_value = True<EOL>if not choices[<NUM_LIT:0>][<NUM_LIT:0>]:<EOL><INDENT>del choices[<NUM_LIT:0>]<EOL><DEDENT><DEDENT>if empty_label == BLANK_CHOICE_DASH[<NUM_LIT:0>][<NUM_LIT:1>]:<EOL><INDENT>empty_label = None<EOL><DEDENT>if empty_label or not field.field.required:<EOL><INDENT>if needs_empty_value:<EOL><INDENT>choices.insert(<NUM_LIT:0>, ("<STR_LIT>", empty_label or BLANK_CHOICE_DASH[<NUM_LIT:0>][<NUM_LIT:1>]))<EOL><DEDENT><DEDENT>return choices<EOL>
Find choices of a field, whether it has choices or has a queryset.

Args:
        field (BoundField): Django form boundfield

Returns:
        list: List of choices