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
13cc9b2b
Commit
13cc9b2b
authored
Aug 24, 2015
by
Daniel W Bond
Browse files
created urls, added model method
parent
2aa40235
Changes
2
Hide whitespace changes
Inline
Side-by-side
bookshare/trades/models.py
View file @
13cc9b2b
...
...
@@ -149,6 +149,12 @@ class Bid(TimeStampedModel):
slug
=
RandomSlugField
(
length
=
6
)
def
too_many_flags
(
self
):
if
BidFlag
.
objects
.
filter
(
bid
=
self
).
count
()
>
0
:
return
True
else
:
return
False
def
__unicode__
(
self
):
return
'%s
\'
s bid for $%s'
%
(
self
.
bidder
,
str
(
self
.
price
))
...
...
@@ -204,6 +210,8 @@ class BidFlag(TimeStampedModel):
flagger
=
models
.
ForeignKey
(
Student
)
bid
=
models
.
ForeignKey
(
Bid
)
reason
=
models
.
CharField
(
choices
=
FLAGGING_REASON_CHOICES
,
max_length
=
30
,)
slug
=
RandomSlugField
(
length
=
6
)
def
__unicode__
(
self
):
...
...
bookshare/trades/urls.py
View file @
13cc9b2b
...
...
@@ -3,9 +3,10 @@ from django.conf.urls import patterns, url
from
django.views.decorators.cache
import
cache_page
# imports from your apps
from
.views
import
ListListings
,
CreateListing
,
ListingPage
,
\
CreateFlag
,
DeleteFlag
,
EditListing
,
ExchangeListing
,
\
UnExchangeListing
,
CancelListing
,
ReopenListing
,
CreateRating
,
\
EditRating
,
DeleteRating
,
EditBid
,
DeleteListing
CreateFlag
,
DeleteFlag
,
CreateBidFlag
,
DeleteBidFlag
,
\
EditListing
,
ExchangeListing
,
UnExchangeListing
,
CancelListing
,
\
ReopenListing
,
CreateRating
,
EditRating
,
DeleteRating
,
\
EditBid
,
DeleteListing
urlpatterns
=
patterns
(
''
,
...
...
@@ -30,6 +31,12 @@ urlpatterns = patterns('',
url
(
r
'^listing/(?P<listing_slug>[\w-]+)/flag/(?P<slug>[\w-]+)/remove/$'
,
DeleteFlag
.
as_view
(),
name
=
'delete_flag'
),
url
(
r
'^listing/(?P<listing_slug>[\w-]+)/bid/(?P<slug>[\w-]+)/flag/$'
,
CreateBidFlag
.
as_view
(),
name
=
'create_bid_flag'
),
url
(
r
'^listing/(?P<listing_slug>[\w-]+)/bid/(?P<bid_slug>[\w-]+)/flag/(?P<slug>[\w-]+)/remove/$'
,
DeleteBidFlag
.
as_view
(),
name
=
'delete_bid_flag'
),
url
(
r
'^listing/(?P<slug>[\w-]+)/edit/$'
,
EditListing
.
as_view
(),
name
=
'edit_listing'
),
...
...
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