forked from CGM_Public/pretix_original
Introduce RequiredAction model
Fix #343 by no longer marking as refunded automatically
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
from .auth import U2FDevice, User
|
||||
from .base import CachedFile, LoggedModel, cachedfile_name
|
||||
from .checkin import Checkin
|
||||
from .event import Event, EventLock, EventPermission, EventSetting
|
||||
from .event import (
|
||||
Event, EventLock, EventPermission, EventSetting, RequiredAction,
|
||||
)
|
||||
from .invoices import Invoice, InvoiceLine, invoice_filename
|
||||
from .items import (
|
||||
Item, ItemCategory, ItemVariation, Question, QuestionOption, Quota,
|
||||
|
||||
@@ -359,3 +359,42 @@ class EventLock(models.Model):
|
||||
event = models.CharField(max_length=36, primary_key=True)
|
||||
date = models.DateTimeField(auto_now=True)
|
||||
token = models.UUIDField(default=uuid.uuid4)
|
||||
|
||||
|
||||
class RequiredAction(models.Model):
|
||||
"""
|
||||
Represents an action that is to be done by an admin. The admin will be
|
||||
displayed a list of actions to do.
|
||||
|
||||
:param datatime: The timestamp of the required action
|
||||
:type datetime: datetime
|
||||
:param user: The user that performed the action
|
||||
:type user: User
|
||||
:param done: If this action has been completed or dismissed
|
||||
:type done: bool
|
||||
:param action_type: The type of action that has to be performed. This is
|
||||
used to look up the renderer used to describe the action in a human-
|
||||
readable way. This should be some namespaced value using dotted
|
||||
notation to avoid duplicates, e.g.
|
||||
``"pretix.plugins.banktransfer.incoming_transfer"``.
|
||||
:type action_type: str
|
||||
:param data: Arbitrary data that can be used by the log action renderer
|
||||
:type data: str
|
||||
"""
|
||||
datetime = models.DateTimeField(auto_now_add=True, db_index=True)
|
||||
done = models.BooleanField(default=False)
|
||||
user = models.ForeignKey('User', null=True, blank=True, on_delete=models.PROTECT)
|
||||
event = models.ForeignKey('Event', null=True, blank=True, on_delete=models.CASCADE)
|
||||
action_type = models.CharField(max_length=255)
|
||||
data = models.TextField(default='{}')
|
||||
|
||||
class Meta:
|
||||
ordering = ('datetime',)
|
||||
|
||||
def display(self, request):
|
||||
from ..signals import requiredaction_display
|
||||
|
||||
for receiver, response in requiredaction_display.send(self.event, action=self, request=request):
|
||||
if response:
|
||||
return response
|
||||
return self.action_type
|
||||
|
||||
Reference in New Issue
Block a user