prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Require email reschedule date/time to be in the future
  Currently past date/time values are allowed. 
  
  </issue>
  <code>
  [start of amy/emails/forms.py]
  1 from django import forms
  2 from markdownx.fields import MarkdownxFormField
  3 
  4 from emails.models import EmailTemplate, ScheduledEmail
  5 from emails.signals import SignalNameEnum
  6 from workshops.forms import BootstrapHelper
  7 
  8 
  9 class EmailTemplateCreateForm(forms.ModelForm):
  10     body = MarkdownxFormField(
  11         label=EmailTemplate._meta.get_field("body").verbose_name,
  12         help_text=EmailTemplate._meta.get_field("body").help_text,
  13         widget=forms.Textarea,
  14     )
  15     signal = forms.CharField(
  16         help_text=EmailTemplate._meta.get_field("signal").help_text,
  17         widget=forms.Select(choices=SignalNameEnum.choices()),
  18     )
  19 
  20     class Meta:
  21         model = EmailTemplate
  22         fields = [
  23             "name",
  24             "active",
  25             "signal",
  26             "from_header",
  27             "reply_to_header",
  28             "cc_header",
  29             "bcc_header",
  30             "subject",
  31             "body",
  32         ]
  33 
  34     def __init__(self, *args, **kwargs):
  35         super().__init__(*args, **kwargs)
  36 
  37         array_email_field_help_text = "Separate email addresses with a comma"
  38         self.fields["cc_header"].help_text = array_email_field_help_text
  39         self.fields["bcc_header"].help_text = array_email_field_help_text
  40 
  41 
  42 class EmailTemplateUpdateForm(EmailTemplateCreateForm):
  43     signal = forms.CharField(
  44         required=False,
  45         disabled=True,
  46         help_text=EmailTemplate._meta.get_field("signal").help_text,
  47         widget=forms.Select(choices=SignalNameEnum.choices()),
  48     )
  49 
  50     class Meta(EmailTemplateCreateForm.Meta):
  51         pass
  52 
  53 
  54 class ScheduledEmailUpdateForm(forms.ModelForm):
  55     body = MarkdownxFormField(
  56         label=ScheduledEmail._meta.get_field("body").verbose_name,
  57         help_text=ScheduledEmail._meta.get_field("body").help_text,
  58         widget=forms.Textarea,
  59     )
  60 
  61     class Meta:
  62         model = ScheduledEmail
  63         fields = [
  64             "to_header",
  65             "from_header",
  66             "reply_to_header",
  67             "cc_header",
  68             "bcc_header",
  69             "subject",
  70             "body",
  71         ]
  72 
  73     def __init__(self, *args, **kwargs):
  74         super().__init__(*args, **kwargs)
  75 
  76         array_email_field_help_text = "Separate email addresses with a comma"
  77         self.fields["to_header"].help_text = array_email_field_help_text
  78         self.fields["cc_header"].help_text = array_email_field_help_text
  79         self.fields["bcc_header"].help_text = array_email_field_help_text
  80 
  81 
  82 class ScheduledEmailRescheduleForm(forms.Form):
  83     scheduled_at = forms.SplitDateTimeField(
  84         label=ScheduledEmail._meta.get_field("scheduled_at").verbose_name,
  85         help_text="Time in UTC",
  86     )
  87 
  88     helper = BootstrapHelper(submit_label="Update")
  89 
  90 
  91 class ScheduledEmailCancelForm(forms.Form):
  92     confirm = forms.CharField(required=False)
  93     decline = forms.CharField(required=False)
  94
  [end of amy/emails/forms.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/amy/emails/forms.py b/amy/emails/forms.py
  --- a/amy/emails/forms.py
  +++ b/amy/emails/forms.py
  @@ -1,3 +1,5 @@
  +from datetime import UTC, datetime
  +
   from django import forms
   from markdownx.fields import MarkdownxFormField
   
  @@ -87,6 +89,14 @@
   
       helper = BootstrapHelper(submit_label="Update")
   
  +    def clean_scheduled_at(self):
  +        scheduled_at = self.cleaned_data["scheduled_at"]
  +
  +        if scheduled_at < datetime.now(tz=UTC):
  +            raise forms.ValidationError("Scheduled time cannot be in the past.")
  +
  +        return scheduled_at
  +
   
   class ScheduledEmailCancelForm(forms.Form):
       confirm = forms.CharField(required=False)
  
verification_info: {"golden_diff": "diff --git a/amy/emails/forms.py b/amy/emails/forms.py\n--- a/amy/emails/forms.py\n+++ b/amy/emails/forms.py\n@@ -1,3 +1,5 @@\n+from datetime import UTC, datetime\n+\n from django import forms\n from markdownx.fields import MarkdownxFormField\n \n@@ -87,6 +89,14 @@\n \n     helper = BootstrapHelper(submit_label=\"Update\")\n \n+    def clean_scheduled_at(self):\n+        scheduled_at = self.cleaned_data[\"scheduled_at\"]\n+\n+        if scheduled_at < datetime.now(tz=UTC):\n+            raise forms.ValidationError(\"Scheduled time cannot be in the past.\")\n+\n+        return scheduled_at\n+\n \n class ScheduledEmailCancelForm(forms.Form):\n     confirm = forms.CharField(required=False)\n", "issue": "Require email reschedule date/time to be in the future\nCurrently past date/time values are allowed. \n", "before_files": [{"content": "from django import forms\nfrom markdownx.fields import MarkdownxFormField\n\nfrom emails.models import EmailTemplate, ScheduledEmail\nfrom emails.signals import SignalNameEnum\nfrom workshops.forms import BootstrapHelper\n\n\nclass EmailTemplateCreateForm(forms.ModelForm):\n    body = MarkdownxFormField(\n        label=EmailTemplate._meta.get_field(\"body\").verbose_name,\n        help_text=EmailTemplate._meta.get_field(\"body\").help_text,\n        widget=forms.Textarea,\n    )\n    signal = forms.CharField(\n        help_text=EmailTemplate._meta.get_field(\"signal\").help_text,\n        widget=forms.Select(choices=SignalNameEnum.choices()),\n    )\n\n    class Meta:\n        model = EmailTemplate\n        fields = [\n            \"name\",\n            \"active\",\n            \"signal\",\n            \"from_header\",\n            \"reply_to_header\",\n            \"cc_header\",\n            \"bcc_header\",\n            \"subject\",\n            \"body\",\n        ]\n\n    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n\n        array_email_field_help_text = \"Separate email addresses with a comma\"\n        self.fields[\"cc_header\"].help_text = array_email_field_help_text\n        self.fields[\"bcc_header\"].help_text = array_email_field_help_text\n\n\nclass EmailTemplateUpdateForm(EmailTemplateCreateForm):\n    signal = forms.CharField(\n        required=False,\n        disabled=True,\n        help_text=EmailTemplate._meta.get_field(\"signal\").help_text,\n        widget=forms.Select(choices=SignalNameEnum.choices()),\n    )\n\n    class Meta(EmailTemplateCreateForm.Meta):\n        pass\n\n\nclass ScheduledEmailUpdateForm(forms.ModelForm):\n    body = MarkdownxFormField(\n        label=ScheduledEmail._meta.get_field(\"body\").verbose_name,\n        help_text=ScheduledEmail._meta.get_field(\"body\").help_text,\n        widget=forms.Textarea,\n    )\n\n    class Meta:\n        model = ScheduledEmail\n        fields = [\n            \"to_header\",\n            \"from_header\",\n            \"reply_to_header\",\n            \"cc_header\",\n            \"bcc_header\",\n            \"subject\",\n            \"body\",\n        ]\n\n    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n\n        array_email_field_help_text = \"Separate email addresses with a comma\"\n        self.fields[\"to_header\"].help_text = array_email_field_help_text\n        self.fields[\"cc_header\"].help_text = array_email_field_help_text\n        self.fields[\"bcc_header\"].help_text = array_email_field_help_text\n\n\nclass ScheduledEmailRescheduleForm(forms.Form):\n    scheduled_at = forms.SplitDateTimeField(\n        label=ScheduledEmail._meta.get_field(\"scheduled_at\").verbose_name,\n        help_text=\"Time in UTC\",\n    )\n\n    helper = BootstrapHelper(submit_label=\"Update\")\n\n\nclass ScheduledEmailCancelForm(forms.Form):\n    confirm = forms.CharField(required=False)\n    decline = forms.CharField(required=False)\n", "path": "amy/emails/forms.py"}]}