Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def talk_timeline_data(self):
data = Counter(
log.timestamp.astimezone(self.request.event.tz).date()
for log in ActivityLog.objects.filter(
event=self.request.event, action_type="pretalx.submission.create",
)
if getattr(log.content_object, "state", None)
in [SubmissionStates.ACCEPTED, SubmissionStates.CONFIRMED]
)
dates = data.keys()
if len(dates) > 1:
date_range = rrule.rrule(
rrule.DAILY,
count=(max(dates) - min(dates)).days + 1,
dtstart=min(dates),
)
if len(data) > 1:
return json.dumps(
[
{"x": date.isoformat(), "y": data.get(date.date(), 0)}
self.cfp,
self.mail_templates.all(),
self.information.all(),
TalkSlot.objects.filter(schedule__event=self),
Feedback.objects.filter(talk__event=self),
Resource.objects.filter(submission__event=self),
Answer.objects.filter(question__event=self),
AnswerOption.objects.filter(question__event=self),
Question.all_objects.filter(event=self),
Submission.all_objects.filter(event=self),
self.tracks.all(),
self.submission_types.all(),
self.schedules.all(),
SpeakerProfile.objects.filter(event=self),
self.rooms.all(),
ActivityLog.objects.filter(event=self),
self,
]
self._delete_mail_templates()
for entry in deletion_order:
entry.delete()
def own_actions(self):
"""Returns all log entries that were made by this user."""
from pretalx.common.models import ActivityLog
return ActivityLog.objects.filter(person=self)
def submission_timeline_data(self):
data = Counter(
timestamp.astimezone(self.request.event.tz).date()
for timestamp in ActivityLog.objects.filter(
event=self.request.event, action_type="pretalx.submission.create"
).values_list("timestamp", flat=True)
)
dates = data.keys()
if len(dates) > 1:
date_range = rrule.rrule(
rrule.DAILY,
count=(max(dates) - min(dates)).days + 1,
dtstart=min(dates),
)
if len(data) > 1:
return json.dumps(
[
{"x": date.isoformat(), "y": data.get(date.date(), 0)}
for date in date_range
]
event.queued_mails.all(),
event.cfp,
event.mail_templates.all(),
event.information.all(),
TalkSlot.objects.filter(schedule__event=event),
Feedback.objects.filter(talk__event=event),
Resource.objects.filter(submission__event=event),
Answer.objects.filter(question__event=event),
AnswerOption.objects.filter(question__event=event),
Question.all_objects.filter(event=event),
event.submissions(manager="all_objects").all(),
event.submission_types.all(),
event.schedules.all(),
SpeakerProfile.objects.filter(event=event),
event.rooms.all(),
ActivityLog.objects.filter(event=event),
event,
]
delete_mail_templates(event)
for entry in deletion_order:
entry.delete()
def logged_actions(self):
from pretalx.common.models import ActivityLog
return ActivityLog.objects.filter(
content_type=ContentType.objects.get_for_model(type(self)),
object_id=self.pk,
).select_related("event", "person")