b2u for libraries

1. library license is autochecked when user is the library
2. the library owner is automatically made a member of the library
pull/1/head
eric 2014-03-14 15:12:23 -04:00
parent 878970df4b
commit 13bd024f1f
2 changed files with 3 additions and 2 deletions

View File

@ -127,7 +127,7 @@
<li class="last">
{% if request.user.profile.libraries %}
<label for="offer_{{offer.id}}">
<input type="radio" name="offer_id" id="offer_{{offer.id}}" value="{{offer.id}}" {% ifequal request.REQUEST.offer_id offer.id|stringformat:"s" %}checked="checked"{% else %} {% ifequal offer_id offer.id %}checked="checked"{% endifequal %}{% endifequal %} />
<input type="radio" name="offer_id" id="offer_{{offer.id}}" value="{{offer.id}}" {% ifequal request.REQUEST.offer_id offer.id|stringformat:"s" %}checked="checked"{% else %} {% ifequal offer_id offer.id %}checked="checked"{% else %} {% if user.library %}checked="checked"{% endif %}{% endifequal %}{% endifequal %} />
<span class="menu-item-price">
${{ offer.price|intcomma }}
</span>

View File

@ -108,7 +108,8 @@ class CreateLibraryView(BaseLibraryView, CreateView):
user.save()
form.instance.user = user
form.instance.save()
form.instance.add_user(user)
form.instance.add_user(user) # library is a member of itself
form.instance.add_user(self.request.user) # library.owner is a member of library
context_data = self.get_context_data(form=form)
context_data['status'] = 'Library Updated'
return HttpResponseRedirect(reverse('library_admin',args=[form.instance.id]))