names: Sort domains by priority of their domain types

- First of the list is the most important one and may be used as "primary"
domain in apps.

- Change the return type of DomainName.list() from set to list so that order can
be preserved. Update all users of the API accordingly. Add type hints to all the
methods using this API to catch any errors.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa authored and James Valleroy committed 2025-02-16 10:45:01 -05:00
1 parent 045b336a9b
commit aac12f4391
18 files changed
+73 -54

No files matched your search

+2 -2
View File
@@ -7,14 +7,14 @@ import copy
import json
from django.core.serializers.json import DjangoJSONEncoder
from django.http import HttpResponse
from django.http import HttpRequest, HttpResponse
from django.templatetags.static import static
from plinth import frontpage
from plinth.modules import names
def access_info(request, **kwargs):
def access_info(request: HttpRequest, **kwargs) -> HttpResponse:
"""API view to return a list of domains and types."""
domains = [{
'domain': domain.name,