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
Jean Michel Rouly
bookshare
Commits
b677357a
Commit
b677357a
authored
Apr 25, 2015
by
Daniel W Bond
Browse files
housekeeping and comments
parent
cdaeda1e
Changes
3
Hide whitespace changes
Inline
Side-by-side
bookshare/trades/models.py
View file @
b677357a
...
...
@@ -40,6 +40,8 @@ class Listing(TimeStampedModel):
(
AC_NOT_INCLUDED
,
'Access Code NOT Included'
),
)
# django automatically creates an index for all ForeignKey fields
# e.g. no need for 'db_index = True' on relational fields
poster
=
models
.
ForeignKey
(
Student
)
title
=
models
.
CharField
(
max_length
=
200
)
...
...
@@ -68,6 +70,7 @@ class Listing(TimeStampedModel):
default
=
'listing_photos/default_listing_photo.jpg'
)
# these remaining fields are for internal usage, not for users
# possibly should be indexed-- used commonly on .exclude() or .filter()
exchanged
=
models
.
BooleanField
(
default
=
False
)
cancelled
=
models
.
BooleanField
(
default
=
False
)
...
...
bookshare/trades/urls.py
View file @
b677357a
...
...
@@ -21,7 +21,7 @@ urlpatterns = patterns('',
url
(
r
'^listing/(?P<slug>[\w-]+)/delete/$'
,
DeleteListing
.
as_view
(),
name
=
'delete_listing'
),
url
(
r
'^listing/(?P<listing_slug>[\w-]+)/bid/(?P<slug>[\w-]+)/$'
,
url
(
r
'^listing/(?P<listing_slug>[\w-]+)/bid/(?P<slug>[\w-]+)/
edit/
$'
,
EditBid
.
as_view
(),
name
=
'edit_bid'
),
url
(
r
'^listing/(?P<slug>[\w-]+)/flag/$'
,
...
...
bookshare/trades/views.py
View file @
b677357a
...
...
@@ -315,8 +315,6 @@ class EditBid(LoginRequiredMixin, FormValidMessageMixin, UpdateView):
fields
=
[
'price'
,
'text'
,
]
success_url
=
'/'
def
get_success_url
(
self
):
return
reverse
(
'detail_listing'
,
kwargs
=
{
'slug'
:
self
.
object
.
listing
.
slug
})
...
...
@@ -349,7 +347,6 @@ class EditListing(LoginRequiredMixin, FormValidMessageMixin, UpdateView):
fields
=
[
'title'
,
'author'
,
'isbn'
,
'year'
,
'edition'
,
'condition'
,
'access_code'
,
'description'
,
'price'
,
'photo'
,
]
template_suffix_name
=
'_edit'
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
EditListing
,
self
).
get_context_data
(
**
kwargs
)
...
...
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