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

improved variable name seller --> poster

parent 1a9d8079
...@@ -83,7 +83,7 @@ SRCT Bookshare • {{ student.user.get_full_name }} ...@@ -83,7 +83,7 @@ SRCT Bookshare • {{ student.user.get_full_name }}
{% if listing.exchanged %} {% if listing.exchanged %}
<span class="label label-primary"><strong>Exchanged</strong></span> <span class="label label-primary"><strong>Exchanged</strong></span>
{% if student.user == request.user %} {% if student.user == request.user %}
<small>(<a href="{% url 'unsell_listing' listing.slug %}">Cancel Exchange</a>)</small> <small>(<a href="{% url 'unexchange_listing' listing.slug %}">Cancel Exchange</a>)</small>
{% endif %} {% endif %}
{% elif listing.cancelled %} {% elif listing.cancelled %}
<span class="label label-default"><strong>Cancelled</strong></span> <span class="label label-default"><strong>Cancelled</strong></span>
......
...@@ -18,13 +18,13 @@ class DetailStudent(LoginRequiredMixin, DetailView): ...@@ -18,13 +18,13 @@ class DetailStudent(LoginRequiredMixin, DetailView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super(DetailStudent, self).get_context_data(**kwargs) context = super(DetailStudent, self).get_context_data(**kwargs)
student_listings = Listing.objects.filter(seller=self.get_object().pk) student_listings = Listing.objects.filter(poster=self.get_object().pk)
total_exchanges = student_listings.filter(exchanged=True).count() total_exchanges = student_listings.filter(exchanged=True).count()
total_proceeds = Bid.objects.filter(listing__seller__user=self.get_object()).filter(listing__exchanged=True).aggregate(Sum('price'))['price__sum'] total_proceeds = Bid.objects.filter(listing__poster__user=self.get_object()).filter(listing__exchanged=True).aggregate(Sum('price'))['price__sum']
student_ratings = Rating.objects.filter(listing__seller__user=self.get_object()) student_ratings = Rating.objects.filter(listing__poster__user=self.get_object())
if student_ratings: if student_ratings:
student_stars = [int(rating.stars) for rating in student_ratings] student_stars = [int(rating.stars) for rating in student_ratings]
print student_stars print student_stars
...@@ -53,7 +53,7 @@ class StudentRatings(LoginRequiredMixin, DetailView): ...@@ -53,7 +53,7 @@ class StudentRatings(LoginRequiredMixin, DetailView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super(StudentRatings, self).get_context_data(**kwargs) context = super(StudentRatings, self).get_context_data(**kwargs)
student_ratings = Rating.objects.filter(listing__seller__user=self.get_object()) student_ratings = Rating.objects.filter(listing__poster__user=self.get_object())
# copied code! # copied code!
if student_ratings: if student_ratings:
......
...@@ -17,7 +17,7 @@ class ListingAdmin(admin.ModelAdmin): ...@@ -17,7 +17,7 @@ class ListingAdmin(admin.ModelAdmin):
'year', 'edition', 'condition', 'description', 'year', 'edition', 'condition', 'description',
'price', 'exchanged', 'cancelled', 'winning_bid', 'price', 'exchanged', 'cancelled', 'winning_bid',
'date_closed') 'date_closed')
list_filter = ('created', 'modified', 'seller', 'condition', list_filter = ('created', 'modified', 'poster', 'condition',
'price', 'cancelled') 'price', 'cancelled')
# expand this later # expand this later
......
...@@ -114,7 +114,7 @@ class FlagForm(forms.ModelForm): ...@@ -114,7 +114,7 @@ class FlagForm(forms.ModelForm):
#class EditListingForm( forms.ModelForm ): #class EditListingForm( forms.ModelForm ):
class SellListingForm(forms.ModelForm): class ExchangeListingForm(forms.ModelForm):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
...@@ -126,7 +126,7 @@ class SellListingForm(forms.ModelForm): ...@@ -126,7 +126,7 @@ class SellListingForm(forms.ModelForm):
'winning_bid', 'winning_bid',
HTML("""<hr/ >"""), HTML("""<hr/ >"""),
HTML("""<strong>Your Email to Your Bidder</strong>"""), HTML("""<strong>Your Email to Your Bidder</strong>"""),
HTML("""<div class="well"><em><p>Hey there!</p><p>Seller {{ listing.seller.user.first_name }} {{ listing.seller.user.last_name }} has picked your bid for {{ listing.title }} on SRCT Bookshare. They're the cc'ed email address-- {{ listing.seller.user.email }}.</p><p>Watch your email to arrange all the final touches to get your book.</p></em>"""), HTML("""<div class="well"><em><p>Hey there!</p><p>Poster {{ listing.poster.user.get_full_name }} has picked your bid for {{ listing.title }} on SRCT Bookshare. They're the cc'ed email address-- {{ listing.poster.user.email }}.</p><p>Watch your email to arrange all the final touches to get your book.</p></em>"""),
Field('email_message', Field('email_message',
placeholder='Do you want to meet tomorrow by the JC Info Desk at 4?'), placeholder='Do you want to meet tomorrow by the JC Info Desk at 4?'),
HTML("""<em><p>Thanks for using SRCT Bookshare!</p><p>Mason SRCT</p></em></div>"""), HTML("""<em><p>Thanks for using SRCT Bookshare!</p><p>Mason SRCT</p></em></div>"""),
...@@ -140,7 +140,7 @@ class SellListingForm(forms.ModelForm): ...@@ -140,7 +140,7 @@ class SellListingForm(forms.ModelForm):
), ),
) )
super(SellListingForm, self).__init__(*args, **kwargs) super(ExchangeListingForm, self).__init__(*args, **kwargs)
self.fields['email_message'].label = "Custom Message" self.fields['email_message'].label = "Custom Message"
self.fields['winning_bid'].required = True self.fields['winning_bid'].required = True
self.fields['email_message'].initial = '' self.fields['email_message'].initial = ''
...@@ -149,7 +149,7 @@ class SellListingForm(forms.ModelForm): ...@@ -149,7 +149,7 @@ class SellListingForm(forms.ModelForm):
model = Listing model = Listing
class UnSellListingForm(forms.ModelForm): class UnExchangeListingForm(forms.ModelForm):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
...@@ -159,7 +159,7 @@ class UnSellListingForm(forms.ModelForm): ...@@ -159,7 +159,7 @@ class UnSellListingForm(forms.ModelForm):
self.helper.layout = Layout( self.helper.layout = Layout(
Fieldset("", Fieldset("",
HTML("""<strong>Your Email to Your Bidder</strong>"""), HTML("""<strong>Your Email to Your Bidder</strong>"""),
HTML("""<div class="well"><em><p>Hey there!</p><p>Seller {{ listing.seller.user.first_name }} {{ listing.seller.user.last_name }} has cancelled your bid for {{ listing.title }} on SRCT Bookshare.</p><p>We certainly hope that this doesn't come as a shock. :-P</p><p>(If you don't know why you're getting this email, hey're the cc'ed email address-- {{ listing.seller.user.email }}. Contact them ASAP to clear up any confusion.)<p></em>"""), HTML("""<div class="well"><em><p>Hey there!</p><p>Poster {{ listing.poster.user.get_full_name }} has cancelled your bid for {{ listing.title }} on SRCT Bookshare.</p><p>We certainly hope that this doesn't come as a shock. :-P</p><p>(If you don't know why you're getting this email, hey're the cc'ed email address-- {{ listing.poster.user.email }}. Contact them ASAP to clear up any confusion.)<p></em>"""),
Field('email_message', placeholder='I haven\'t heard from you in a couple of days, so I\'m going to have to try to exchange my textbook to someone else. :-/'), Field('email_message', placeholder='I haven\'t heard from you in a couple of days, so I\'m going to have to try to exchange my textbook to someone else. :-/'),
HTML("""<em><p>Thanks for using SRCT Bookshare!</p><p>Mason SRCT</p></em></div>"""), HTML("""<em><p>Thanks for using SRCT Bookshare!</p><p>Mason SRCT</p></em></div>"""),
HTML("""<hr/ >"""), HTML("""<hr/ >"""),
...@@ -172,7 +172,7 @@ class UnSellListingForm(forms.ModelForm): ...@@ -172,7 +172,7 @@ class UnSellListingForm(forms.ModelForm):
), ),
) )
super(UnSellListingForm, self).__init__(*args, **kwargs) super(UnExchangeListingForm, self).__init__(*args, **kwargs)
self.fields['email_message'].label = "Custom Message" self.fields['email_message'].label = "Custom Message"
self.fields['email_message'].initial = '' self.fields['email_message'].initial = ''
......
...@@ -40,7 +40,7 @@ class Listing(TimeStampedModel): ...@@ -40,7 +40,7 @@ class Listing(TimeStampedModel):
(AC_NOT_INCLUDED, 'Access Code NOT Included'), (AC_NOT_INCLUDED, 'Access Code NOT Included'),
) )
seller = models.ForeignKey(Student) poster = models.ForeignKey(Student)
title = models.CharField(max_length=200) title = models.CharField(max_length=200)
author = models.CharField(max_length=200) author = models.CharField(max_length=200)
...@@ -73,7 +73,7 @@ class Listing(TimeStampedModel): ...@@ -73,7 +73,7 @@ class Listing(TimeStampedModel):
email_message = models.TextField(blank=True, max_length=2000) email_message = models.TextField(blank=True, max_length=2000)
# future feature: tell sellers what price their book has been getting # future feature: tell posters what price their book has been getting
winning_bid = models.ForeignKey('Bid', blank=True, null=True, winning_bid = models.ForeignKey('Bid', blank=True, null=True,
related_name='winning_bid') related_name='winning_bid')
# the date either cancelled or exchanged # the date either cancelled or exchanged
...@@ -88,7 +88,7 @@ class Listing(TimeStampedModel): ...@@ -88,7 +88,7 @@ class Listing(TimeStampedModel):
modified_plus_month = self.modified.date() + relativedelta(months=1) modified_plus_month = self.modified.date() + relativedelta(months=1)
# last login + two weeks # last login + two weeks
last_login_plus_two_weeks = self.seller.last_login.date() +\ last_login_plus_two_weeks = self.poster.last_login.date() +\
relativedelta(weeks=2) relativedelta(weeks=2)
last_poked = ((today > created_plus_month) or (today > modified_plus_month)) last_poked = ((today > created_plus_month) or (today > modified_plus_month))
...@@ -118,7 +118,7 @@ class Listing(TimeStampedModel): ...@@ -118,7 +118,7 @@ class Listing(TimeStampedModel):
return '%s : %s' % (self.isbn, self.title) return '%s : %s' % (self.isbn, self.title)
class Meta: class Meta:
# unique_together = (("ISBN", "seller"),) # unique_together = (("ISBN", "poster"),)
ordering = ['isbn', 'title'] ordering = ['isbn', 'title']
...@@ -198,7 +198,7 @@ class Rating(TimeStampedModel): ...@@ -198,7 +198,7 @@ class Rating(TimeStampedModel):
def __unicode__(self): def __unicode__(self):
return "%s's review of %s" % (self.rater.user.username, return "%s's review of %s" % (self.rater.user.username,
self.listing.seller.user.username) self.listing.poster.user.username)
class Meta: class Meta:
ordering = ['rater', 'listing', 'created'] ordering = ['rater', 'listing', 'created']
...@@ -10,7 +10,7 @@ SRCT Bookshare &bull; {{ listing.title }} | Flag ...@@ -10,7 +10,7 @@ SRCT Bookshare &bull; {{ listing.title }} | Flag
<div class="row"> <div class="row">
<div class="col-lg-12 text-center"> <div class="col-lg-12 text-center">
<h1><strong>SRCT</strong>&#8203;BOOKSHARE</h1> <h1><strong>SRCT</strong>&#8203;BOOKSHARE</h1>
<p class="lead text-center"><strong>Flag {{ listing.seller.user.first_name }} {{ listing.seller.user.last_name }}'s Listing <em>{{ listing.title }}</em></strong></p> <p class="lead text-center"><strong>Flag {{ listing.poster.user.get_full_name }}'s Listing <em>{{ listing.title }}</em></strong></p>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -10,7 +10,7 @@ SRCT Bookshare &bull; {{ listing.title }} | Rate ...@@ -10,7 +10,7 @@ SRCT Bookshare &bull; {{ listing.title }} | Rate
<div class="row"> <div class="row">
<div class="col-lg-12 text-center"> <div class="col-lg-12 text-center">
<h1><strong>SRCT</strong>&#8203;BOOKSHARE</h1> <h1><strong>SRCT</strong>&#8203;BOOKSHARE</h1>
<p class="lead text-center"><strong>Rate Your Experience with {{ listing.seller.user.get_full_name}}'s Listing <em>{{ listing.title }}</em></strong></p> <p class="lead text-center"><strong>Rate Your Experience with {{ listing.poster.user.get_full_name}}'s Listing <em>{{ listing.title }}</em></strong></p>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -10,7 +10,7 @@ SRCT Bookshare &bull; {{ flag.listing.title }} &bull; Remove Flag ...@@ -10,7 +10,7 @@ SRCT Bookshare &bull; {{ flag.listing.title }} &bull; Remove Flag
<div class="row text-center"> <div class="row text-center">
<form action="" method="post">{% csrf_token %} <form action="" method="post">{% csrf_token %}
<h3>Are you sure you want to remove your flag for {{ flag.listing.seller.user.get_full_name }}'s listing <em>{{ flag.listing.title }}</em>?</h3> <h3>Are you sure you want to remove your flag for {{ flag.listing.poster.user.get_full_name }}'s listing <em>{{ flag.listing.title }}</em>?</h3>
<input type="submit" value="Confirm" class="btn btn-danger btn-sm" /> <input type="submit" value="Confirm" class="btn btn-danger btn-sm" />
<input type="submit" value="Never Mind" class="btn btn-default btn-sm" onclick="history.back()" /> <input type="submit" value="Never Mind" class="btn btn-default btn-sm" onclick="history.back()" />
</form> </form>
......
...@@ -10,7 +10,7 @@ SRCT Bookshare &bull; {{ flag.listing.title }} &bull; Delete Review ...@@ -10,7 +10,7 @@ SRCT Bookshare &bull; {{ flag.listing.title }} &bull; Delete Review
<div class="row text-center"> <div class="row text-center">
<form action="" method="post">{% csrf_token %} <form action="" method="post">{% csrf_token %}
<h3>Are you sure you want to remove your review for {{ rating.listing.seller.user.get_full_name }}'s listing <em>{{ rating.listing.title }}</em>?</h3> <h3>Are you sure you want to remove your review for {{ rating.listing.poster.user.get_full_name }}'s listing <em>{{ rating.listing.title }}</em>?</h3>
<input type="submit" value="Confirm" class="btn btn-danger btn-sm" /> <input type="submit" value="Confirm" class="btn btn-danger btn-sm" />
<input type="submit" value="Never Mind" class="btn btn-default btn-sm" onclick="history.back()" /> <input type="submit" value="Never Mind" class="btn btn-default btn-sm" onclick="history.back()" />
</form> </form>
......
...@@ -72,9 +72,9 @@ SRCT Bookshare &bull; {{ listing.title }} ...@@ -72,9 +72,9 @@ SRCT Bookshare &bull; {{ listing.title }}
<div class="alert alert-success text-center"> <div class="alert alert-success text-center">
<strong>You exchanged this listing {{ listing.date_closed|timesince }} ago.</strong> <strong>You exchanged this listing {{ listing.date_closed|timesince }} ago.</strong>
{% if rating %} {% if rating %}
<strong><a href="{% url 'edit_rating' listing.slug rating.slug %}">Edit</a> <a href="{% url 'ratings' listing.seller.slug %}">your rating</a> of this exchange.</strong> <strong><a href="{% url 'edit_rating' listing.slug rating.slug %}">Edit</a> <a href="{% url 'ratings' listing.poster.slug %}">your rating</a> of this exchange.</strong>
{% else %} {% else %}
<strong>Rate your experience with {{ listing.seller.user.first_name }} <a href="{% url 'create_rating' listing.slug %}">here</a>.</strong> <strong>Rate your experience with {{ listing.poster.user.first_name }} <a href="{% url 'create_rating' listing.slug %}">here</a>.</strong>
{% endif %} {% endif %}
{% else %} {% else %}
<div class="alert alert-danger text-center"> <div class="alert alert-danger text-center">
...@@ -147,8 +147,8 @@ SRCT Bookshare &bull; {{ listing.title }} ...@@ -147,8 +147,8 @@ SRCT Bookshare &bull; {{ listing.title }}
</div> </div>
<div class="col-md-4 col-sm-6 col-xs-6 text-right"> <div class="col-md-4 col-sm-6 col-xs-6 text-right">
<h4><small>Posted by</small><a href="{% url 'profile' listing.seller.user.username %}"> {{ listing.seller.user.first_name }} {{ listing.seller.user.last_name }}</a> <h4><small>Posted by</small><a href="{% url 'profile' listing.poster.user.username %}"> {{ listing.poster.user.get_full_name }}</a>
{% if request.user == listing.seller.user %} {% if request.user == listing.poster.user %}
(Me) (Me)
{% endif %}</h4> {% endif %}</h4>
</div> </div>
...@@ -164,7 +164,7 @@ SRCT Bookshare &bull; {{ listing.title }} ...@@ -164,7 +164,7 @@ SRCT Bookshare &bull; {{ listing.title }}
</div> </div>
<div class="col-md-5 text-right small-text-center"> <div class="col-md-5 text-right small-text-center">
{% if request.user == listing.seller.user %} {% if request.user == listing.poster.user %}
{% else %} {% else %}
{% if can_flag %} {% if can_flag %}
<h5><a href="{% url 'create_flag' listing.slug %}"><span class="label label-danger"><i class="fa fa-flag fa-fw fa-lg"></i> Flag</span></a></h5> <h5><a href="{% url 'create_flag' listing.slug %}"><span class="label label-danger"><i class="fa fa-flag fa-fw fa-lg"></i> Flag</span></a></h5>
...@@ -195,17 +195,17 @@ SRCT Bookshare &bull; {{ listing.title }} ...@@ -195,17 +195,17 @@ SRCT Bookshare &bull; {{ listing.title }}
</div> </div>
<div class="row text-center"> <div class="row text-center">
{% if request.user == listing.seller.user %} {% if request.user == listing.poster.user %}
<div class="col-md-6 col-md-offset-3"> <div class="col-md-6 col-md-offset-3">
<h3> <h3>
{% if bid_count > 0 %} {% if bid_count > 0 %}
{% if not listing.exchanged and not listing.cancelled %} {% if not listing.exchanged and not listing.cancelled %}
<span class="label label-default"> <span class="label label-default">
<a href="{% url 'sell_listing' listing.slug %}">Exchange</a> <a href="{% url 'exchange_listing' listing.slug %}">Exchange</a>
</a></span> </a></span>
{% elif not listing.cancelled %} {% elif not listing.cancelled %}
<span class="label label-default"> <span class="label label-default">
<a href="{% url 'unsell_listing' listing.slug %}">Cancel Sale</a> <a href="{% url 'unexchange_listing' listing.slug %}">Cancel Sale</a>
</span> </span>
{% endif %} {% endif %}
{% endif %} {% endif %}
......
...@@ -13,14 +13,14 @@ ...@@ -13,14 +13,14 @@
<p>Great news!</p> <p>Great news!</p>
<p>Seller <strong>{{ seller_name }}</strong> has picked your ${{ bid_num }} <p>Poster <strong>{{ poster_name }}</strong> has picked your ${{ bid_num }}
bid for <strong><em>{{ listing_title }}</em></strong> on bid for <strong><em>{{ listing_title }}</em></strong> on
<a href="http://bookshare.srct.gmu.edu/">SRCT Bookshare</a>. <a href="http://bookshare.srct.gmu.edu/">SRCT Bookshare</a>.
They're the cc'ed email address-- <strong>{{ seller_email }}</strong>. Watch They're the cc'ed email address-- <strong>{{ poster_email }}</strong>. Watch
your email to arrange all the final touches to get your book.</p> your email to arrange all the final touches to get your book.</p>
<p><em>Seller message</em>: {{ email_message }}</p> <p><em>Poster message</em>: {{ email_message }}</p>
<p>Thanks for using SRCT Bookshare! :-)</p> <p>Thanks for using SRCT Bookshare! :-)</p>
......
...@@ -2,12 +2,12 @@ Hey there, {{ bidder_first_name }}! ...@@ -2,12 +2,12 @@ Hey there, {{ bidder_first_name }}!
Great news! Great news!
Seller {{ seller_name }} has picked your ${{ bid_num }} bid for Poster {{ poster_name }} has picked your ${{ bid_num }} bid for
{{ listing_title }} on SRCT Bookshare. They're the cc'ed email address-- {{ listing_title }} on SRCT Bookshare. They're the cc'ed email address--
{{ seller_email }}. Watch your email to arrange all the final touches to get {{ poster_email }}. Watch your email to arrange all the final touches to get
your book. your book.
Seller message: {{ email_message }} Poster message: {{ email_message }}
Thanks for using SRCT Bookshare! :-) Thanks for using SRCT Bookshare! :-)
......
...@@ -11,17 +11,17 @@ ...@@ -11,17 +11,17 @@
<body> <body>
<p>Hey there, <strong>{{ bidder_first_name }}</strong>! <p>Hey there, <strong>{{ bidder_first_name }}</strong>!
<p>Seller <strong>{{ seller_name }}</strong> has cancelled your <p>Poster <strong>{{ poster_name }}</strong> has cancelled your
${{ bid_num }} bid for <em>{{ listing_title }}</em> on ${{ bid_num }} bid for <em>{{ listing_title }}</em> on
<a href="http://bookshare.srct.gmu.edu/">SRCT Bookshare</a>. <a href="http://bookshare.srct.gmu.edu/">SRCT Bookshare</a>.
<p>We certainly hope that this doesn't come as a shock. :-P</p> <p>We certainly hope that this doesn't come as a shock. :-P</p>
<p>(If you don't know why you're getting this email, they're the cc'ed email <p>(If you don't know why you're getting this email, they're the cc'ed email
address-- {{ seller_email }}. Contact them ASAP to clear up any confusion.)</p> address-- {{ poster_email }}. Contact them ASAP to clear up any confusion.)</p>
<p><em>Seller message</em>: {{ email_message }}</p> <p><em>Poster message</em>: {{ email_message }}</p>
<p>Thanks for using SRCT Bookshare!</p> <p>Thanks for using SRCT Bookshare!</p>
......
Hey there, {{ bidder_first_name }}! Hey there, {{ bidder_first_name }}!
Seller {{ seller_name }} has cancelled your ${{ bid_num }} bid for Poster {{ poster_name }} has cancelled your ${{ bid_num }} bid for
{{ listing_title }} on SRCT Bookshare. {{ listing_title }} on SRCT Bookshare.
We certainly hope that this doesn't come as a shock. :-P We certainly hope that this doesn't come as a shock. :-P
(If you don't know why you're getting this email, they're the cc'ed email (If you don't know why you're getting this email, they're the cc'ed email
address-- {{ seller_email }}. Contact them ASAP to clear up any confusion.) address-- {{ poster_email }}. Contact them ASAP to clear up any confusion.)
Seller message: {{ email_message }} Poster message: {{ email_message }}
Thanks for using SRCT Bookshare! Thanks for using SRCT Bookshare!
......
...@@ -18,9 +18,9 @@ ...@@ -18,9 +18,9 @@
<div class="row"> <div class="row">
<div class="col-md-8"> <div class="col-md-8">
<h4><small>Seller</small> <h4><small>Poster</small>
<a href="{{ listing.seller.get_absolute_url }}"> <a href="{{ listing.poster.get_absolute_url }}">
{{ listing.seller.user.get_full_name }} {{ listing.poster.user.get_full_name }}
</a> </a>
</h4> </h4>
</div> </div>
......
{% extends 'layouts/base.html' %}
{% block title %}
SRCT Bookshare &bull; {{ listing.title }} &bull; Exchange
{% endblock %}
{% block content %}
<div class="page-header" id="banner">
<div class="row">
<div class="col-lg-12 text-center">
<h1><strong>SRCT</strong>&#8203;BOOKSHARE</h1>
<p class="lead text-center"><strong>Exchange Listing</strong></p>
</div>
</div>
</div>
{% load crispy_forms_tags %}
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-body">
<div class="row">
<div class="col-md-10 col-md-offset-1">
{% crispy my_form %}
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
...@@ -37,7 +37,7 @@ SRCT Bookshare &bull; Search Listings ...@@ -37,7 +37,7 @@ SRCT Bookshare &bull; Search Listings
<td class="col-md-5"><h4><strong>Title</strong></h4></td> <td class="col-md-5"><h4><strong>Title</strong></h4></td>
<td class="col-md-2"><h4><strong>Author</strong></h4></td> <td class="col-md-2"><h4><strong>Author</strong></h4></td>
<td class="col-md-1"><h4><strong>Course</strong></h4></td> <td class="col-md-1"><h4><strong>Course</strong></h4></td>
<td class="col-md-2"><h4><strong>Seller</strong></h4></td> <td class="col-md-2"><h4><strong>Poster</strong></h4></td>
<td class="col-md-1"><h4><strong>Price</strong></h4></td> <td class="col-md-1"><h4><strong>Price</strong></h4></td>
</thead> </thead>
{% endif %} {% endif %}
...@@ -58,8 +58,8 @@ SRCT Bookshare &bull; Search Listings ...@@ -58,8 +58,8 @@ SRCT Bookshare &bull; Search Listings
</td> </td>
<td class="text-center"> <td class="text-center">
<h5> <h5>
<a href="{{ result.object.seller.get_absolute_url }}"> <a href="{{ result.object.poster.get_absolute_url }}">
{{ result.object.seller.user.first_name }} {{ result.object.seller.user.last_name }} {{ result.object.poster.user.first_name }} {{ result.object.poster.user.last_name }}
</a> </a>
</h5> </h5>
</td> </td>
......
...@@ -3,8 +3,8 @@ from django.conf.urls import patterns, url ...@@ -3,8 +3,8 @@ 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, SellListing,\ CreateFlag, DeleteFlag, EditListing, ExchangeListing,\
UnSellListing, CancelListing, ReopenListing, CreateRating,\ UnExchangeListing, CancelListing, ReopenListing, CreateRating,\
EditRating, DeleteRating, EditBid EditRating, DeleteRating, EditBid
...@@ -31,10 +31,10 @@ urlpatterns = patterns('', ...@@ -31,10 +31,10 @@ urlpatterns = patterns('',
EditListing.as_view(), name='edit_listing'), EditListing.as_view(), name='edit_listing'),
url(r'^listing/(?P<slug>[\w-]+)/exchange/$', url(r'^listing/(?P<slug>[\w-]+)/exchange/$',
SellListing.as_view(), name='sell_listing'), ExchangeListing.as_view(), name='exchange_listing'),
url(r'^listing/(?P<slug>[\w-]+)/unexchange/$', url(r'^listing/(?P<slug>[\w-]+)/unexchange/$',
UnSellListing.as_view(), name='unsell_listing'), UnExchangeListing.as_view(), name='unexchange_listing'),
url(r'^listing/(?P<slug>[\w-]+)/cancel/$', url(r'^listing/(?P<slug>[\w-]+)/cancel/$',
CancelListing.as_view(), name='cancel_listing'), CancelListing.as_view(), name='cancel_listing'),
......
...@@ -20,8 +20,8 @@ from braces.views import FormValidMessageMixin ...@@ -20,8 +20,8 @@ from braces.views import FormValidMessageMixin
from ratelimit.decorators import ratelimit from ratelimit.decorators import ratelimit
# imports from your apps # imports from your apps
from .models import Listing, Bid, Flag, Rating from .models import Listing, Bid, Flag, Rating
from .forms import ListingForm, BidForm, FlagForm, SellListingForm,\ from .forms import ListingForm, BidForm, FlagForm, ExchangeListingForm,\
UnSellListingForm, RatingForm UnExchangeListingForm, RatingForm
from core.models import Student from core.models import Student
...@@ -98,7 +98,7 @@ class CreateListing(LoginRequiredMixin, FormValidMessageMixin, CreateView): ...@@ -98,7 +98,7 @@ class CreateListing(LoginRequiredMixin, FormValidMessageMixin, CreateView):
def form_valid(self, form): def form_valid(self, form):
me = Student.objects.get(user=self.request.user) me = Student.objects.get(user=self.request.user)
form.instance.seller = me