Skip to content
Snippets Groups Projects
Commit 63acf228 authored by Felix Schäfer's avatar Felix Schäfer :construction_worker:
Browse files

Django 4 compatibility

parent c75f2434
Branches
Tags
No related merge requests found
......@@ -20,7 +20,7 @@ class PluginApp(PluginConfig):
visible = False
version = __version__
category = "FEATURE"
compatibility = "pretix>=2.7.0"
compatibility = "pretix>=4.16.0"
def ready(self):
from . import signals # NOQA
......@@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-02-09 22:42+0100\n"
"POT-Creation-Date: 2023-02-09 23:10+0100\n"
"PO-Revision-Date: \n"
"Last-Translator: Jaakko Rinta-Filppula, Felix Schäfer\n"
"Language-Team: \n"
......@@ -19,17 +19,17 @@ msgstr ""
msgid "OIDC authentication plugin for pretix"
msgstr ""
#: pretix_oidc/models.py:8
#: pretix_oidc/models.py:9
#: pretix_oidc/templates/pretix_oidc/oidc_assignment_rules.html:17
msgid "OIDC attribute"
msgstr ""
#: pretix_oidc/models.py:9
#: pretix_oidc/models.py:12
#: pretix_oidc/templates/pretix_oidc/oidc_assignment_rules.html:18
msgid "Attribute value"
msgstr ""
#: pretix_oidc/models.py:17
#: pretix_oidc/models.py:21
msgid "Team assignment rule"
msgstr ""
......@@ -74,16 +74,16 @@ msgstr ""
msgid "Team name"
msgstr ""
#: pretix_oidc/views.py:38
#: pretix_oidc/views.py:39
msgid ""
"We cannot create your user account as a user account in this system already "
"exists with the same email address."
msgstr ""
#: pretix_oidc/views.py:103
#: pretix_oidc/views.py:104
msgid "The new assignment rule has been created."
msgstr ""
#: pretix_oidc/views.py:107
#: pretix_oidc/views.py:108
msgid "The assignment rule could not be created."
msgstr ""
......@@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-02-09 22:42+0100\n"
"POT-Creation-Date: 2023-02-09 23:10+0100\n"
"PO-Revision-Date: \n"
"Last-Translator: Jaakko Rinta-Filppula, Felix Schäfer\n"
"Language-Team: \n"
......@@ -19,17 +19,17 @@ msgstr ""
msgid "OIDC authentication plugin for pretix"
msgstr ""
#: pretix_oidc/models.py:8
#: pretix_oidc/models.py:9
#: pretix_oidc/templates/pretix_oidc/oidc_assignment_rules.html:17
msgid "OIDC attribute"
msgstr ""
#: pretix_oidc/models.py:9
#: pretix_oidc/models.py:12
#: pretix_oidc/templates/pretix_oidc/oidc_assignment_rules.html:18
msgid "Attribute value"
msgstr ""
#: pretix_oidc/models.py:17
#: pretix_oidc/models.py:21
msgid "Team assignment rule"
msgstr ""
......@@ -74,16 +74,16 @@ msgstr ""
msgid "Team name"
msgstr ""
#: pretix_oidc/views.py:38
#: pretix_oidc/views.py:39
msgid ""
"We cannot create your user account as a user account in this system already "
"exists with the same email address."
msgstr ""
#: pretix_oidc/views.py:103
#: pretix_oidc/views.py:104
msgid "The new assignment rule has been created."
msgstr ""
#: pretix_oidc/views.py:107
#: pretix_oidc/views.py:108
msgid "The assignment rule could not be created."
msgstr ""
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-02-09 22:42+0100\n"
"POT-Creation-Date: 2023-02-09 23:10+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
......@@ -25,17 +25,17 @@ msgstr ""
msgid "OIDC authentication plugin for pretix"
msgstr ""
#: pretix_oidc/models.py:8
#: pretix_oidc/models.py:9
#: pretix_oidc/templates/pretix_oidc/oidc_assignment_rules.html:17
msgid "OIDC attribute"
msgstr ""
#: pretix_oidc/models.py:9
#: pretix_oidc/models.py:12
#: pretix_oidc/templates/pretix_oidc/oidc_assignment_rules.html:18
msgid "Attribute value"
msgstr ""
#: pretix_oidc/models.py:17
#: pretix_oidc/models.py:21
msgid "Team assignment rule"
msgstr ""
......@@ -80,16 +80,16 @@ msgstr ""
msgid "Team name"
msgstr ""
#: pretix_oidc/views.py:38
#: pretix_oidc/views.py:39
msgid ""
"We cannot create your user account as a user account in this system already "
"exists with the same email address."
msgstr ""
#: pretix_oidc/views.py:103
#: pretix_oidc/views.py:104
msgid "The new assignment rule has been created."
msgstr ""
#: pretix_oidc/views.py:107
#: pretix_oidc/views.py:108
msgid "The assignment rule could not be created."
msgstr ""
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy
from pretix.base.models import Team
class OIDCTeamAssignmentRule(models.Model):
team = models.ForeignKey(Team, on_delete=models.CASCADE)
attribute = models.CharField(max_length=255, verbose_name=_("OIDC attribute"))
value = models.CharField(max_length=255, verbose_name=_("Attribute value"))
attribute = models.CharField(
max_length=255, verbose_name=gettext_lazy("OIDC attribute")
)
value = models.CharField(
max_length=255, verbose_name=gettext_lazy("Attribute value")
)
class Meta:
constraints = [
......@@ -14,4 +18,4 @@ class OIDCTeamAssignmentRule(models.Model):
fields=["team", "attribute", "value"], name="unique_rule"
)
]
verbose_name = _("Team assignment rule")
verbose_name = gettext_lazy("Team assignment rule")
from django.dispatch import receiver
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy
from pretix.control.permissions import organizer_permission_required
from pretix.control.signals import nav_organizer
......@@ -12,7 +12,7 @@ def add_team_auto_assign_to_nav_pane(sender, request, **kwargs):
navigation pane."""
return [
{
"label": _("Team assignment rules"),
"label": gettext_lazy("Team assignment rules"),
"url": reverse(
"plugins:pretix_oidc:team_assignment_rules",
kwargs={"organizer": request.organizer.slug},
......
from django.conf.urls import url
from django.urls import path
from . import views
urlpatterns = [
url(r"^oidc/callback/", views.oidc_callback, name="oidc_callback"),
url(
r"^control/organizer/(?P<organizer>[^/]+)/teams/assignment_rules$",
path("oidc/callback/", views.oidc_callback, name="oidc_callback"),
path(
"control/organizer/<str:organizer>/teams/assignment_rules/",
views.AssignmentRulesList.as_view(),
name="team_assignment_rules",
),
url(
r"^control/organizer/(?P<organizer>[^/]+)/teams/assignment_rules/add$",
path(
"control/organizer/<str:organizer>/teams/assignment_rules/add",
views.AssignmentRuleCreate.as_view(),
name="team_assignment_rules.add",
),
url(
r"^control/organizer/(?P<organizer>[^/]+)/teams/assignment_rules/(?P<pk>\d+)/delete$",
path(
"control/organizer/<str:organizer>/teams/assignment_rules/<int:pk>/delete",
views.AssignmentRuleDelete.as_view(),
name="team_assignment_rules.delete",
),
......
......@@ -5,11 +5,12 @@ from django.shortcuts import redirect
from django.urls import reverse
from django.utils.translation import gettext as _
from django.views.generic import TemplateView
from django.views.generic.edit import CreateView, DeleteView
from django.views.generic.edit import CreateView
from pretix.base.models import Team, User
from pretix.base.models.auth import EmailAddressTakenError
from pretix.control.permissions import OrganizerPermissionRequiredMixin
from pretix.control.views.auth import process_login
from pretix.helpers.compat import CompatDeleteView
from .auth import OIDCAuthBackend # NOQA
from .forms import OIDCAssignmentRuleForm
......@@ -112,5 +113,5 @@ class AssignmentRuleCreate(AssignmentRuleUpdateMixin, CreateView):
pass
class AssignmentRuleDelete(AssignmentRuleEditMixin, DeleteView):
class AssignmentRuleDelete(AssignmentRuleEditMixin, CompatDeleteView):
template_name = "pretix_oidc/oidc_assignment_rule_delete.html"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment