def formfield_for_dbfield(self, db_field, **kwargs):
        request = kwargs.pop("request", None)

        # If the field specifies choices, we don't need to look for special
        # admin widgets - we just need to use a select widget of some kind.
        if db_field.choices is not None:
            return self.formfield_for_choice_field(db_field, request, **kwargs)

        if isinstance(db_field, ListField) and isinstance(db_field.field, ReferenceField):
            return self.formfield_for_reference_listfield(db_field, request, **kwargs)

        # handle RelatedFields
        if isinstance(db_field, ReferenceField):
            # For non-raw_id fields, wrap the widget with a wrapper that adds
            # extra HTML -- the "add other" interface -- to the end of the
            # rendered output. formfield can be None if it came from a
            # OneToOneField with parent_link=True or a M2M intermediary.
            form_field = self._get_formfield(db_field, **kwargs)
            if db_field.name not in self.raw_id_fields:
                related_modeladmin = self.admin_site._registry.get(
                    db_field.document_type)
                can_add_related = bool(related_modeladmin and
                                       related_modeladmin.has_add_permission(request))
                form_field.widget = widgets.RelatedFieldWidgetWrapper(
                    form_field.widget, RelationWrapper(
                        db_field.document_type), self.admin_site,
                    can_add_related=can_add_related)
                return form_field
            elif db_field.name in self.raw_id_fields:
                kwargs['widget'] = ReferenceRawIdWidget(
                    db_field.rel, self.admin_site)
                return self._get_formfield(db_field, **kwargs)

        if isinstance(db_field, StringField):
            if db_field.max_length is None:
                kwargs = dict(
                    {'widget': widgets.AdminTextareaWidget}, **kwargs)
            else:
                kwargs = dict(
                    {'widget': widgets.AdminTextInputWidget}, **kwargs)
            return self._get_formfield(db_field, **kwargs)

        # For any other type of field, just call its formfield() method.
        return self._get_formfield(db_field, **kwargs)
This converts both colors to a specific representation
dataset/ETHPy150Open jschrewe/django-mongoadmin/mongoadmin/options.py/MongoFormFieldMixin.formfield_for_dbfield--crossover with--dataset/ETHPy150Open tomerfiliba/plumbum/plumbum/colorlib/styles.py/Style.to_representation