Commit 46e02ce9 authored by Matthew Rodgers's avatar Matthew Rodgers Committed by David Haynes
Browse files

Updated Custom Date Option

--User can no longer enter a ddate from the past.
--Custom field now stays open when the custom button is selected.
parent 2cfa85fe
......@@ -2,6 +2,7 @@
from django import forms
from django.core.exceptions import ValidationError
from django.utils.safestring import mark_safe
from django.utils import timezone
# App Imports
from go.models import URL, RegisteredUser
......@@ -12,6 +13,7 @@ from crispy_forms.layout import Layout, Fieldset, Submit, HTML, Div, Field
from crispy_forms.bootstrap import StrictButton, PrependedText, Accordion, AccordionGroup
from bootstrap3_datetime.widgets import DateTimePicker
import datetime
from datetime import date
class URLForm(forms.ModelForm):
......@@ -74,23 +76,30 @@ class URLForm(forms.ModelForm):
def valid_date(value):
if value >
raise ValidationError('Date can\'t be before today.')
# Add a custom expiration choice.
expires_custom = forms.DateTimeField(
required = False,
label='Custom Date',
"format": "MM-DD-YYYY",
"pickTime": False,
"defaultDate": "4-20-2016",
"defaultDate": True,
"class": "fa fa-calendar",
def __init__(self, *args, **kwargs):
# Grab that host info = kwargs.pop('host', None)
......@@ -8,7 +8,12 @@ Go - A University Branded URL Shortener
{% block content %}
<script type="text/javascript">
$(function() {
if ($("#id_expires_5").is(":checked")) {
} else {
$("#div_id_expires").click(function() {
if ($("#id_expires_5").is(":checked")) {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment