1👍
You can work with a condition expression [Django-doc]:
from django.db.models import Case, IntegerField, Value, When
Project.objects.alias(
color_order=Case(
*[When(color=color, then=Value(i)) for i, color in enumerate(COLORS)],
output_field=IntegerField()
)
).order_by('color_order')
Source:stackexchange.com