Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
go
Commits
7fe38725
Commit
7fe38725
authored
Apr 13, 2016
by
Matthew Rodgers
Committed by
David Haynes
Apr 26, 2016
Browse files
--Added a custom date option to URL Expiration.
--Added a DateTimePicker for custom date option.
parent
e4a87b0e
Changes
1
Hide whitespace changes
Inline
Side-by-side
go/go/forms.py
View file @
7fe38725
...
...
@@ -10,6 +10,7 @@ from go.models import URL, RegisteredUser
from
crispy_forms.helper
import
FormHelper
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
class
URLForm
(
forms
.
ModelForm
):
...
...
@@ -52,6 +53,7 @@ class URLForm(forms.ModelForm):
DAY
=
'1 Day'
WEEK
=
'1 Week'
MONTH
=
'1 Month'
CUSTOM
=
'Custom Date'
NEVER
=
'Never'
EXPIRATION_CHOICES
=
(
...
...
@@ -59,6 +61,7 @@ class URLForm(forms.ModelForm):
(
WEEK
,
WEEK
),
(
MONTH
,
MONTH
),
(
NEVER
,
NEVER
),
(
CUSTOM
,
CUSTOM
),
)
# Add a custom expiration choice field.
...
...
@@ -70,6 +73,10 @@ class URLForm(forms.ModelForm):
widget
=
forms
.
RadioSelect
(),
)
expires_custom
=
forms
.
DateTimeField
(
widget
=
DateTimePicker
(
options
=
{
"format"
:
"YYYY-MM-DD"
,
"pickTime"
:
False
})
)
def
__init__
(
self
,
*
args
,
**
kwargs
):
# Grab that host info
...
...
@@ -119,6 +126,7 @@ class URLForm(forms.ModelForm):
<h4>Set when you would like your Go address to expire:</h4>
<br />"""
),
'expires'
,
'expires_custom'
,
style
=
"background: rgb(#F6F6F6);"
),
active
=
True
,
template
=
'crispy/accordian-group.html'
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment