-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
3 additions
and
304 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,9 @@ | ||
from django.contrib.sites.models import Site | ||
|
||
from django_setup_configuration.fields import DjangoModelRef | ||
from django_setup_configuration.models import ConfigurationModel | ||
from pydantic import Field | ||
from vng_api_common.authorizations.models import AuthorizationsConfig | ||
|
||
|
||
class AuthorizationsConfigModel(ConfigurationModel): | ||
authorizations_api_service_identifier: str = DjangoModelRef( | ||
AuthorizationsConfig, "authorizations_api_service" | ||
) | ||
|
||
|
||
class SiteConfigModel(ConfigurationModel): | ||
organization: str = Field() | ||
"""The name of the organization that owns this Open Notificaties instance""" | ||
|
||
class Meta: | ||
django_model_refs = {Site: ("domain",)} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
src/nrc/tests/setup_configuration/files/setup_config_sites.yaml
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 0 additions & 51 deletions
51
src/nrc/tests/setup_configuration/test_site_configuration.py
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +0,0 @@ | ||
from django.conf import settings | ||
from django.http import HttpRequest | ||
|
||
from furl import furl | ||
|
||
|
||
def get_domain() -> str: | ||
""" | ||
Obtain the domain/netloc of Open Notificaties according to settings or configuration. | ||
""" | ||
from django.contrib.sites.models import Site | ||
|
||
if settings.OPENNOTIFICATIES_DOMAIN: | ||
return settings.OPENNOTIFICATIES_DOMAIN | ||
|
||
return Site.objects.get_current().domain | ||
|
||
|
||
def build_absolute_url(path: str, request: HttpRequest | None = None) -> str: | ||
if request is not None: | ||
return request.build_absolute_uri(path) | ||
|
||
domain = get_domain() | ||
_furl = furl( | ||
scheme="https" if settings.IS_HTTPS else "http", | ||
netloc=domain, | ||
path=path, | ||
) | ||
return _furl.url | ||