mirror of
https://github.com/pretix/pretix.git
synced 2026-05-04 15:04:03 +00:00
LogEntry: Add a direct relationship to organizer (#3732)
* LogEntry: Add a direct relationship to organizer * Update src/pretix/base/models/log.py Co-authored-by: Richard Schreiber <schreiber@rami.io> * Fix condition * Fix query count * REbase migration * Fix tests --------- Co-authored-by: Richard Schreiber <schreiber@rami.io>
This commit is contained in:
@@ -78,6 +78,7 @@ class LogEntry(models.Model):
|
||||
device = models.ForeignKey('Device', null=True, blank=True, on_delete=models.PROTECT)
|
||||
oauth_application = models.ForeignKey('pretixapi.OAuthApplication', null=True, blank=True, on_delete=models.PROTECT)
|
||||
event = models.ForeignKey('Event', null=True, blank=True, on_delete=models.SET_NULL)
|
||||
organizer_link = models.ForeignKey('Organizer', null=True, blank=True, on_delete=models.PROTECT)
|
||||
action_type = models.CharField(max_length=255)
|
||||
data = models.TextField(default='{}')
|
||||
visible = models.BooleanField(default=True)
|
||||
@@ -126,7 +127,9 @@ class LogEntry(models.Model):
|
||||
def organizer(self):
|
||||
from .organizer import Organizer
|
||||
|
||||
if self.event:
|
||||
if self.organizer_link:
|
||||
return self.organizer_link
|
||||
elif self.event:
|
||||
return self.event.organizer
|
||||
elif hasattr(self.content_object, 'event'):
|
||||
return self.content_object.event.organizer
|
||||
|
||||
Reference in New Issue
Block a user