def __init__(self, choices, order_by="display"):
        self._read_only = False

        # Initialize parent dict with the choices provided by the user
        super(Choices, self).__init__(choices)
        self._choices = _choices = []
        self._order_by = order_by

        if not choices:
            return
        # choice_ids are used to validate an id is not used more than once
        choice_ids = set()

        for choice_code, choice_options in self.items():
            if not issubclass(choice_options.__class__, dict):
                # in case passing {"insect": 1} assume 1 is the id
                choice_options = {"id": choice_options}
                self[choice_code] = choice_options

            choice_id = choice_options["id"]
            choice_ids.add(choice_id)
            # End of validation
            if "display" not in choice_options:
                choice_options["display"] = choice_code.replace("_", " ").capitalize()
            display = choice_options["display"]
            _choices.append((choice_id, _(display)))
        # Sort by display name
        if order_by == "display":
            _choices.sort(key=lambda x: x[1])
        elif order_by == "id":
            _choices.sort(key=lambda x: x[0])

        self._read_only = True
The resource name for this object.
dataset/ETHPy150Open rewardz/django_model_helpers/model_helpers.py/Choices.__init__--crossover with--dataset/ETHPy150Open mozilla/moztrap/tests/model/environments/api/test_profile_resource.py/ProfileResourceTest.resource_name