|
@@ -807,20 +807,24 @@ class CoderedEventPage(CoderedWebPage, BaseEvent):
|
|
|
noc = self.next_occurrence()
|
|
|
if noc:
|
|
|
return noc
|
|
|
- aoc = []
|
|
|
- for occurrence in self.occurrences.all():
|
|
|
- aoc += [instance for instance in occurrence.all_occurrences()]
|
|
|
- if len(aoc) > 0:
|
|
|
- return aoc[-1] # last one in the list
|
|
|
|
|
|
except AttributeError:
|
|
|
# Triggers when a preview is initiated on an
|
|
|
# EventPage because it uses a FakeQuerySet object.
|
|
|
# Here we manually compute the next_occurrence
|
|
|
occurrences = [e.next_occurrence() for e in self.occurrences.all()]
|
|
|
- if occurrences:
|
|
|
+ # If there are no more occurrences, we find the last one instead
|
|
|
+ if occurrences and None not in occurrences:
|
|
|
return sorted(occurrences, key=lambda tup: tup[0])[0]
|
|
|
|
|
|
+ # If both of the above methods fail to find a future occurrence,
|
|
|
+ # instead return the last occurrence.
|
|
|
+ aoc = []
|
|
|
+ for occurrence in self.occurrences.all():
|
|
|
+ aoc += [instance for instance in occurrence.all_occurrences()]
|
|
|
+ if len(aoc) > 0:
|
|
|
+ return aoc[-1] # last one in the list
|
|
|
+
|
|
|
@property
|
|
|
def seo_struct_event_dict(self) -> dict:
|
|
|
next_occ = self.most_recent_occurrence
|
|
@@ -879,7 +883,6 @@ class CoderedEventPage(CoderedWebPage, BaseEvent):
|
|
|
|
|
|
# For each occurrence rule in all of the occurrence rules for this event.
|
|
|
for occurrence in self.occurrences.all():
|
|
|
-
|
|
|
# Add the qualifying generated event instances to the list.
|
|
|
event_instances += [
|
|
|
instance
|
|
@@ -1280,7 +1283,6 @@ class CoderedFormMixin(models.Model):
|
|
|
processed_data = {}
|
|
|
# Handle file uploads
|
|
|
for key, val in form.cleaned_data.items():
|
|
|
-
|
|
|
if (
|
|
|
type(val) == InMemoryUploadedFile
|
|
|
or type(val) == TemporaryUploadedFile
|
|
@@ -1318,7 +1320,6 @@ class CoderedFormMixin(models.Model):
|
|
|
def process_form_submission(
|
|
|
self, request, form, form_submission, processed_data
|
|
|
):
|
|
|
-
|
|
|
# Save to database
|
|
|
if self.save_to_database:
|
|
|
form_submission.save()
|
|
@@ -1332,7 +1333,6 @@ class CoderedFormMixin(models.Model):
|
|
|
context = Context(self.data_to_dict(processed_data, request))
|
|
|
# Render emails as if they are django templates.
|
|
|
for email in self.confirmation_emails.all():
|
|
|
-
|
|
|
# Build email message parameters.
|
|
|
message_args = {}
|
|
|
# From
|
|
@@ -1437,7 +1437,6 @@ class CoderedFormMixin(models.Model):
|
|
|
message.send()
|
|
|
|
|
|
def render_landing_page(self, request, form_submission=None):
|
|
|
-
|
|
|
"""
|
|
|
Renders the landing page.
|
|
|
|
|
@@ -1646,7 +1645,6 @@ class CoderedSubmissionRevision(SubmissionRevision, models.Model):
|
|
|
|
|
|
|
|
|
class CoderedSessionFormSubmission(SessionFormSubmission):
|
|
|
-
|
|
|
INCOMPLETE = "incomplete"
|
|
|
COMPLETE = "complete"
|
|
|
REVIEWED = "reviewed"
|