Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • kif/pretix-public-registrations
1 result
Show changes
Showing
with 215 additions and 89 deletions
...@@ -9,14 +9,6 @@ cache: ...@@ -9,14 +9,6 @@ cache:
paths: paths:
- .cache - .cache
docformatter:
stage: linting
image: python:3
before_script:
- pip3 install -U pip docformatter
script:
- docformatter --check -r .
black: black:
stage: linting stage: linting
image: python:3 image: python:3
...@@ -40,3 +32,11 @@ flake8: ...@@ -40,3 +32,11 @@ flake8:
- pip3 install -U pip flake8 - pip3 install -U pip flake8
script: script:
- flake8 . - flake8 .
check-manifest:
stage: linting
image: python:3
before_script:
- pip3 install -U pip check-manifest
script:
- check-manifest .
...@@ -10,7 +10,6 @@ fi ...@@ -10,7 +10,6 @@ fi
echo "#!/bin/sh" >> $GIT_DIR/hooks/pre-commit echo "#!/bin/sh" >> $GIT_DIR/hooks/pre-commit
echo "set -e" >> $GIT_DIR/hooks/pre-commit echo "set -e" >> $GIT_DIR/hooks/pre-commit
echo "source $VENV_ACTIVATE" >> $GIT_DIR/hooks/pre-commit echo "source $VENV_ACTIVATE" >> $GIT_DIR/hooks/pre-commit
echo "docformatter --check -r ." >> $GIT_DIR/hooks/pre-commit
echo "black --check ." >> $GIT_DIR/hooks/pre-commit echo "black --check ." >> $GIT_DIR/hooks/pre-commit
echo "isort -c ." >> $GIT_DIR/hooks/pre-commit echo "isort -c ." >> $GIT_DIR/hooks/pre-commit
echo "flake8 ." >> $GIT_DIR/hooks/pre-commit echo "flake8 ." >> $GIT_DIR/hooks/pre-commit
......
MIT License MIT License
Copyright (c) 2019-2020 Felix Schäfer, Dominik Weitz Copyright (c) 2019-2023 Felix Schäfer, Dominik Weitz
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
......
recursive-include pretix_public_registrations/static * recursive-include pretix_public_registrations/static *
recursive-include pretix_public_registrations/templates * recursive-include pretix_public_registrations/templates *
recursive-include pretix_public_registrations/locale * recursive-include pretix_public_registrations/locale *
include LICENSE
exclude .gitlab-ci.yml
...@@ -3,30 +3,48 @@ Pretix public registrations ...@@ -3,30 +3,48 @@ Pretix public registrations
This is a plugin for `pretix`_. This is a plugin for `pretix`_.
This plugin will give the option to attendees of an event to mark their registration as public. Public registrations
will be shown along their answers to questions marked as public by the organizers on a world-readable page.
Development setup Development setup
----------------- -----------------
1. Make sure that you have a working `pretix development setup`_. 1. Make sure that you have a working `pretix development setup`_.
2. Clone this repository, eg to ``local/pretix-public-registrations``. 2. Clone this repository.
3. Activate the virtual environment you use for pretix development. 3. Activate the virtual environment you use for pretix development.
4. Execute ``python setup.py develop`` within this directory to register this 4. Execute ``python setup.py develop`` within this directory to register this application with pretix's plugin registry.
application with pretix's plugin registry.
5. Execute ``make`` within this directory to compile translations. 5. Execute ``make`` within this directory to compile translations.
6. Restart your local pretix server. You can now use the plugin from this 6. Restart your local pretix server. You can now use the plugin from this repository for your events by enabling it in
repository for your events by enabling it in the 'plugins' tab in the the 'plugins' tab in the settings.
settings.
This plugin has CI set up to enforce a few code style rules. To check locally, you need these packages installed::
pip install flake8 isort black
To check your plugin for rule violations, run::
black --check .
isort -c .
flake8 .
You can auto-fix some of these issues by running::
isort .
black .
To automatically check for these issues before you commit, you can run ``.install-hooks``.
License License
------- -------
Copyright 2019-2020 Felix Schäfer, Dominik Weitz Copyright 2019-2023 Felix Schäfer, Dominik Weitz
Released under the terms of the MIT License Released under the terms of the MIT License
......
from django.utils.translation import gettext_lazy as _ __version__ = "1.5.0"
try:
from pretix.base.plugins import PluginConfig
except ImportError:
raise RuntimeError("Please use pretix 2.7 or above to run this plugin!")
__version__ = "1.4.0"
class PluginApp(PluginConfig):
name = "pretix_public_registrations"
verbose_name = "Pretix public registrations"
class PretixPluginMeta:
name = _("Pretix public registrations")
author = "Felix Schäfer, Dominik Weitz"
description = _(
"This plugin will give the option to attendees of an event to mark their registration as public. "
"Public registrations will be shown along their answers to questions marked as public by the organizers on a world-readable page."
)
visible = True
version = __version__
category = "FEATURE"
compatibility = "pretix>=2.7.0"
def ready(self):
from . import signals # NOQA
default_app_config = "pretix_public_registrations.PluginApp"
from django.utils.translation import gettext_lazy
from . import __version__
try:
from pretix.base.plugins import PluginConfig
except ImportError:
raise RuntimeError("Please use pretix 2.7 or above to run this plugin!")
class PluginApp(PluginConfig):
name = "pretix_public_registrations"
verbose_name = "Pretix public registrations"
class PretixPluginMeta:
name = gettext_lazy("Pretix public registrations")
author = "Felix Schäfer, Dominik Weitz"
description = gettext_lazy(
"This plugin will give the option to attendees of an event to mark their registration as public. "
"Public registrations will be shown along their answers to questions marked as public by the organizers on "
"a world-readable page."
)
visible = True
version = __version__
category = "FEATURE"
compatibility = "pretix>=2.7.0"
def ready(self):
from . import signals # NOQA
...@@ -3,12 +3,12 @@ from django.utils.translation import gettext_lazy as _ ...@@ -3,12 +3,12 @@ from django.utils.translation import gettext_lazy as _
from pretix.base.forms import SettingsForm from pretix.base.forms import SettingsForm
class PublicRegistrationsForm(SettingsForm): class PublicRegistrationsSettingsForm(SettingsForm):
public_registrations_items = forms.MultipleChoiceField( public_registrations_items = forms.MultipleChoiceField(
widget=forms.CheckboxSelectMultiple( widget=forms.CheckboxSelectMultiple(
attrs={"class": "scrolling-multiple-choice"} attrs={"class": "scrolling-multiple-choice"}
), ),
label=_("Show public registrations for"), label=_("Display public registrations for"),
required=True, required=True,
choices=[], choices=[],
) )
...@@ -16,16 +16,16 @@ class PublicRegistrationsForm(SettingsForm): ...@@ -16,16 +16,16 @@ class PublicRegistrationsForm(SettingsForm):
widget=forms.CheckboxSelectMultiple( widget=forms.CheckboxSelectMultiple(
attrs={"class": "scrolling-multiple-choice"} attrs={"class": "scrolling-multiple-choice"}
), ),
label=_("Publicly show answers for"), label=_("Publicly display answers for"),
required=True, required=True,
choices=[], choices=[],
) )
public_registrations_show_attendee_name = forms.BooleanField( public_registrations_show_attendee_name = forms.BooleanField(
label=_("Show attendee name"), label=_("Display attendee name"),
required=False, required=False,
) )
public_registrations_show_item_name = forms.BooleanField( public_registrations_show_item_name = forms.BooleanField(
label=_("Show product name"), label=_("Display product name"),
required=False, required=False,
) )
......
...@@ -2,7 +2,7 @@ msgid "" ...@@ -2,7 +2,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-02-23 17:37+0100\n" "POT-Creation-Date: 2023-02-06 20:40+0100\n"
"PO-Revision-Date: \n" "PO-Revision-Date: \n"
"Last-Translator: Felix Schäfer\n" "Last-Translator: Felix Schäfer\n"
"Language-Team: \n" "Language-Team: \n"
...@@ -10,15 +10,15 @@ msgstr "" ...@@ -10,15 +10,15 @@ msgstr ""
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.3\n" "X-Generator: Poedit 3.2.2\n"
"X-Poedit-Basepath: ../../..\n" "X-Poedit-Basepath: ../../..\n"
"X-Poedit-SearchPath-0: .\n" "X-Poedit-SearchPath-0: .\n"
#: __init__.py:13 #: pretix_public_registrations/__init__.py:16
msgid "Pretix public registrations" msgid "Pretix public registrations"
msgstr "" msgstr ""
#: __init__.py:15 #: pretix_public_registrations/__init__.py:19
msgid "" msgid ""
"This plugin will give the option to attendees of an event to mark their " "This plugin will give the option to attendees of an event to mark their "
"registration as public. Public registrations will be shown along their " "registration as public. Public registrations will be shown along their "
...@@ -26,35 +26,37 @@ msgid "" ...@@ -26,35 +26,37 @@ msgid ""
"page." "page."
msgstr "" msgstr ""
#: forms.py:11 #: pretix_public_registrations/forms.py:11
msgid "Show public registrations for" msgid "Display public registrations for"
msgstr "Öffentliche Anmeldung für folgende Produkte anzeigen" msgstr "Öffentliche Anmeldung für folgende Produkte anzeigen"
#: forms.py:19 #: pretix_public_registrations/forms.py:19
msgid "Publicly show answers for" msgid "Publicly display answers for"
msgstr "Öffentlich Antworten auf folgende Fragen anzeigen" msgstr "Öffentlich Antworten auf folgende Fragen anzeigen"
#: forms.py:24 #: pretix_public_registrations/forms.py:24
msgid "Show attendee name" msgid "Display attendee name"
msgstr "Teilnehmername anzeigen" msgstr "Teilnehmendenname anzeigen"
#: forms.py:28 #: pretix_public_registrations/forms.py:28
msgid "Show product name" msgid "Display product name"
msgstr "Produktname anzeigen" msgstr "Produktname anzeigen"
#: signals.py:43 signals.py:73 #: pretix_public_registrations/signals.py:44
#: pretix_public_registrations/signals.py:81
msgid "Product" msgid "Product"
msgstr "" msgstr ""
#: signals.py:45 signals.py:75 #: pretix_public_registrations/signals.py:49
#: pretix_public_registrations/signals.py:86
msgid "Name" msgid "Name"
msgstr "" msgstr ""
#: signals.py:50 #: pretix_public_registrations/signals.py:57
msgid "Public registration" msgid "Public registration"
msgstr "Öffentliche Anmeldung" msgstr "Öffentliche Anmeldung"
#: signals.py:53 #: pretix_public_registrations/signals.py:60
#, python-format #, python-format
msgid "" msgid ""
"A gravatar image based on a hash of your e-mail address as well as the " "A gravatar image based on a hash of your e-mail address as well as the "
...@@ -63,19 +65,24 @@ msgstr "" ...@@ -63,19 +65,24 @@ msgstr ""
"Ein Gravatar-Bild basierend auf einem Hash deiner E-Mailadresse, sowie die " "Ein Gravatar-Bild basierend auf einem Hash deiner E-Mailadresse, sowie die "
"Antworten auf folgende Fragen werden öffentlich angezeigt: %(qlist)s" "Antworten auf folgende Fragen werden öffentlich angezeigt: %(qlist)s"
#: signals.py:128 #: pretix_public_registrations/signals.py:154
#: pretix_public_registrations/templates/pretix_public_registrations/front_page.html:3
#: pretix_public_registrations/templates/pretix_public_registrations/settings.html:6
msgid "Public registrations" msgid "Public registrations"
msgstr "Öffentliche Anmeldungen" msgstr "Öffentliche Anmeldungen"
#: templates/pretix_public_registrations/front_page.html:7 #: pretix_public_registrations/templates/pretix_public_registrations/front_page.html:7
msgid "No public registrations yet." msgid "No public registrations yet."
msgstr "Noch keine öffentlichen Anmeldungen." msgstr "Noch keine öffentlichen Anmeldungen."
#: templates/pretix_public_registrations/settings.html:4 #: pretix_public_registrations/templates/pretix_public_registrations/settings.html:4
#: templates/pretix_public_registrations/settings.html:6
msgid "Public registrations settings" msgid "Public registrations settings"
msgstr "Einstellungen für öffentliche Anmeldungen" msgstr "Einstellungen für öffentliche Anmeldungen"
#: templates/pretix_public_registrations/settings.html:15 #: pretix_public_registrations/templates/pretix_public_registrations/settings.html:11
msgid "Display"
msgstr "Anzeige"
#: pretix_public_registrations/templates/pretix_public_registrations/settings.html:16
msgid "Save" msgid "Save"
msgstr "" msgstr ""
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-02-06 20:40+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"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: pretix_public_registrations/__init__.py:16
msgid "Pretix public registrations"
msgstr ""
#: pretix_public_registrations/__init__.py:19
msgid ""
"This plugin will give the option to attendees of an event to mark their "
"registration as public. Public registrations will be shown along their "
"answers to questions marked as public by the organizers on a world-readable "
"page."
msgstr ""
#: pretix_public_registrations/forms.py:11
msgid "Display public registrations for"
msgstr ""
#: pretix_public_registrations/forms.py:19
msgid "Publicly display answers for"
msgstr ""
#: pretix_public_registrations/forms.py:24
msgid "Display attendee name"
msgstr ""
#: pretix_public_registrations/forms.py:28
msgid "Display product name"
msgstr ""
#: pretix_public_registrations/signals.py:44
#: pretix_public_registrations/signals.py:81
msgid "Product"
msgstr ""
#: pretix_public_registrations/signals.py:49
#: pretix_public_registrations/signals.py:86
msgid "Name"
msgstr ""
#: pretix_public_registrations/signals.py:57
msgid "Public registration"
msgstr ""
#: pretix_public_registrations/signals.py:60
#, python-format
msgid ""
"A gravatar image based on a hash of your e-mail address as well as the "
"answers to the following questions will be publicly shown: %(qlist)s"
msgstr ""
#: pretix_public_registrations/signals.py:154
#: pretix_public_registrations/templates/pretix_public_registrations/front_page.html:3
#: pretix_public_registrations/templates/pretix_public_registrations/settings.html:6
msgid "Public registrations"
msgstr ""
#: pretix_public_registrations/templates/pretix_public_registrations/front_page.html:7
msgid "No public registrations yet."
msgstr ""
#: pretix_public_registrations/templates/pretix_public_registrations/settings.html:4
msgid "Public registrations settings"
msgstr ""
#: pretix_public_registrations/templates/pretix_public_registrations/settings.html:11
msgid "Display"
msgstr ""
#: pretix_public_registrations/templates/pretix_public_registrations/settings.html:16
msgid "Save"
msgstr ""
...@@ -26,11 +26,10 @@ def add_public_registrations_html_head(sender, request=None, **kwargs): ...@@ -26,11 +26,10 @@ def add_public_registrations_html_head(sender, request=None, **kwargs):
url = resolve(request.path_info) url = resolve(request.path_info)
if "event.index" not in url.url_name: if "event.index" not in url.url_name:
return "" return ""
cached = sender.cache.get("public_registrations_html_head") return sender.cache.get_or_set(
if cached is None: "public_registrations_html_head",
cached = get_template("pretix_public_registrations/head.html").render() get_template("pretix_public_registrations/head.html").render(),
sender.cache.set("public_registrations_html_head", cached) )
return cached
@receiver(question_form_fields, dispatch_uid="public_registration_question") @receiver(question_form_fields, dispatch_uid="public_registration_question")
...@@ -148,7 +147,7 @@ def add_public_registrations_csp_headers(sender, request=None, response=None, ** ...@@ -148,7 +147,7 @@ def add_public_registrations_csp_headers(sender, request=None, response=None, **
@receiver(signal=nav_event_settings, dispatch_uid="public_registrations_nav_settings") @receiver(signal=nav_event_settings, dispatch_uid="public_registrations_nav_settings")
def navbar_settings(sender, request=None, **kwargs): def navbar_settings(sender, request, **kwargs):
url = resolve(request.path_info) url = resolve(request.path_info)
return [ return [
{ {
......
...@@ -3,11 +3,12 @@ ...@@ -3,11 +3,12 @@
{% load bootstrap3 %} {% load bootstrap3 %}
{% block title %} {% trans "Public registrations settings" %} {% endblock %} {% block title %} {% trans "Public registrations settings" %} {% endblock %}
{% block inside %} {% block inside %}
<h1>{% trans "Public registrations settings" %}</h1> <h1>{% trans "Public registrations" %}</h1>
<form action="" method="post" class="form-horizontal"> <form action="" method="post" class="form-horizontal">
{% csrf_token %} {% csrf_token %}
{% bootstrap_form_errors form %} {% bootstrap_form_errors form %}
<fieldset> <fieldset>
<fieldset>{% trans "Display" %}</fieldset>
{% bootstrap_form form layout="horizontal" %} {% bootstrap_form form layout="horizontal" %}
</fieldset> </fieldset>
<div class="form-group submit-group"> <div class="form-group submit-group">
......
from django.conf.urls import url from django.conf.urls import url
from .views import PublicParticipationsView from .views import PublicRegistrationsSettingsView
urlpatterns = [ urlpatterns = [
url( url(
r"^control/event/(?P<organizer>[^/]+)/(?P<event>[^/]+)/public_participations/$", r"^control/event/(?P<organizer>[^/]+)/(?P<event>[^/]+)/public_registrations/$",
PublicParticipationsView.as_view(), PublicRegistrationsSettingsView.as_view(),
name="settings", name="settings",
) )
] ]
from django.urls import reverse from django.urls import reverse
from pretix.base.models import Event
from pretix.control.views.event import EventSettingsFormView, EventSettingsViewMixin from pretix.control.views.event import EventSettingsFormView, EventSettingsViewMixin
from .forms import PublicRegistrationsForm from .forms import PublicRegistrationsSettingsForm
class PublicParticipationsView(EventSettingsViewMixin, EventSettingsFormView): class PublicRegistrationsSettingsView(EventSettingsViewMixin, EventSettingsFormView):
form_class = PublicRegistrationsForm model = Event
permission = "can_change_settings"
form_class = PublicRegistrationsSettingsForm
template_name = "pretix_public_registrations/settings.html" template_name = "pretix_public_registrations/settings.html"
def get_success_url(self, **kwargs): def get_success_url(self, **kwargs):
......
[plugin]
package = "pretix-public-registrations"
modules = [ "pretix_public_registrations" ]
marketplace_name = "public-registrations"
...@@ -36,6 +36,9 @@ exclude_lines = ...@@ -36,6 +36,9 @@ exclude_lines =
ignore = ignore =
.update-locales.sh .update-locales.sh
.install-hooks.sh .install-hooks.sh
pretixplugin.toml
Makefile Makefile
manage.py manage.py
tests/* tests/*
*.po
.gitkeep
...@@ -2,10 +2,11 @@ import os ...@@ -2,10 +2,11 @@ import os
from distutils.command.build import build from distutils.command.build import build
from django.core import management from django.core import management
from setuptools import setup, find_packages from setuptools import find_packages, setup
from pretix_public_registrations import __version__ from pretix_public_registrations import __version__
try: try:
with open( with open(
os.path.join(os.path.dirname(__file__), "README.rst"), encoding="utf-8" os.path.join(os.path.dirname(__file__), "README.rst"), encoding="utf-8"
......