diff --git a/core/models.py b/core/models.py index 5c231d51..f62d8385 100755 --- a/core/models.py +++ b/core/models.py @@ -186,8 +186,6 @@ class Campaign(models.Model): active_claim = self.work.claim.filter(status="active")[0] ungluers = self.work.wished_by() notification.queue(ungluers, "active_campaign", {'campaign':self, 'active_claim':active_claim}, True) - #import regluit.core.tasks as tasks - #tasks.emit_notifications().delay() return self diff --git a/core/search.py b/core/search.py index 3b5b93f9..e467bac5 100644 --- a/core/search.py +++ b/core/search.py @@ -1,3 +1,4 @@ +import re import json import requests import regluit.core.isbn @@ -32,7 +33,9 @@ def gluejar_search(q, user_ip='69.243.24.29', page=1): # cover image if v.has_key('imageLinks'): - r['cover_image_thumbnail'] = v['imageLinks'].get('thumbnail', "") + url = v['imageLinks'].get('thumbnail', "") + url = re.sub(r'http://bks[0-9]+\.books\.google\.com', 'https://encrypted.google.com', url) + r['cover_image_thumbnail'] = url else: r['cover_image_thumbnail'] = "/static/images/generic_cover_larger.png" diff --git a/core/signals.py b/core/signals.py index b7c029c1..a388b7d9 100644 --- a/core/signals.py +++ b/core/signals.py @@ -83,7 +83,5 @@ def notify_comment(comment, request, **kwargs): other_wishers = comment.content_object.wished_by().exclude(id=comment.user.id).exclude(id__in=other_commenters) notification.queue(other_commenters, "coment_on_commented", {'comment':comment}, True) notification.queue(other_wishers, "wishlist_comment", {'comment':comment}, True) - # import regluit.core.tasks as tasks - # tasks.emit_notifications().delay() comment_was_posted.connect(notify_comment) diff --git a/core/tests.py b/core/tests.py index 92a043de..d7e42869 100755 --- a/core/tests.py +++ b/core/tests.py @@ -302,6 +302,7 @@ class SearchTests(TestCase): self.assertTrue(r.has_key('author')) self.assertTrue(r.has_key('description')) self.assertTrue(r.has_key('cover_image_thumbnail')) + self.assertTrue(r['cover_image_thumbnail'].startswith('https')) self.assertTrue(r.has_key('publisher')) self.assertTrue(r.has_key('isbn_13')) self.assertTrue(r.has_key('googlebooks_id')) diff --git a/frontend/forms.py b/frontend/forms.py index 7d122baf..1583d6c6 100644 --- a/frontend/forms.py +++ b/frontend/forms.py @@ -131,6 +131,18 @@ class OpenCampaignForm(forms.ModelForm): fields = 'name', 'work', 'managers' widgets = { 'work': forms.HiddenInput } +class EditManagersForm(forms.ModelForm): + managers = AutoCompleteSelectMultipleField( + OwnerLookup, + label='Campaign Managers', + widget=AutoCompleteSelectMultipleWidget(OwnerLookup), + required=True, + ) + class Meta: + model = Campaign + fields = ('id', 'managers') + widgets = { 'id': forms.HiddenInput } + class CustomPremiumForm(forms.ModelForm): class Meta: @@ -179,7 +191,7 @@ class ManageCampaignForm(forms.ModelForm): return new_deadline def clean_license(self): - new_license = self.cleaned_data['license'] + new_license = self.cleaned_data['license'] if self.instance: if self.instance.status == 'ACTIVE': raise forms.ValidationError(_('The license for an ACTIVE campaign cannot be changed.')) @@ -222,8 +234,8 @@ class CampaignPledgeForm(forms.Form): try: premium= Premium.objects.get(id=premium_id) if premium.limit>0: - if premium.limit<=premium.premium_count: - raise forms.ValidationError(_("Sorry, that premium is fully subscribed.")) + if premium.limit<=premium.premium_count: + raise forms.ValidationError(_("Sorry, that premium is fully subscribed.")) except Premium.DoesNotExist: raise forms.ValidationError(_("Sorry, that premium is not valid.")) diff --git a/frontend/templates/rh_tools.html b/frontend/templates/rh_tools.html index a73b625c..dc798bbd 100644 --- a/frontend/templates/rh_tools.html +++ b/frontend/templates/rh_tools.html @@ -38,7 +38,7 @@ Any questions not covered here? Please email us at {{claim.work.title }} +