Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Boodle
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Martina Therese R. Reyes
Boodle
Commits
da314e13
Commit
da314e13
authored
May 01, 2022
by
Felizia Tiburcio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jquery datepicker plugin
parent
94336cf2
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
12 deletions
+29
-12
base.html
boodlesite/templates/base.html
+6
-0
startauction.html
boodlesite/templates/startauction.html
+13
-1
forms.py
main/forms.py
+10
-11
No files found.
boodlesite/templates/base.html
View file @
da314e13
...
...
@@ -70,7 +70,13 @@
<script
type=
"text/javascript"
src=
"//code.jquery.com/jquery-1.11.0.min.js"
></script>
<script
type=
"text/javascript"
src=
"//code.jquery.com/jquery-migrate-1.2.1.min.js"
></script>
<script
type=
"text/javascript"
src=
"{% static 'slick/slick.min.js' %}"
></script>
<!-- <link rel="stylesheet" type="text/css" href="{% static ' build/jquery.datetimepicker.css' %}"/ >
<script src="{% static '/build/jquery.datetimepicker.full.min.js' %}"></script> -->
<script
src=
"https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity=
"sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin=
"anonymous"
></script>
<link
rel=
"stylesheet"
href=
"https://cdnjs.cloudflare.com/ajax/libs/jquery-datetimepicker/2.5.20/jquery.datetimepicker.min.css"
integrity=
"sha256-DOS9W6NR+NFe1fUhEE0PGKY/fubbUCnOfTje2JMDw3Y="
crossorigin=
"anonymous"
/>
<script
src=
"https://cdnjs.cloudflare.com/ajax/libs/jquery-datetimepicker/2.5.20/jquery.datetimepicker.full.min.js"
integrity=
"sha256-FEqEelWI3WouFOo2VWP/uJfs1y8KJ++FLh2Lbqc8SJk="
crossorigin=
"anonymous"
></script>
</body>
...
...
boodlesite/templates/startauction.html
View file @
da314e13
...
...
@@ -14,10 +14,22 @@
{% csrf_token %}
{{ form.as_p }}
<button
type=
"submit"
name=
"savesauction"
>
S
ave
Auction
</button>
<button
type=
"submit"
name=
"savesauction"
>
S
tart
Auction
</button>
</form>
</div>
<input
id=
"datetimepicker"
type=
"text"
>
<script>
$
(
function
()
{
$
(
"#id_auctionstart"
).
datetimepicker
();
});
$
(
function
()
{
$
(
"#id_auctionend"
).
datetimepicker
();
});
</script>
<!-- Form fields:
[Auction Title]
[Auction Description]
...
...
main/forms.py
View file @
da314e13
...
...
@@ -59,8 +59,12 @@ class DeleteItemForm(forms.Form):
class
StartAuctionForm
(
forms
.
ModelForm
):
# the widget is supposed to have a pop up but not showing, keeping here bc it separates date and time nicely
auctionstart
=
forms
.
SplitDateTimeField
(
widget
=
AdminSplitDateTime
())
auctionend
=
forms
.
SplitDateTimeField
(
widget
=
AdminSplitDateTime
())
# auctionstart = forms.SplitDateTimeField(widget=AdminSplitDateTime())
# auctionend = forms.SplitDateTimeField(widget=AdminSplitDateTime())
# auctionstart = forms.DateTimeField(input_formats=['%d/%m/%Y %H:%M'])
# auctionend = forms.DateTimeField(input_formats=['%d/%m/%Y %H:%M'])
class
Meta
:
...
...
@@ -75,17 +79,12 @@ class StartAuctionForm(forms.ModelForm):
'itemid'
:
_
(
'Item up for auction'
)
}
# datetime_format = ['%Y-%m-%d %H:%M']
# widgets = { 'auctionstart' : forms.AdminSplitDateTime()} #, 'auctionend' : forms.SplitDateTimeField()}
# vv fix later, is missing time widget
# widgets = { 'auctionstart' : forms.SelectDateWidget, 'auctionend':forms.SelectDateWidget}
# 'itemid': forms.HiddenInput()}
def
clean
(
self
):
super
()
.
clean
()
end_time
=
self
.
cleaned_data
[
'auctionend'
]
start_time
=
self
.
cleaned_data
[
'auctionstart'
]
print
(
self
.
cleaned_data
)
end_time
=
self
.
cleaned_data
.
get
(
'auctionend'
)
start_time
=
self
.
cleaned_data
.
get
(
'auctionstart'
)
current_date
=
timezone
.
now
()
auctioned_item
=
self
.
cleaned_data
[
'itemid'
]
...
...
@@ -95,7 +94,7 @@ class StartAuctionForm(forms.ModelForm):
if
start_time
>
end_time
:
raise
ValidationError
(
'Start date should be before end date.'
)
elif
start_time
<
current_date
or
end_time
<
current_date
:
raise
ValidationError
(
'Date cannot be in the past'
)
raise
ValidationError
(
'Date cannot be in the past
.
'
)
else
:
for
auc
in
auctions
:
if
auc
.
itemid
==
auctioned_item
:
...
...
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