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
bookshare
Commits
e1263304
Commit
e1263304
authored
Apr 11, 2015
by
Daniel W Bond
Browse files
changed includes to excludes, fixed dates fields
parent
417c85ab
Changes
2
Hide whitespace changes
Inline
Side-by-side
bookshare/trades/forms.py
View file @
e1263304
...
...
@@ -43,7 +43,7 @@ class ListingForm( forms.ModelForm ):
class
Meta
:
model
=
Listing
ex
clude
=
(
's
old'
,
'cancelled'
,
'email_message'
,
'winning_bid'
,
'date_closed'
)
in
clude
=
(
's
eller'
,
'isbn'
,
'title'
,
'author'
,
'edition'
,
'year'
,
'condition'
,
'access_code'
,
'price'
,
'photo'
,
'description'
,
)
class
BidForm
(
forms
.
ModelForm
):
...
...
@@ -73,6 +73,7 @@ class BidForm( forms.ModelForm ):
class
Meta
:
model
=
Bid
include
=
(
'bidder'
,
'listing'
,
'price'
,
'text'
,)
class
FlagForm
(
forms
.
ModelForm
):
...
...
@@ -98,6 +99,7 @@ class FlagForm( forms.ModelForm ):
class
Meta
:
model
=
Flag
include
=
(
'flagger'
,
'listing'
,
'reason'
,)
#class EditListingForm( forms.ModelForm ):
...
...
@@ -129,7 +131,7 @@ class SellListingForm( forms.ModelForm ):
class
Meta
:
model
=
Listing
ex
clude
=
(
's
eller'
,
'title'
,
'author'
,
'isbn'
,
'year'
,
'edition'
,
'condition'
,
'access_code'
,
'description'
,
'price'
,
'photo'
,
'cancelled
'
,
)
in
clude
=
(
's
old'
,
'winning_bid'
,
'date_closed'
,
'email_message
'
,)
class
UnSellListingForm
(
forms
.
ModelForm
):
...
...
@@ -150,7 +152,7 @@ class UnSellListingForm( forms.ModelForm ):
class
Meta
:
model
=
Listing
ex
clude
=
(
's
eller'
,
'title'
,
'author'
,
'isbn'
,
'year'
,
'edition'
,
'condition'
,
'access_code'
,
'description'
,
'price'
,
'photo'
,
'cancelled'
,
'email_message'
)
in
clude
=
(
's
old'
,
'winning_bid'
,
'date_closed'
,
)
class
CancelListingForm
(
forms
.
ModelForm
):
...
...
@@ -170,7 +172,7 @@ class CancelListingForm( forms.ModelForm ):
class
Meta
:
model
=
Listing
ex
clude
=
(
'
seller'
,
'title'
,
'author'
,
'isbn'
,
'year'
,
'edition'
,
'condition'
,
'access_code'
,
'description'
,
'price'
,
'photo'
,
'sold'
,
'email_message'
,
'winning_bi
d'
,)
in
clude
=
(
'
cancelled'
,
'date_close
d'
,)
class
ReopenListingForm
(
forms
.
ModelForm
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
...
...
@@ -179,6 +181,7 @@ class ReopenListingForm( forms.ModelForm ):
self
.
helper
.
layout
=
Layout
(
Fieldset
(
""
,
'cancelled'
,
'date_closed'
,
FormActions
(
Submit
(
'submit'
,
'Reopen Your Listing'
,
css_class
=
'btn-primary'
),
Button
(
'cancel'
,
'Never Mind'
,
css_class
=
'btn-default'
,
onclick
=
"history.back()"
)),
...
...
@@ -188,4 +191,4 @@ class ReopenListingForm( forms.ModelForm ):
class
Meta
:
model
=
Listing
ex
clude
=
(
'
seller'
,
'title'
,
'author'
,
'isbn'
,
'year'
,
'edition'
,
'condition'
,
'access_code'
,
'description'
,
'price'
,
'photo'
,
'sold'
,
'email_message'
,
'winning_bi
d'
,
'date_closed'
)
in
clude
=
(
'
cancelle
d'
,
'date_closed'
,
)
bookshare/trades/views.py
View file @
e1263304
...
...
@@ -316,7 +316,7 @@ class CancelListing(LoginRequiredMixin, UpdateView):
today
=
date
.
today
()
form
=
CancelListingForm
(
initial
=
{
'cancelled'
:
True
,
'date_closed'
:
''
})
form
=
CancelListingForm
(
initial
=
{
'cancelled'
:
True
,
'date_closed'
:
today
})
form
.
fields
[
'cancelled'
].
widget
=
HiddenInput
()
form
.
fields
[
'date_closed'
].
widget
=
HiddenInput
()
...
...
@@ -343,8 +343,9 @@ class ReopenListing(LoginRequiredMixin, UpdateView):
if
not
(
selling_student
==
me
):
return
HttpResponseForbidden
()
form
=
ReopenListingForm
(
initial
=
{
'cancelled'
:
False
})
form
=
ReopenListingForm
(
initial
=
{
'cancelled'
:
False
,
'date_closed'
:
''
})
form
.
fields
[
'cancelled'
].
widget
=
HiddenInput
()
form
.
fields
[
'date_closed'
].
widget
=
HiddenInput
()
context
[
'my_form'
]
=
form
...
...
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