Commit 4c259ef4 authored by Daniel W Bond's avatar Daniel W Bond
Browse files

removed extraneous whitespace, and unnecessary context_object_names when...

removed extraneous whitespace, and unnecessary context_object_names when default works (all models except bidflags), as well as redundant template_suffix_names
parent 1a849c4f
...@@ -28,7 +28,6 @@ from core.models import Student ...@@ -28,7 +28,6 @@ from core.models import Student
class ListListings(LoginRequiredMixin, ListView): class ListListings(LoginRequiredMixin, ListView):
model = Listing model = Listing
context_object_name = 'listings'
paginate_by = 16 paginate_by = 16
queryset = Listing.objects.exclude(cancelled=True).order_by('-created') queryset = Listing.objects.exclude(cancelled=True).order_by('-created')
template_name = 'list_listings.html' template_name = 'list_listings.html'
...@@ -39,10 +38,8 @@ class CreateListing(LoginRequiredMixin, FormValidMessageMixin, CreateView): ...@@ -39,10 +38,8 @@ class CreateListing(LoginRequiredMixin, FormValidMessageMixin, CreateView):
model = Listing model = Listing
template_name = 'create_listing.html' template_name = 'create_listing.html'
form_class = ListingForm form_class = ListingForm
context_object_name = 'listing'
# ISBN query! # ISBN query!
login_url = 'login' login_url = 'login'
# eventually figure out how to use {% url 'create_listing' %} # eventually figure out how to use {% url 'create_listing' %}
form_valid_message = mark_safe("""Your listing was successfully created! form_valid_message = mark_safe("""Your listing was successfully created!
<a href="/share/new/">Create another here!</a>""") <a href="/share/new/">Create another here!</a>""")
...@@ -88,18 +85,15 @@ class CreateListing(LoginRequiredMixin, FormValidMessageMixin, CreateView): ...@@ -88,18 +85,15 @@ class CreateListing(LoginRequiredMixin, FormValidMessageMixin, CreateView):
class DeleteListing(LoginRequiredMixin, SuperuserRequiredMixin, FormValidMessageMixin, DeleteView): class DeleteListing(LoginRequiredMixin, SuperuserRequiredMixin, FormValidMessageMixin, DeleteView):
model = Listing model = Listing
context_object_name = 'listing'
template_name = 'delete_listing.html' template_name = 'delete_listing.html'
form_valid_message = "The listing was successfully deleted." form_valid_message = "The listing was successfully deleted."
login_url = 'login' login_url = 'login'
success_url = reverse_lazy('flag_mod') success_url = reverse_lazy('flag_mod')
# These next three views are tied together... # These next three views are tied together...
class DetailListing(LoginRequiredMixin, DetailView): class DetailListing(LoginRequiredMixin, DetailView):
model = Listing model = Listing
context_object_name = 'listing'
template_name = 'detail_listing.html' template_name = 'detail_listing.html'
login_url = 'login' login_url = 'login'
...@@ -146,7 +140,6 @@ class DetailListing(LoginRequiredMixin, DetailView): ...@@ -146,7 +140,6 @@ class DetailListing(LoginRequiredMixin, DetailView):
class DetailListingNoAuth(DetailView): class DetailListingNoAuth(DetailView):
model = Listing model = Listing
context_object_name = 'listing'
template_name = 'detail_listing_no_auth.html' template_name = 'detail_listing_no_auth.html'
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
...@@ -160,9 +153,7 @@ class DetailListingNoAuth(DetailView): ...@@ -160,9 +153,7 @@ class DetailListingNoAuth(DetailView):
class CreateBid(LoginRequiredMixin, CreateView): class CreateBid(LoginRequiredMixin, CreateView):
model = Bid model = Bid
fields = ['listing', 'price', 'text', ] fields = ['listing', 'price', 'text', ]
context_object_name = 'bid'
template_name = 'detail_listing.html' template_name = 'detail_listing.html'
login_url = 'login' login_url = 'login'
def form_valid(self, form): def form_valid(self, form):
...@@ -207,10 +198,8 @@ class CreateFlag(LoginRequiredMixin, CreateView): ...@@ -207,10 +198,8 @@ class CreateFlag(LoginRequiredMixin, CreateView):
model = Flag model = Flag
template_name = 'create_flag.html' template_name = 'create_flag.html'
form_class = FlagForm form_class = FlagForm
context_object_name = 'flag'
login_url = 'login' login_url = 'login'
def parse_url_for_listing(self, request): def parse_url_for_listing(self, request):
# there's possibly a better way than url parsing, but here we are # there's possibly a better way than url parsing, but here we are
current_url = request.get_full_path() current_url = request.get_full_path()
...@@ -260,7 +249,6 @@ class CreateFlag(LoginRequiredMixin, CreateView): ...@@ -260,7 +249,6 @@ class CreateFlag(LoginRequiredMixin, CreateView):
class DeleteFlag(LoginRequiredMixin, FormValidMessageMixin, DeleteView): class DeleteFlag(LoginRequiredMixin, FormValidMessageMixin, DeleteView):
model = Flag model = Flag
context_object_name = 'flag'
template_name = 'delete_flag.html' template_name = 'delete_flag.html'
form_valid_message = "Your flag was successfully deleted." form_valid_message = "Your flag was successfully deleted."
login_url = 'login' login_url = 'login'
...@@ -368,12 +356,9 @@ class DeleteBid(LoginRequiredMixin, DeleteView): ...@@ -368,12 +356,9 @@ class DeleteBid(LoginRequiredMixin, DeleteView):
class EditBid(LoginRequiredMixin, FormValidMessageMixin, UpdateView): class EditBid(LoginRequiredMixin, FormValidMessageMixin, UpdateView):
model = Bid model = Bid
template_name = 'bid_edit.html' template_name = 'bid_edit.html'
context_object_name = 'bid'
# form_class = EditBidForm # form_class = EditBidForm
fields = ['price', 'text', ] fields = ['price', 'text', ]
login_url = 'login' login_url = 'login'
form_valid_message = "Your bid was successfully updated!" form_valid_message = "Your bid was successfully updated!"
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
...@@ -398,13 +383,10 @@ class EditBid(LoginRequiredMixin, FormValidMessageMixin, UpdateView): ...@@ -398,13 +383,10 @@ class EditBid(LoginRequiredMixin, FormValidMessageMixin, UpdateView):
class EditListing(LoginRequiredMixin, FormValidMessageMixin, UpdateView): class EditListing(LoginRequiredMixin, FormValidMessageMixin, UpdateView):
model = Listing model = Listing
template_name = 'listing_edit.html' template_name = 'listing_edit.html'
context_object_name = 'listing'
# form_class = EditListingForm # form_class = EditListingForm
fields = ['title', 'author', 'isbn', 'year', 'edition', 'condition', fields = ['title', 'author', 'isbn', 'year', 'edition', 'condition',
'access_code', 'description', 'price', 'photo', ] 'access_code', 'description', 'price', 'photo', ]
login_url = 'login' login_url = 'login'
form_valid_message = "Your listing was successfully updated!" form_valid_message = "Your listing was successfully updated!"
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
...@@ -426,10 +408,8 @@ class EditListing(LoginRequiredMixin, FormValidMessageMixin, UpdateView): ...@@ -426,10 +408,8 @@ class EditListing(LoginRequiredMixin, FormValidMessageMixin, UpdateView):
class ExchangeListing(LoginRequiredMixin, FormValidMessageMixin, UpdateView): class ExchangeListing(LoginRequiredMixin, FormValidMessageMixin, UpdateView):
model = Listing model = Listing
fields = ['email_message', 'winning_bid', ] fields = ['email_message', 'winning_bid', ]
context_object_name = 'listing'
template_name = 'listing_exchange.html' template_name = 'listing_exchange.html'
login_url = 'login' login_url = 'login'
form_valid_message = "Your email was successfully sent!" form_valid_message = "Your email was successfully sent!"
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
...@@ -509,11 +489,9 @@ class ExchangeListing(LoginRequiredMixin, FormValidMessageMixin, UpdateView): ...@@ -509,11 +489,9 @@ class ExchangeListing(LoginRequiredMixin, FormValidMessageMixin, UpdateView):
class UnExchangeListing(LoginRequiredMixin, FormValidMessageMixin, UpdateView): class UnExchangeListing(LoginRequiredMixin, FormValidMessageMixin, UpdateView):
model = Listing model = Listing
context_object_name = 'listing'
template_name = 'listing_unexchange.html' template_name = 'listing_unexchange.html'
form_class = UnExchangeListingForm form_class = UnExchangeListingForm
login_url = 'login' login_url = 'login'
form_valid_message = """Your exchange has been successfully cancelled, form_valid_message = """Your exchange has been successfully cancelled,
and your email successfully sent!""" and your email successfully sent!"""
...@@ -578,11 +556,8 @@ class UnExchangeListing(LoginRequiredMixin, FormValidMessageMixin, UpdateView): ...@@ -578,11 +556,8 @@ class UnExchangeListing(LoginRequiredMixin, FormValidMessageMixin, UpdateView):
class CancelListing(LoginRequiredMixin, FormValidMessageMixin, UpdateView): class CancelListing(LoginRequiredMixin, FormValidMessageMixin, UpdateView):
model = Listing model = Listing
fields = [] fields = []
template_suffix_name = '_cancel'
context_object_name = 'listing'
template_name = 'listing_cancel.html' template_name = 'listing_cancel.html'
login_url = 'login' login_url = 'login'
form_valid_message = "Your listing was successfully cancelled!" form_valid_message = "Your listing was successfully cancelled!"
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
...@@ -611,8 +586,6 @@ class CancelListing(LoginRequiredMixin, FormValidMessageMixin, UpdateView): ...@@ -611,8 +586,6 @@ class CancelListing(LoginRequiredMixin, FormValidMessageMixin, UpdateView):
class ReopenListing(LoginRequiredMixin, FormValidMessageMixin, UpdateView): class ReopenListing(LoginRequiredMixin, FormValidMessageMixin, UpdateView):
model = Listing model = Listing
fields = [] fields = []
template_suffix_name = '_reopen'
context_object_name = 'listing'
template_name = 'listing_reopen.html' template_name = 'listing_reopen.html'
login_url = 'login' login_url = 'login'
...@@ -643,7 +616,6 @@ class CreateRating(LoginRequiredMixin, CreateView): ...@@ -643,7 +616,6 @@ class CreateRating(LoginRequiredMixin, CreateView):
model = Rating model = Rating
template_name = 'create_rating.html' template_name = 'create_rating.html'
form_class = RatingForm form_class = RatingForm
context_object_name = 'rating'
login_url = 'login' login_url = 'login'
def parse_url_for_listing(self, request): def parse_url_for_listing(self, request):
...@@ -696,10 +668,8 @@ class CreateRating(LoginRequiredMixin, CreateView): ...@@ -696,10 +668,8 @@ class CreateRating(LoginRequiredMixin, CreateView):
class EditRating(LoginRequiredMixin, UpdateView): class EditRating(LoginRequiredMixin, UpdateView):
model = Rating model = Rating
template_name = 'rating_edit.html' template_name = 'rating_edit.html'
context_object_name = 'rating'
# form_class = EditListingForm # form_class = EditListingForm
login_url = 'login' login_url = 'login'
fields = ['stars', 'review', ] fields = ['stars', 'review', ]
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
...@@ -719,7 +689,6 @@ class EditRating(LoginRequiredMixin, UpdateView): ...@@ -719,7 +689,6 @@ class EditRating(LoginRequiredMixin, UpdateView):
class DeleteRating(LoginRequiredMixin, FormValidMessageMixin, DeleteView): class DeleteRating(LoginRequiredMixin, FormValidMessageMixin, DeleteView):
model = Rating model = Rating
context_object_name = 'rating'
template_name = 'delete_rating.html' template_name = 'delete_rating.html'
form_valid_message = "Your rating was successfully deleted." form_valid_message = "Your rating was successfully deleted."
login_url = 'login' login_url = 'login'
......
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