Commit 13cc9b2b authored by Daniel W Bond's avatar Daniel W Bond
Browse files

created urls, added model method

parent 2aa40235
......@@ -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):
......
......@@ -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'),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment