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

Jd 2023 02 codes delete background task #4965

Merged
merged 3 commits into from
Feb 24, 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
33 changes: 20 additions & 13 deletions locale/de_DE/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: a4-meinberlin\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-02-20 13:22+0100\n"
"POT-Creation-Date: 2023-02-23 11:25+0100\n"
"PO-Revision-Date: 2023-02-17 16:43+0000\n"
"Last-Translator: Jonathan Ostertag <j.ostertag@liqd.net>\n"
"Language-Team: German <https://trans.liqd.net/projects/meinberlin/main/de/>\n"
Expand Down Expand Up @@ -4745,7 +4745,7 @@ msgstr "Codes erstellen"
msgid "Code download"
msgstr "Codes herunterladen"

#: meinberlin/apps/votes/exports.py:51
#: meinberlin/apps/votes/exports.py:59
msgid "Voting codes"
msgstr "Abstimmungscodes"

Expand Down Expand Up @@ -4773,23 +4773,23 @@ msgstr ""
"Bitte geben Sie an, wie viele Teilnehmer*innen zur Abstimmung eingeladen "
"werden sollen. Pro Teilnehmer*in wird ein Code erstellt."

#: meinberlin/apps/votes/models.py:70
#: meinberlin/apps/votes/models.py:99
msgid ""
"Designates whether this token should be treated as active. Unselect this "
"instead of deleting tokens."
msgstr ""
"Legt fest, ob dieser Schlüssel aktiviert ist. Entfernen Sie die Auswahl, "
"anstatt den Schlüssel zu löschen."

#: meinberlin/apps/votes/models.py:168
#: meinberlin/apps/votes/models.py:186
msgid "This token is not valid for this project."
msgstr "Der Abstimmungsschlüssel ist nicht gültig für dieses Projekt."

#: meinberlin/apps/votes/models.py:171
#: meinberlin/apps/votes/models.py:189
msgid "This token is not active."
msgstr "Dieser Abstimmungsschlüssel ist nicht aktiviert."

#: meinberlin/apps/votes/models.py:173
#: meinberlin/apps/votes/models.py:191
msgid "This token has no votes left."
msgstr "Dieser Abstimmungsschlüssel hat keine weiteren Stimmen."

Expand Down Expand Up @@ -4821,14 +4821,21 @@ msgstr "Anzahl der erstellten Codes: %(number_of_module_tokens)s."
msgid " code package no."
msgstr " Code-Paket Nr."

#: meinberlin/apps/votes/templates/meinberlin_votes/token_export_dashboard.html:27
msgid "Download"
msgstr "Herunterladen"
#: meinberlin/apps/votes/templates/meinberlin_votes/token_export_dashboard.html:14
#, python-format
msgid "%(count_int)s Code"
msgid_plural "%(count_int)s Codes"
msgstr[0] ""
msgstr[1] ""

#: meinberlin/apps/votes/templates/meinberlin_votes/token_export_dashboard.html:29
#: meinberlin/apps/votes/templates/meinberlin_votes/token_export_dashboard.html:27
msgid "Encrypted"
msgstr "Verschlüsselt"

#: meinberlin/apps/votes/templates/meinberlin_votes/token_export_dashboard.html:29
msgid "Download"
msgstr "Herunterladen"

#: meinberlin/apps/votes/templates/meinberlin_votes/token_generation_dashboard.html:5
msgid "Generate voting codes"
msgstr "Abstimmungscodes erstellen"
Expand All @@ -4852,19 +4859,19 @@ msgstr "Um die Codes herunterzuladen gehen Sie bitte zum Code-Download."
msgid "Generate codes"
msgstr "Codes erstellen"

#: meinberlin/apps/votes/views.py:77
#: meinberlin/apps/votes/views.py:67
msgid ""
"{} code will be generated in the background. This may take a few minutes."
msgstr ""
"{} Code wird im Hintergrund erstellt. Dies kann ein paar Minuten dauern."

#: meinberlin/apps/votes/views.py:81
#: meinberlin/apps/votes/views.py:71
msgid ""
"{} codes will be generated in the background. This may take a few minutes."
msgstr ""
"{} Codes werden im Hintergrund erstellt. Dies kann ein paar Minuten dauern."

#: meinberlin/apps/votes/views.py:86
#: meinberlin/apps/votes/views.py:76
msgid ""
"Please adjust your number of codes. Per module you can generate up to {} "
"codes."
Expand Down
48 changes: 24 additions & 24 deletions locale/de_DE/LC_MESSAGES/djangojs.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-02-20 13:22+0100\n"
"POT-Creation-Date: 2023-02-23 11:25+0100\n"
"PO-Revision-Date: 2023-02-10 13:43+0000\n"
"Last-Translator: Jonathan Ostertag <j.ostertag@liqd.net>\n"
"Language-Team: German <https://trans.liqd.net/projects/meinberlin/js/de/>\n"
Expand Down Expand Up @@ -513,7 +513,7 @@ msgstr "Hochladen"

#: adhocracy4/maps/static/a4maps/a4maps_choose_polygon_with_preset.js:110
#: adhocracy4/maps/static/a4maps/a4maps_choose_polygon_with_preset.js:110
#: meinberlin/apps/budgeting/assets/BudgetingProposalList.jsx:27
#: meinberlin/apps/budgeting/assets/EndSessionLink.jsx:11
msgid "Cancel"
msgstr "Abbrechen"

Expand Down Expand Up @@ -858,28 +858,6 @@ msgstr ""
msgid "Nothing to show"
msgstr "Keine Ergebnisse"

#: meinberlin/apps/budgeting/assets/BudgetingProposalList.jsx:23
msgid "Are you finished?"
msgstr "Sind Sie fertig?"

#: meinberlin/apps/budgeting/assets/BudgetingProposalList.jsx:24
msgid "End session"
msgstr "Sitzung beenden"

#: meinberlin/apps/budgeting/assets/BudgetingProposalList.jsx:25
msgid ""
"To save your votes you do not need to do anything else. End the session to "
"enter a new code. If you want to change the votes you have already cast, you "
"can re-enter your code as long as the voting phase is running. "
msgstr ""
"Um Ihre abgegebene Stimme zu speichern müssen Sie nichts weiter tun. Beenden "
"Sie die Sitzung, um einen neuen Code einzugeben. Um Ihre Stimme zu ändern, "
"können Sie Ihren Code erneut eingeben, solange die Abstimmungsphase läuft. "

#: meinberlin/apps/budgeting/assets/BudgetingProposalList.jsx:26
msgid "Do you want to end the session?"
msgstr "Möchten Sie diese Sitzung beenden?"

#: meinberlin/apps/budgeting/assets/BudgetingProposalListItem.jsx:8
msgid "updated on"
msgstr "bearbeitet am"
Expand Down Expand Up @@ -929,6 +907,28 @@ msgstr "Vorschläge durchsuchen"
msgid "Remove filters"
msgstr "Filter entfernen"

#: meinberlin/apps/budgeting/assets/EndSessionLink.jsx:7
msgid "Are you finished?"
msgstr "Sind Sie fertig?"

#: meinberlin/apps/budgeting/assets/EndSessionLink.jsx:8
msgid "End session"
msgstr "Sitzung beenden"

#: meinberlin/apps/budgeting/assets/EndSessionLink.jsx:9
msgid ""
"To save your votes you do not need to do anything else. End the session to "
"enter a new code. If you want to change the votes you have already cast, you "
"can re-enter your code as long as the voting phase is running. "
msgstr ""
"Um Ihre abgegebene Stimme zu speichern müssen Sie nichts weiter tun. Beenden "
"Sie die Sitzung, um einen neuen Code einzugeben. Um Ihre Stimme zu ändern, "
"können Sie Ihren Code erneut eingeben, solange die Abstimmungsphase läuft. "

#: meinberlin/apps/budgeting/assets/EndSessionLink.jsx:10
msgid "Do you want to end the session?"
msgstr "Möchten Sie diese Sitzung beenden?"

#: meinberlin/apps/budgeting/assets/ListItemBadges.jsx:5
msgid "More"
msgstr "Mehr"
Expand Down
33 changes: 20 additions & 13 deletions locale/en_GB/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: a4-meinberlin\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-02-20 13:22+0100\n"
"POT-Creation-Date: 2023-02-23 11:25+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"
Expand Down Expand Up @@ -4574,7 +4574,7 @@ msgstr "Code generation"
msgid "Code download"
msgstr "Code download"

#: meinberlin/apps/votes/exports.py:51
#: meinberlin/apps/votes/exports.py:59
msgid "Voting codes"
msgstr "Voting codes"

Expand Down Expand Up @@ -4602,23 +4602,23 @@ msgstr ""
"Please indicate how many participants should be invited to vote. One code "
"will be generated per participant."

#: meinberlin/apps/votes/models.py:70
#: meinberlin/apps/votes/models.py:99
msgid ""
"Designates whether this token should be treated as active. Unselect this "
"instead of deleting tokens."
msgstr ""
"Designates whether this token should be treated as active. Unselect this "
"instead of deleting tokens."

#: meinberlin/apps/votes/models.py:168
#: meinberlin/apps/votes/models.py:186
msgid "This token is not valid for this project."
msgstr "This token is not valid for this project."

#: meinberlin/apps/votes/models.py:171
#: meinberlin/apps/votes/models.py:189
msgid "This token is not active."
msgstr "This token is not active."

#: meinberlin/apps/votes/models.py:173
#: meinberlin/apps/votes/models.py:191
msgid "This token has no votes left."
msgstr "This token has no votes left."

Expand Down Expand Up @@ -4649,14 +4649,21 @@ msgstr "Number of generated codes: %(number_of_module_tokens)s."
msgid " code package no."
msgstr " code package no."

#: meinberlin/apps/votes/templates/meinberlin_votes/token_export_dashboard.html:27
msgid "Download"
msgstr "Download"
#: meinberlin/apps/votes/templates/meinberlin_votes/token_export_dashboard.html:14
#, python-format
msgid "%(count_int)s Code"
msgid_plural "%(count_int)s Codes"
msgstr[0] "%(count_int)s Code"
msgstr[1] "%(count_int)s Codes"

#: meinberlin/apps/votes/templates/meinberlin_votes/token_export_dashboard.html:29
#: meinberlin/apps/votes/templates/meinberlin_votes/token_export_dashboard.html:27
msgid "Encrypted"
msgstr "Encrypted"

#: meinberlin/apps/votes/templates/meinberlin_votes/token_export_dashboard.html:29
msgid "Download"
msgstr "Download"

#: meinberlin/apps/votes/templates/meinberlin_votes/token_generation_dashboard.html:5
msgid "Generate voting codes"
msgstr "Generate voting codes"
Expand All @@ -4680,19 +4687,19 @@ msgstr "To download them please go to code download."
msgid "Generate codes"
msgstr "Generate codes"

#: meinberlin/apps/votes/views.py:77
#: meinberlin/apps/votes/views.py:67
msgid ""
"{} code will be generated in the background. This may take a few minutes."
msgstr ""
"{} code will be generated in the background. This may take a few minutes."

#: meinberlin/apps/votes/views.py:81
#: meinberlin/apps/votes/views.py:71
msgid ""
"{} codes will be generated in the background. This may take a few minutes."
msgstr ""
"{} codes will be generated in the background. This may take a few minutes."

#: meinberlin/apps/votes/views.py:86
#: meinberlin/apps/votes/views.py:76
msgid ""
"Please adjust your number of codes. Per module you can generate up to {} "
"codes."
Expand Down
48 changes: 24 additions & 24 deletions locale/en_GB/LC_MESSAGES/djangojs.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-02-20 13:22+0100\n"
"POT-Creation-Date: 2023-02-23 11:25+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"
Expand Down Expand Up @@ -397,7 +397,7 @@ msgid "Upload"
msgstr "Upload"

#: adhocracy4/maps/static/a4maps/a4maps_choose_polygon_with_preset.js:110
#: meinberlin/apps/budgeting/assets/BudgetingProposalList.jsx:27
#: meinberlin/apps/budgeting/assets/EndSessionLink.jsx:11
msgid "Cancel"
msgstr "Cancel"

Expand Down Expand Up @@ -673,28 +673,6 @@ msgstr "Proposals list"
msgid "Nothing to show"
msgstr "Nothing to show"

#: meinberlin/apps/budgeting/assets/BudgetingProposalList.jsx:23
msgid "Are you finished?"
msgstr "Are you finished?"

#: meinberlin/apps/budgeting/assets/BudgetingProposalList.jsx:24
msgid "End session"
msgstr "End session"

#: meinberlin/apps/budgeting/assets/BudgetingProposalList.jsx:25
msgid ""
"To save your votes you do not need to do anything else. End the session to "
"enter a new code. If you want to change the votes you have already cast, you "
"can re-enter your code as long as the voting phase is running. "
msgstr ""
"To save your votes you do not need to do anything else. End the session to "
"enter a new code. If you want to change the votes you have already cast, you "
"can re-enter your code as long as the voting phase is running. "

#: meinberlin/apps/budgeting/assets/BudgetingProposalList.jsx:26
msgid "Do you want to end the session?"
msgstr "Do you want to end the session?"

#: meinberlin/apps/budgeting/assets/BudgetingProposalListItem.jsx:8
msgid "updated on"
msgstr "updated on"
Expand Down Expand Up @@ -744,6 +722,28 @@ msgstr "Search for Proposals"
msgid "Remove filters"
msgstr "Remove filters"

#: meinberlin/apps/budgeting/assets/EndSessionLink.jsx:7
msgid "Are you finished?"
msgstr "Are you finished?"

#: meinberlin/apps/budgeting/assets/EndSessionLink.jsx:8
msgid "End session"
msgstr "End session"

#: meinberlin/apps/budgeting/assets/EndSessionLink.jsx:9
msgid ""
"To save your votes you do not need to do anything else. End the session to "
"enter a new code. If you want to change the votes you have already cast, you "
"can re-enter your code as long as the voting phase is running. "
msgstr ""
"To save your votes you do not need to do anything else. End the session to "
"enter a new code. If you want to change the votes you have already cast, you "
"can re-enter your code as long as the voting phase is running. "

#: meinberlin/apps/budgeting/assets/EndSessionLink.jsx:10
msgid "Do you want to end the session?"
msgstr "Do you want to end the session?"

#: meinberlin/apps/budgeting/assets/ListItemBadges.jsx:5
msgid "More"
msgstr "More"
Expand Down
15 changes: 11 additions & 4 deletions meinberlin/apps/votes/admin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from django.contrib import admin

from .models import TokenPackage
from .models import TokenVote
from .models import VotingToken

Expand All @@ -11,19 +12,25 @@ class VotingTokenAdmin(admin.ModelAdmin):
"token_hash",
"module",
"is_active",
"package_number",
"package",
"allowed_votes",
)
readonly_fields = ("token", "token_hash", "package_number")
readonly_fields = ("token", "token_hash", "package")
list_display = ("pk", "__str__", "project", "module", "module_name", "is_active")
list_filter = ("module__project",)

def delete_model(self, request, obj):
obj.package.size -= 1
obj.package.save()
super().delete_model(request, obj)

def module_name(self, token):
return token.module.name

def save_model(self, request, obj, form, change):
if obj.package_number is None:
obj.package_number = VotingToken.next_package_number(obj.module)
if not hasattr(obj, "package"):
obj.package = TokenPackage.objects.create(module=obj.module, size=1)

if not obj.token_hash:
obj.token_hash = VotingToken.hash_token(obj.token, obj.module)
super().save_model(request, obj, form, change)
Expand Down
Loading