Commit b677357a authored by Daniel W Bond's avatar Daniel W Bond
Browse files

housekeeping and comments

parent cdaeda1e
...@@ -40,6 +40,8 @@ class Listing(TimeStampedModel): ...@@ -40,6 +40,8 @@ class Listing(TimeStampedModel):
(AC_NOT_INCLUDED, 'Access Code NOT Included'), (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) poster = models.ForeignKey(Student)
title = models.CharField(max_length=200) title = models.CharField(max_length=200)
...@@ -68,6 +70,7 @@ class Listing(TimeStampedModel): ...@@ -68,6 +70,7 @@ class Listing(TimeStampedModel):
default='listing_photos/default_listing_photo.jpg') default='listing_photos/default_listing_photo.jpg')
# these remaining fields are for internal usage, not for users # 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) exchanged = models.BooleanField(default=False)
cancelled = models.BooleanField(default=False) cancelled = models.BooleanField(default=False)
......
...@@ -21,7 +21,7 @@ urlpatterns = patterns('', ...@@ -21,7 +21,7 @@ urlpatterns = patterns('',
url(r'^listing/(?P<slug>[\w-]+)/delete/$', url(r'^listing/(?P<slug>[\w-]+)/delete/$',
DeleteListing.as_view(), name='delete_listing'), 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'), EditBid.as_view(), name='edit_bid'),
url(r'^listing/(?P<slug>[\w-]+)/flag/$', url(r'^listing/(?P<slug>[\w-]+)/flag/$',
......
...@@ -315,8 +315,6 @@ class EditBid(LoginRequiredMixin, FormValidMessageMixin, UpdateView): ...@@ -315,8 +315,6 @@ class EditBid(LoginRequiredMixin, FormValidMessageMixin, UpdateView):
fields = ['price', 'text', ] fields = ['price', 'text', ]
success_url = '/'
def get_success_url(self): def get_success_url(self):
return reverse('detail_listing', return reverse('detail_listing',
kwargs={'slug': self.object.listing.slug}) kwargs={'slug': self.object.listing.slug})
...@@ -349,7 +347,6 @@ class EditListing(LoginRequiredMixin, FormValidMessageMixin, UpdateView): ...@@ -349,7 +347,6 @@ class EditListing(LoginRequiredMixin, FormValidMessageMixin, UpdateView):
fields = ['title', 'author', 'isbn', 'year', 'edition', 'condition', fields = ['title', 'author', 'isbn', 'year', 'edition', 'condition',
'access_code', 'description', 'price', 'photo', ] 'access_code', 'description', 'price', 'photo', ]
template_suffix_name = '_edit'
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super(EditListing, self).get_context_data(**kwargs) context = super(EditListing, self).get_context_data(**kwargs)
......
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