Commit 28ab44eb authored by Daniel W Bond's avatar Daniel W Bond Committed by Mark Stenglein
Browse files

created urls, added model method

parent 92d1e2c2
...@@ -149,6 +149,12 @@ class Bid(TimeStampedModel): ...@@ -149,6 +149,12 @@ class Bid(TimeStampedModel):
slug = RandomSlugField(length=6) 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): def __unicode__(self):
return '%s\'s bid for $%s' % (self.bidder, str(self.price)) return '%s\'s bid for $%s' % (self.bidder, str(self.price))
...@@ -204,6 +210,8 @@ class BidFlag(TimeStampedModel): ...@@ -204,6 +210,8 @@ class BidFlag(TimeStampedModel):
flagger = models.ForeignKey(Student) flagger = models.ForeignKey(Student)
bid = models.ForeignKey(Bid) bid = models.ForeignKey(Bid)
reason = models.CharField(choices=FLAGGING_REASON_CHOICES, max_length=30,)
slug = RandomSlugField(length=6) slug = RandomSlugField(length=6)
def __unicode__(self): def __unicode__(self):
......
...@@ -3,9 +3,10 @@ from django.conf.urls import patterns, url ...@@ -3,9 +3,10 @@ from django.conf.urls import patterns, url
from django.views.decorators.cache import cache_page from django.views.decorators.cache import cache_page
# imports from your apps # imports from your apps
from .views import ListListings, CreateListing, ListingPage,\ from .views import ListListings, CreateListing, ListingPage,\
CreateFlag, DeleteFlag, EditListing, ExchangeListing,\ CreateFlag, DeleteFlag, CreateBidFlag, DeleteBidFlag,\
UnExchangeListing, CancelListing, ReopenListing, CreateRating,\ EditListing, ExchangeListing, UnExchangeListing, CancelListing,\
EditRating, DeleteRating, EditBid, DeleteListing ReopenListing, CreateRating, EditRating, DeleteRating,\
EditBid, DeleteListing
urlpatterns = patterns('', urlpatterns = patterns('',
...@@ -30,6 +31,12 @@ urlpatterns = patterns('', ...@@ -30,6 +31,12 @@ urlpatterns = patterns('',
url(r'^listing/(?P<listing_slug>[\w-]+)/flag/(?P<slug>[\w-]+)/remove/$', url(r'^listing/(?P<listing_slug>[\w-]+)/flag/(?P<slug>[\w-]+)/remove/$',
DeleteFlag.as_view(), name='delete_flag'), 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/$', url(r'^listing/(?P<slug>[\w-]+)/edit/$',
EditListing.as_view(), name='edit_listing'), 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