Skip to content
Snippets Groups Projects
Commit 57814e22 authored by Benjamin Hättasch's avatar Benjamin Hättasch Committed by Nadja Geisler
Browse files

Introduce confident AK messages to organizers

Add model
Add to admin interface
Add and link create view in frontend
Add translations
parent e525eee7
No related branches found
No related tags found
No related merge requests found
...@@ -10,7 +10,7 @@ from django.utils.translation import gettext_lazy as _ ...@@ -10,7 +10,7 @@ from django.utils.translation import gettext_lazy as _
from simple_history.admin import SimpleHistoryAdmin from simple_history.admin import SimpleHistoryAdmin
from AKModel.availability.models import Availability from AKModel.availability.models import Availability
from AKModel.models import Event, AKOwner, AKCategory, AKTrack, AKTag, AKRequirement, AK, AKSlot, Room from AKModel.models import Event, AKOwner, AKCategory, AKTrack, AKTag, AKRequirement, AK, AKSlot, Room, AKOrgaMessage
from AKModel.views import EventStatusView, AKCSVExportView from AKModel.views import EventStatusView, AKCSVExportView
...@@ -218,3 +218,10 @@ class AvailabilityAdmin(admin.ModelAdmin): ...@@ -218,3 +218,10 @@ class AvailabilityAdmin(admin.ModelAdmin):
else: else:
timezone.activate("UTC") timezone.activate("UTC")
return super().get_form(request, obj, change, **kwargs) return super().get_form(request, obj, change, **kwargs)
@admin.register(AKOrgaMessage)
class AKOrgaMessageAdmin(admin.ModelAdmin):
list_display = ['timestamp', 'ak', 'text']
list_filter = ['ak__event']
readonly_fields = ['timestamp', 'ak', 'text']
...@@ -2,7 +2,7 @@ msgid "" ...@@ -2,7 +2,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-07-12 16:17+0000\n" "POT-Creation-Date: 2020-09-28 22:17+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
...@@ -86,7 +86,7 @@ msgid "Room whose availability this is" ...@@ -86,7 +86,7 @@ msgid "Room whose availability this is"
msgstr "Raum dessen Verfügbarkeit hier abgebildet wird" msgstr "Raum dessen Verfügbarkeit hier abgebildet wird"
#: AKModel/availability/models.py:65 AKModel/models.py:236 #: AKModel/availability/models.py:65 AKModel/models.py:236
#: AKModel/models.py:298 #: AKModel/models.py:298 AKModel/models.py:348
msgid "AK" msgid "AK"
msgstr "AK" msgstr "AK"
...@@ -520,6 +520,29 @@ msgstr "AK Slot" ...@@ -520,6 +520,29 @@ msgstr "AK Slot"
msgid "Not scheduled yet" msgid "Not scheduled yet"
msgstr "Noch nicht geplant" msgstr "Noch nicht geplant"
#: AKModel/models.py:348
#, fuzzy
#| msgid "Track the AK belongs to"
msgid "AK this message belongs to"
msgstr "Track zu dem der AK gehört"
#: AKModel/models.py:349
msgid "Message text"
msgstr "Nachrichtentext"
#: AKModel/models.py:349
msgid "Message to the organizers. This is not publicly visible."
msgstr ""
"Nachricht an die Organisator*innen. Diese ist nicht öffentlich sichtbar."
#: AKModel/models.py:353
msgid "AK Orga Message"
msgstr "AK-Organachricht"
#: AKModel/models.py:354
msgid "AK Orga Messages"
msgstr "AK-Organachrichten"
#: AKModel/site.py:10 #: AKModel/site.py:10
msgid "Administration" msgid "Administration"
msgstr "Verwaltung" msgstr "Verwaltung"
......
# Generated by Django 3.0.6 on 2020-09-28 21:52
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('AKModel', '0037_event_public'),
]
operations = [
migrations.CreateModel(
name='AKOrgaMessage',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('text', models.TextField(help_text='Message to the organizers. This is not publicly visible.', verbose_name='Message text')),
('timestamp', models.DateTimeField(auto_now_add=True)),
('ak', models.ForeignKey(help_text='AK this message belongs to', on_delete=django.db.models.deletion.CASCADE, to='AKModel.AK', verbose_name='AK')),
],
options={
'verbose_name': 'AK Orga Message',
'verbose_name_plural': 'AK Orga Messages',
'ordering': ['-timestamp'],
},
),
]
...@@ -342,3 +342,17 @@ class AKSlot(models.Model): ...@@ -342,3 +342,17 @@ class AKSlot(models.Model):
:rtype: float :rtype: float
""" """
return (timezone.now() - self.updated).total_seconds() return (timezone.now() - self.updated).total_seconds()
class AKOrgaMessage(models.Model):
ak = models.ForeignKey(to=AK, on_delete=models.CASCADE, verbose_name=_('AK'), help_text=_('AK this message belongs to'))
text = models.TextField(verbose_name=_("Message text"), help_text=_("Message to the organizers. This is not publicly visible."))
timestamp = models.DateTimeField(auto_now_add=True)
class Meta:
verbose_name = _('AK Orga Message')
verbose_name_plural = _('AK Orga Messages')
ordering = ['-timestamp']
def __str__(self):
return f'AK Orga Message for "{self.ak}" @ {self.timestamp}'
...@@ -6,7 +6,7 @@ from django.core.exceptions import ValidationError ...@@ -6,7 +6,7 @@ from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from AKModel.availability.forms import AvailabilitiesFormMixin from AKModel.availability.forms import AvailabilitiesFormMixin
from AKModel.models import AK, AKOwner, AKCategory, AKRequirement, AKSlot from AKModel.models import AK, AKOwner, AKCategory, AKRequirement, AKSlot, AKOrgaMessage
class AKForm(AvailabilitiesFormMixin, forms.ModelForm): class AKForm(AvailabilitiesFormMixin, forms.ModelForm):
...@@ -161,3 +161,13 @@ class AKDurationForm(forms.ModelForm): ...@@ -161,3 +161,13 @@ class AKDurationForm(forms.ModelForm):
'ak': forms.HiddenInput, 'ak': forms.HiddenInput,
'event': forms.HiddenInput 'event': forms.HiddenInput
} }
class AKOrgaMessageForm(forms.ModelForm):
class Meta:
model = AKOrgaMessage
fields = ['ak', 'text']
widgets = {
'ak': forms.HiddenInput,
'text': forms.Textarea,
}
...@@ -8,7 +8,7 @@ msgid "" ...@@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-07-12 16:17+0000\n" "POT-Creation-Date: 2020-09-28 22:17+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
...@@ -44,6 +44,7 @@ msgstr "" ...@@ -44,6 +44,7 @@ msgstr ""
#: AKSubmission/templates/AKSubmission/ak_overview.html:8 #: AKSubmission/templates/AKSubmission/ak_overview.html:8
#: AKSubmission/templates/AKSubmission/ak_overview.html:12 #: AKSubmission/templates/AKSubmission/ak_overview.html:12
#: AKSubmission/templates/AKSubmission/ak_overview.html:38 #: AKSubmission/templates/AKSubmission/ak_overview.html:38
#: AKSubmission/templates/AKSubmission/akmessage_add.html:7
#: AKSubmission/templates/AKSubmission/akowner_create_update.html:7 #: AKSubmission/templates/AKSubmission/akowner_create_update.html:7
#: AKSubmission/templates/AKSubmission/akslot_add_update.html:7 #: AKSubmission/templates/AKSubmission/akslot_add_update.html:7
#: AKSubmission/templates/AKSubmission/akslot_delete.html:7 #: AKSubmission/templates/AKSubmission/akslot_delete.html:7
...@@ -65,6 +66,7 @@ msgstr "AK" ...@@ -65,6 +66,7 @@ msgstr "AK"
#: AKSubmission/templates/AKSubmission/ak_edit.html:13 #: AKSubmission/templates/AKSubmission/ak_edit.html:13
#: AKSubmission/templates/AKSubmission/ak_history.html:16 #: AKSubmission/templates/AKSubmission/ak_history.html:16
#: AKSubmission/templates/AKSubmission/ak_overview.html:27 #: AKSubmission/templates/AKSubmission/ak_overview.html:27
#: AKSubmission/templates/AKSubmission/akmessage_add.html:12
#: AKSubmission/templates/AKSubmission/akowner_create_update.html:12 #: AKSubmission/templates/AKSubmission/akowner_create_update.html:12
#: AKSubmission/templates/AKSubmission/akslot_add_update.html:12 #: AKSubmission/templates/AKSubmission/akslot_add_update.html:12
#: AKSubmission/templates/AKSubmission/akslot_delete.html:12 #: AKSubmission/templates/AKSubmission/akslot_delete.html:12
...@@ -102,101 +104,105 @@ msgid "History" ...@@ -102,101 +104,105 @@ msgid "History"
msgstr "Versionsgeschichte" msgstr "Versionsgeschichte"
#: AKSubmission/templates/AKSubmission/ak_detail.html:59 #: AKSubmission/templates/AKSubmission/ak_detail.html:59
#: AKSubmission/templates/AKSubmission/ak_detail.html:174 msgid "Add confident message to organizers"
msgstr ""
#: AKSubmission/templates/AKSubmission/ak_detail.html:62
#: AKSubmission/templates/AKSubmission/ak_detail.html:177
#: AKSubmission/templates/AKSubmission/ak_edit.html:16 #: AKSubmission/templates/AKSubmission/ak_edit.html:16
#: AKSubmission/templates/AKSubmission/ak_table.html:53 #: AKSubmission/templates/AKSubmission/ak_table.html:53
msgid "Edit" msgid "Edit"
msgstr "Bearbeiten" msgstr "Bearbeiten"
#: AKSubmission/templates/AKSubmission/ak_detail.html:64 #: AKSubmission/templates/AKSubmission/ak_detail.html:67
#: AKSubmission/templates/AKSubmission/ak_history.html:31 #: AKSubmission/templates/AKSubmission/ak_history.html:31
#: AKSubmission/templates/AKSubmission/ak_table.html:35 #: AKSubmission/templates/AKSubmission/ak_table.html:35
msgid "AK Wish" msgid "AK Wish"
msgstr "AK-Wunsch" msgstr "AK-Wunsch"
#: AKSubmission/templates/AKSubmission/ak_detail.html:68 #: AKSubmission/templates/AKSubmission/ak_detail.html:71
#: AKSubmission/templates/AKSubmission/ak_table.html:10 #: AKSubmission/templates/AKSubmission/ak_table.html:10
msgid "Who?" msgid "Who?"
msgstr "Wer?" msgstr "Wer?"
#: AKSubmission/templates/AKSubmission/ak_detail.html:74 #: AKSubmission/templates/AKSubmission/ak_detail.html:77
#: AKSubmission/templates/AKSubmission/ak_history.html:36 #: AKSubmission/templates/AKSubmission/ak_history.html:36
#: AKSubmission/templates/AKSubmission/ak_table.html:11 #: AKSubmission/templates/AKSubmission/ak_table.html:11
msgid "Category" msgid "Category"
msgstr "Kategorie" msgstr "Kategorie"
#: AKSubmission/templates/AKSubmission/ak_detail.html:81 #: AKSubmission/templates/AKSubmission/ak_detail.html:84
#: AKSubmission/templates/AKSubmission/ak_history.html:37 #: AKSubmission/templates/AKSubmission/ak_history.html:37
msgid "Track" msgid "Track"
msgstr "Track" msgstr "Track"
#: AKSubmission/templates/AKSubmission/ak_detail.html:86 #: AKSubmission/templates/AKSubmission/ak_detail.html:89
msgid "Present this AK" msgid "Present this AK"
msgstr "Diesen AK vorstellen" msgstr "Diesen AK vorstellen"
#: AKSubmission/templates/AKSubmission/ak_detail.html:90 #: AKSubmission/templates/AKSubmission/ak_detail.html:93
#: AKSubmission/templates/AKSubmission/ak_table.html:12 #: AKSubmission/templates/AKSubmission/ak_table.html:12
msgid "Tags" msgid "Tags"
msgstr "Tags" msgstr "Tags"
#: AKSubmission/templates/AKSubmission/ak_detail.html:96 #: AKSubmission/templates/AKSubmission/ak_detail.html:99
msgid "Reso?" msgid "Reso?"
msgstr "Reso?" msgstr "Reso?"
#: AKSubmission/templates/AKSubmission/ak_detail.html:103 #: AKSubmission/templates/AKSubmission/ak_detail.html:106
msgid "Requirements" msgid "Requirements"
msgstr "Anforderungen" msgstr "Anforderungen"
#: AKSubmission/templates/AKSubmission/ak_detail.html:116 #: AKSubmission/templates/AKSubmission/ak_detail.html:119
msgid "Conflicting AKs" msgid "Conflicting AKs"
msgstr "AK Konflikte" msgstr "AK Konflikte"
#: AKSubmission/templates/AKSubmission/ak_detail.html:124 #: AKSubmission/templates/AKSubmission/ak_detail.html:127
msgid "Prerequisite AKs" msgid "Prerequisite AKs"
msgstr "AK Voraussetzungen" msgstr "AK Voraussetzungen"
#: AKSubmission/templates/AKSubmission/ak_detail.html:132 #: AKSubmission/templates/AKSubmission/ak_detail.html:135
msgid "Notes" msgid "Notes"
msgstr "Notizen" msgstr "Notizen"
#: AKSubmission/templates/AKSubmission/ak_detail.html:149 #: AKSubmission/templates/AKSubmission/ak_detail.html:152
#: AKSubmission/templates/AKSubmission/akslot_delete.html:35 #: AKSubmission/templates/AKSubmission/akslot_delete.html:35
msgid "Duration" msgid "Duration"
msgstr "Dauer" msgstr "Dauer"
#: AKSubmission/templates/AKSubmission/ak_detail.html:151 #: AKSubmission/templates/AKSubmission/ak_detail.html:154
msgid "When?" msgid "When?"
msgstr "Wann?" msgstr "Wann?"
#: AKSubmission/templates/AKSubmission/ak_detail.html:152 #: AKSubmission/templates/AKSubmission/ak_detail.html:155
msgid "Room" msgid "Room"
msgstr "Raum" msgstr "Raum"
#: AKSubmission/templates/AKSubmission/ak_detail.html:177 #: AKSubmission/templates/AKSubmission/ak_detail.html:180
msgid "Delete" msgid "Delete"
msgstr "Löschen" msgstr "Löschen"
#: AKSubmission/templates/AKSubmission/ak_detail.html:182 #: AKSubmission/templates/AKSubmission/ak_detail.html:185
msgid "Go to virtual room" msgid "Go to virtual room"
msgstr "Zum virtuellen Raum" msgstr "Zum virtuellen Raum"
#: AKSubmission/templates/AKSubmission/ak_detail.html:188 #: AKSubmission/templates/AKSubmission/ak_detail.html:191
msgid "Schedule" msgid "Schedule"
msgstr "Schedule" msgstr "Schedule"
#: AKSubmission/templates/AKSubmission/ak_detail.html:200 #: AKSubmission/templates/AKSubmission/ak_detail.html:203
msgid "Add another slot" msgid "Add another slot"
msgstr "Einen neuen AK-Slot hinzufügen" msgstr "Einen neuen AK-Slot hinzufügen"
#: AKSubmission/templates/AKSubmission/ak_detail.html:204 #: AKSubmission/templates/AKSubmission/ak_detail.html:207
msgid "Possible Times" msgid "Possible Times"
msgstr "Mögliche Zeiten" msgstr "Mögliche Zeiten"
#: AKSubmission/templates/AKSubmission/ak_detail.html:208 #: AKSubmission/templates/AKSubmission/ak_detail.html:211
msgid "Start" msgid "Start"
msgstr "Start" msgstr "Start"
#: AKSubmission/templates/AKSubmission/ak_detail.html:209 #: AKSubmission/templates/AKSubmission/ak_detail.html:212
msgid "End" msgid "End"
msgstr "Ende" msgstr "Ende"
...@@ -252,23 +258,24 @@ msgstr "Details" ...@@ -252,23 +258,24 @@ msgstr "Details"
msgid "There are no AKs in this category yet" msgid "There are no AKs in this category yet"
msgstr "Es gibt noch keine AKs in dieser Kategorie" msgstr "Es gibt noch keine AKs in dieser Kategorie"
#: AKSubmission/templates/AKSubmission/akowner_create_update.html:7 #: AKSubmission/templates/AKSubmission/akmessage_add.html:7
#: AKSubmission/templates/AKSubmission/akowner_create_update.html:13 #: AKSubmission/templates/AKSubmission/akmessage_add.html:15
#: AKSubmission/templates/AKSubmission/akowner_create_update.html:18 #: AKSubmission/templates/AKSubmission/akmessage_add.html:21
msgid "AK Owner" msgid "Add message to organizers"
msgstr "AK-Leitung" msgstr ""
#: AKSubmission/templates/AKSubmission/akowner_create_update.html:24 #: AKSubmission/templates/AKSubmission/akmessage_add.html:27
#: AKSubmission/templates/AKSubmission/akslot_add_update.html:26 msgid "Send"
msgid "Continue" msgstr "Senden"
msgstr "Weiter"
#: AKSubmission/templates/AKSubmission/akmessage_add.html:31
#: AKSubmission/templates/AKSubmission/akowner_create_update.html:27 #: AKSubmission/templates/AKSubmission/akowner_create_update.html:27
#: AKSubmission/templates/AKSubmission/akslot_add_update.html:30 #: AKSubmission/templates/AKSubmission/akslot_add_update.html:30
#: AKSubmission/templates/AKSubmission/submit_new.html:45 #: AKSubmission/templates/AKSubmission/submit_new.html:45
msgid "Reset Form" msgid "Reset Form"
msgstr "Formular leeren" msgstr "Formular leeren"
#: AKSubmission/templates/AKSubmission/akmessage_add.html:35
#: AKSubmission/templates/AKSubmission/akowner_create_update.html:31 #: AKSubmission/templates/AKSubmission/akowner_create_update.html:31
#: AKSubmission/templates/AKSubmission/akslot_add_update.html:34 #: AKSubmission/templates/AKSubmission/akslot_add_update.html:34
#: AKSubmission/templates/AKSubmission/akslot_delete.html:46 #: AKSubmission/templates/AKSubmission/akslot_delete.html:46
...@@ -276,6 +283,17 @@ msgstr "Formular leeren" ...@@ -276,6 +283,17 @@ msgstr "Formular leeren"
msgid "Cancel" msgid "Cancel"
msgstr "Abbrechen" msgstr "Abbrechen"
#: AKSubmission/templates/AKSubmission/akowner_create_update.html:7
#: AKSubmission/templates/AKSubmission/akowner_create_update.html:13
#: AKSubmission/templates/AKSubmission/akowner_create_update.html:18
msgid "AK Owner"
msgstr "AK-Leitung"
#: AKSubmission/templates/AKSubmission/akowner_create_update.html:24
#: AKSubmission/templates/AKSubmission/akslot_add_update.html:26
msgid "Continue"
msgstr "Weiter"
#: AKSubmission/templates/AKSubmission/akslot_add_update.html:7 #: AKSubmission/templates/AKSubmission/akslot_add_update.html:7
#: AKSubmission/templates/AKSubmission/akslot_add_update.html:15 #: AKSubmission/templates/AKSubmission/akslot_add_update.html:15
#: AKSubmission/templates/AKSubmission/akslot_add_update.html:20 #: AKSubmission/templates/AKSubmission/akslot_add_update.html:20
...@@ -405,3 +423,7 @@ msgstr "Bereits geplante AK-Slots können nicht mehr gelöscht werden" ...@@ -405,3 +423,7 @@ msgstr "Bereits geplante AK-Slots können nicht mehr gelöscht werden"
#: AKSubmission/views.py:403 #: AKSubmission/views.py:403
msgid "AK Slot successfully deleted" msgid "AK Slot successfully deleted"
msgstr "AK-Slot erfolgreich angelegt" msgstr "AK-Slot erfolgreich angelegt"
#: AKSubmission/views.py:424
msgid "Message to organizers successfully saved"
msgstr "Nachricht an die Organisator*innen erfolgreich gespeichert"
...@@ -55,6 +55,9 @@ ...@@ -55,6 +55,9 @@
data-toggle="tooltip" data-toggle="tooltip"
title="{% trans 'History' %}" class="btn btn-light">{% fa5_icon 'clock' 'fas' %}</a> title="{% trans 'History' %}" class="btn btn-light">{% fa5_icon 'clock' 'fas' %}</a>
{% if ak.event.active %} {% if ak.event.active %}
<a href="{% url 'submit:akmessage_add' event_slug=ak.event.slug pk=ak.pk %}" data-toggle="tooltip"
title="{% trans 'Add confident message to organizers' %}"
class="btn btn-warning">{% fa5_icon 'envelope' 'fas' %}</a>
<a href="{% url 'submit:ak_edit' event_slug=ak.event.slug pk=ak.pk %}" data-toggle="tooltip" <a href="{% url 'submit:ak_edit' event_slug=ak.event.slug pk=ak.pk %}" data-toggle="tooltip"
title="{% trans 'Edit' %}" title="{% trans 'Edit' %}"
class="btn btn-success">{% fa5_icon 'pencil-alt' 'fas' %}</a> class="btn btn-success">{% fa5_icon 'pencil-alt' 'fas' %}</a>
......
{% extends 'AKSubmission/submission_base.html' %}
{% load i18n %}
{% load bootstrap4 %}
{% load fontawesome_5 %}
{% block title %}{% trans "AKs" %}: {{ event.name }} - {% trans "Add message to organizers" %}{% endblock %}
{% block breadcrumbs %}
{% include "AKSubmission/submission_breadcrumbs.html" %}
<li class="breadcrumb-item"><a
href="{% url 'submit:submission_overview' event_slug=event.slug %}">{% trans "AK Submission" %}</a></li>
<li class="breadcrumb-item"><a
href="{% url 'submit:ak_detail' event_slug=event.slug pk=ak.pk %}">{{ ak.short_name }}</a></li>
<li class="breadcrumb-item active">{% trans "Add message to organizers" %}</li>
{% endblock %}
{% block content %}
{% block headline %}
<h2>{{ ak }}</h2>
<h3>{% trans 'Add message to organizers' %}</h3>
{% endblock %}
<form method="POST" class="post-form">{% csrf_token %}
{% bootstrap_form form %}
{% buttons %}
<button type="submit" class="save btn btn-primary float-right">
{% fa5_icon "check" 'fas' %} {% trans "Send" %}
</button>
<button type="reset" class="btn btn-danger">
{% fa5_icon "undo-alt" 'fas' %} {% trans "Reset Form" %}
</button>
<a href="{% url 'submit:ak_detail' event_slug=event.slug pk=ak.pk %}" class="btn btn-secondary">
{% fa5_icon "times" 'fas' %} {% trans "Cancel" %}
</a>
{% endbuttons %}
</form>
{% endblock %}
...@@ -14,6 +14,7 @@ urlpatterns = [ ...@@ -14,6 +14,7 @@ urlpatterns = [
path('ak/<int:pk>/edit/', views.AKEditView.as_view(), name='ak_edit'), path('ak/<int:pk>/edit/', views.AKEditView.as_view(), name='ak_edit'),
path('ak/<int:pk>/interest/', views.AKInterestView.as_view(), name='inc_interest'), path('ak/<int:pk>/interest/', views.AKInterestView.as_view(), name='inc_interest'),
path('ak/<int:pk>/add_slot/', views.AKSlotAddView.as_view(), name='akslot_add'), path('ak/<int:pk>/add_slot/', views.AKSlotAddView.as_view(), name='akslot_add'),
path('ak/<int:pk>/add_message/', views.AKAddOrgaMessageView.as_view(), name='akmessage_add'),
path('akslot/<int:pk>/edit/', views.AKSlotEditView.as_view(), name='akslot_edit'), path('akslot/<int:pk>/edit/', views.AKSlotEditView.as_view(), name='akslot_edit'),
path('akslot/<int:pk>/delete/', views.AKSlotDeleteView.as_view(), name='akslot_delete'), path('akslot/<int:pk>/delete/', views.AKSlotDeleteView.as_view(), name='akslot_delete'),
path('aks/', views.AKOverviewView.as_view(), name='ak_list'), path('aks/', views.AKOverviewView.as_view(), name='ak_list'),
......
...@@ -8,10 +8,10 @@ from django.views import View ...@@ -8,10 +8,10 @@ from django.views import View
from django.views.generic import ListView, DetailView, CreateView, UpdateView, DeleteView, RedirectView, TemplateView from django.views.generic import ListView, DetailView, CreateView, UpdateView, DeleteView, RedirectView, TemplateView
from AKModel.availability.models import Availability from AKModel.availability.models import Availability
from AKModel.models import AK, AKCategory, AKTag, AKOwner, AKSlot, AKTrack from AKModel.models import AK, AKCategory, AKTag, AKOwner, AKSlot, AKTrack, AKOrgaMessage
from AKModel.views import EventSlugMixin from AKModel.views import EventSlugMixin
from AKModel.views import FilterByEventSlugMixin from AKModel.views import FilterByEventSlugMixin
from AKSubmission.forms import AKWishForm, AKOwnerForm, AKEditForm, AKSubmissionForm, AKDurationForm from AKSubmission.forms import AKWishForm, AKOwnerForm, AKEditForm, AKSubmissionForm, AKDurationForm, AKOrgaMessageForm
class SubmissionErrorNotConfiguredView(EventSlugMixin, TemplateView): class SubmissionErrorNotConfiguredView(EventSlugMixin, TemplateView):
...@@ -403,3 +403,24 @@ class AKSlotDeleteView(EventSlugMixin, EventInactiveRedirectMixin, DeleteView): ...@@ -403,3 +403,24 @@ class AKSlotDeleteView(EventSlugMixin, EventInactiveRedirectMixin, DeleteView):
messages.add_message(self.request, messages.SUCCESS, _("AK Slot successfully deleted")) messages.add_message(self.request, messages.SUCCESS, _("AK Slot successfully deleted"))
return reverse_lazy('submit:ak_detail', return reverse_lazy('submit:ak_detail',
kwargs={'event_slug': self.kwargs['event_slug'], 'pk': self.object.ak.pk}) kwargs={'event_slug': self.kwargs['event_slug'], 'pk': self.object.ak.pk})
class AKAddOrgaMessageView(EventSlugMixin, CreateView):
model = AKOrgaMessage
form_class = AKOrgaMessageForm
template_name = "AKSubmission/akmessage_add.html"
def get_initial(self):
initials = super(AKAddOrgaMessageView, self).get_initial()
initials['ak'] = get_object_or_404(AK, pk=self.kwargs['pk'])
return initials
def get_context_data(self, *, object_list=None, **kwargs):
context = super().get_context_data(object_list=object_list, **kwargs)
context['ak'] = get_object_or_404(AK, pk=self.kwargs['pk'])
return context
def get_success_url(self):
messages.add_message(self.request, messages.SUCCESS, _("Message to organizers successfully saved"))
return reverse_lazy('submit:ak_detail',
kwargs={'event_slug': self.kwargs['event_slug'], 'pk': self.object.ak.pk})
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment