Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use absolute filter #1

Merged
merged 1 commit into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions ephios_testplugin/notification.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
from urllib.parse import urljoin

from django.conf import settings
from django.urls import reverse
from django.utils.translation import gettext_lazy as _
from ephios.core.models import Notification
from ephios.core.services.notifications.types import AbstractNotificationHandler
from ephios.core.templatetags.settings_extras import make_absolute


class TestNotification(AbstractNotificationHandler):
Expand Down Expand Up @@ -32,8 +30,7 @@ def get_actions(cls, notification):
return [
(
_("Look at test notification"),
urljoin(
settings.GET_SITE_URL(), reverse("testplugin:test_notifications")
make_absolute( reverse("testplugin:test_notifications")
),
)
]
8 changes: 5 additions & 3 deletions ephios_testplugin/views.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import io
import logging
from email import generator as email_generator
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from urllib.parse import urljoin

from django import forms
from django.conf import settings
Expand All @@ -21,10 +21,12 @@
installed_notification_types,
notification_type_from_slug,
)
from ephios.core.templatetags.settings_extras import make_absolute
from ephios.extra.mixins import StaffRequiredMixin

from ephios_testplugin.notification import TestNotification

logger = logging.getLogger(__name__)

class TestIndexView(StaffRequiredMixin, TemplateView):
template_name = "testplugin/test_index.html"
Expand Down Expand Up @@ -71,8 +73,7 @@ def rendered_email_context(self, notification_type):
"token": default_token_generator.make_token(self.request.user),
"event_id": Event.objects.first().id,
"participation_id": LocalParticipation.objects.first().id,
"disposition_url": urljoin(
settings.GET_SITE_URL(),
"disposition_url": make_absolute(
reverse(
"core:shift_disposition",
kwargs={"pk": LocalParticipation.objects.first().shift.pk},
Expand Down Expand Up @@ -116,6 +117,7 @@ def rendered_email_context(self, notification_type):
plaintext=notification_type.as_plaintext(notification),
)
except Exception as e:
logger.exception("Error rendering email template")
return {
"email": f"Error: {e}",
}
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "ephios-testplugin"
version = "1.2.2"
version = "1.2.3"
description = "A plugin to test and develop ephios"
authors = ["Felix Rindt <[email protected]>"]
license = "MIT"
Expand Down