Merge branch 'master' of github.com:Gluejar/regluit into payment
commit
09923c68e1
|
@ -0,0 +1,222 @@
|
||||||
|
# encoding: utf-8
|
||||||
|
import datetime
|
||||||
|
from south.db import db
|
||||||
|
from south.v2 import SchemaMigration
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
|
class Migration(SchemaMigration):
|
||||||
|
|
||||||
|
def forwards(self, orm):
|
||||||
|
|
||||||
|
# Adding field 'Campaign.license'
|
||||||
|
db.add_column('core_campaign', 'license', self.gf('django.db.models.fields.CharField')(default='CC BY-NC-ND', max_length=255), keep_default=False)
|
||||||
|
|
||||||
|
# Changing field 'Ebook.url'
|
||||||
|
db.alter_column('core_ebook', 'url', self.gf('django.db.models.fields.URLField')(max_length=1024))
|
||||||
|
|
||||||
|
|
||||||
|
def backwards(self, orm):
|
||||||
|
|
||||||
|
# Deleting field 'Campaign.license'
|
||||||
|
db.delete_column('core_campaign', 'license')
|
||||||
|
|
||||||
|
# Changing field 'Ebook.url'
|
||||||
|
db.alter_column('core_ebook', 'url', self.gf('django.db.models.fields.CharField')(max_length=1024))
|
||||||
|
|
||||||
|
|
||||||
|
models = {
|
||||||
|
'auth.group': {
|
||||||
|
'Meta': {'object_name': 'Group'},
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
|
||||||
|
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
|
||||||
|
},
|
||||||
|
'auth.permission': {
|
||||||
|
'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
|
||||||
|
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
|
||||||
|
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
|
||||||
|
},
|
||||||
|
'auth.user': {
|
||||||
|
'Meta': {'object_name': 'User'},
|
||||||
|
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
|
||||||
|
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
|
||||||
|
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
|
||||||
|
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
|
||||||
|
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||||
|
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||||
|
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
|
||||||
|
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
|
||||||
|
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
|
||||||
|
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
|
||||||
|
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
|
||||||
|
},
|
||||||
|
'contenttypes.contenttype': {
|
||||||
|
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
|
||||||
|
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
|
||||||
|
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
|
||||||
|
},
|
||||||
|
'core.author': {
|
||||||
|
'Meta': {'object_name': 'Author'},
|
||||||
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
|
'editions': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'authors'", 'symmetrical': 'False', 'to': "orm['core.Edition']"}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'name': ('django.db.models.fields.CharField', [], {'max_length': '500'})
|
||||||
|
},
|
||||||
|
'core.campaign': {
|
||||||
|
'Meta': {'object_name': 'Campaign'},
|
||||||
|
'activated': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
|
||||||
|
'amazon_receiver': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
|
||||||
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
|
'deadline': ('django.db.models.fields.DateTimeField', [], {}),
|
||||||
|
'description': ('django.db.models.fields.TextField', [], {'null': 'True'}),
|
||||||
|
'details': ('django.db.models.fields.TextField', [], {'null': 'True'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'left': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '14', 'decimal_places': '2'}),
|
||||||
|
'license': ('django.db.models.fields.CharField', [], {'default': "'CC BY-NC-ND'", 'max_length': '255'}),
|
||||||
|
'managers': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'campaigns'", 'symmetrical': 'False', 'to': "orm['auth.User']"}),
|
||||||
|
'name': ('django.db.models.fields.CharField', [], {'max_length': '500', 'null': 'True'}),
|
||||||
|
'paypal_receiver': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
|
||||||
|
'status': ('django.db.models.fields.CharField', [], {'default': "'INITIALIZED'", 'max_length': '15', 'null': 'True'}),
|
||||||
|
'target': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '14', 'decimal_places': '2'}),
|
||||||
|
'work': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'campaigns'", 'to': "orm['core.Work']"})
|
||||||
|
},
|
||||||
|
'core.campaignaction': {
|
||||||
|
'Meta': {'object_name': 'CampaignAction'},
|
||||||
|
'campaign': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'actions'", 'to': "orm['core.Campaign']"}),
|
||||||
|
'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'timestamp': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
|
'type': ('django.db.models.fields.CharField', [], {'max_length': '15'})
|
||||||
|
},
|
||||||
|
'core.celerytask': {
|
||||||
|
'Meta': {'object_name': 'CeleryTask'},
|
||||||
|
'active': ('django.db.models.fields.NullBooleanField', [], {'default': 'True', 'null': 'True', 'blank': 'True'}),
|
||||||
|
'created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2012, 3, 23, 12, 0, 53, 181728)', 'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
|
'description': ('django.db.models.fields.CharField', [], {'max_length': '2048', 'null': 'True'}),
|
||||||
|
'function_args': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
|
||||||
|
'function_name': ('django.db.models.fields.CharField', [], {'max_length': '1024'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'task_id': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
|
||||||
|
'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'tasks'", 'null': 'True', 'to': "orm['auth.User']"})
|
||||||
|
},
|
||||||
|
'core.claim': {
|
||||||
|
'Meta': {'object_name': 'Claim'},
|
||||||
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'rights_holder': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'claim'", 'to': "orm['core.RightsHolder']"}),
|
||||||
|
'status': ('django.db.models.fields.CharField', [], {'default': "'pending'", 'max_length': '7'}),
|
||||||
|
'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'claim'", 'to': "orm['auth.User']"}),
|
||||||
|
'work': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'claim'", 'to': "orm['core.Work']"})
|
||||||
|
},
|
||||||
|
'core.ebook': {
|
||||||
|
'Meta': {'object_name': 'Ebook'},
|
||||||
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
|
'edition': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ebooks'", 'to': "orm['core.Edition']"}),
|
||||||
|
'format': ('django.db.models.fields.CharField', [], {'max_length': '25'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'provider': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
|
||||||
|
'rights': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}),
|
||||||
|
'url': ('django.db.models.fields.URLField', [], {'max_length': '1024'}),
|
||||||
|
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True'})
|
||||||
|
},
|
||||||
|
'core.edition': {
|
||||||
|
'Meta': {'object_name': 'Edition'},
|
||||||
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
|
'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'public_domain': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
|
||||||
|
'publication_date': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True'}),
|
||||||
|
'publisher': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}),
|
||||||
|
'title': ('django.db.models.fields.CharField', [], {'max_length': '1000'}),
|
||||||
|
'work': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'editions'", 'null': 'True', 'to': "orm['core.Work']"})
|
||||||
|
},
|
||||||
|
'core.identifier': {
|
||||||
|
'Meta': {'unique_together': "(('type', 'value'),)", 'object_name': 'Identifier'},
|
||||||
|
'edition': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'identifiers'", 'null': 'True', 'to': "orm['core.Edition']"}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'type': ('django.db.models.fields.CharField', [], {'max_length': '4'}),
|
||||||
|
'value': ('django.db.models.fields.CharField', [], {'max_length': '31'}),
|
||||||
|
'work': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'identifiers'", 'to': "orm['core.Work']"})
|
||||||
|
},
|
||||||
|
'core.premium': {
|
||||||
|
'Meta': {'object_name': 'Premium'},
|
||||||
|
'amount': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '0'}),
|
||||||
|
'campaign': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'premiums'", 'null': 'True', 'to': "orm['core.Campaign']"}),
|
||||||
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
|
'description': ('django.db.models.fields.TextField', [], {'null': 'True'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'type': ('django.db.models.fields.CharField', [], {'max_length': '2'})
|
||||||
|
},
|
||||||
|
'core.rightsholder': {
|
||||||
|
'Meta': {'object_name': 'RightsHolder'},
|
||||||
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
|
'email': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'owner': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'rights_holder'", 'to': "orm['auth.User']"}),
|
||||||
|
'rights_holder_name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'})
|
||||||
|
},
|
||||||
|
'core.subject': {
|
||||||
|
'Meta': {'ordering': "['name']", 'object_name': 'Subject'},
|
||||||
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '200'}),
|
||||||
|
'works': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'subjects'", 'symmetrical': 'False', 'to': "orm['core.Work']"})
|
||||||
|
},
|
||||||
|
'core.userprofile': {
|
||||||
|
'Meta': {'object_name': 'UserProfile'},
|
||||||
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
|
'facebook_id': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True'}),
|
||||||
|
'goodreads_auth_secret': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
|
||||||
|
'goodreads_auth_token': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
|
||||||
|
'goodreads_user_id': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True', 'blank': 'True'}),
|
||||||
|
'goodreads_user_link': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
|
||||||
|
'goodreads_user_name': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
|
||||||
|
'home_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'librarything_id': ('django.db.models.fields.CharField', [], {'max_length': '31', 'blank': 'True'}),
|
||||||
|
'pic_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
|
||||||
|
'tagline': ('django.db.models.fields.CharField', [], {'max_length': '140', 'blank': 'True'}),
|
||||||
|
'twitter_id': ('django.db.models.fields.CharField', [], {'max_length': '15', 'blank': 'True'}),
|
||||||
|
'user': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'profile'", 'unique': 'True', 'to': "orm['auth.User']"})
|
||||||
|
},
|
||||||
|
'core.waswork': {
|
||||||
|
'Meta': {'object_name': 'WasWork'},
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'moved': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
|
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True'}),
|
||||||
|
'was': ('django.db.models.fields.IntegerField', [], {'unique': 'True'}),
|
||||||
|
'work': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Work']"})
|
||||||
|
},
|
||||||
|
'core.wishes': {
|
||||||
|
'Meta': {'object_name': 'Wishes', 'db_table': "'core_wishlist_works'"},
|
||||||
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'source': ('django.db.models.fields.CharField', [], {'max_length': '15', 'blank': 'True'}),
|
||||||
|
'wishlist': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Wishlist']"}),
|
||||||
|
'work': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'wishes'", 'to': "orm['core.Work']"})
|
||||||
|
},
|
||||||
|
'core.wishlist': {
|
||||||
|
'Meta': {'object_name': 'Wishlist'},
|
||||||
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'user': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'wishlist'", 'unique': 'True', 'to': "orm['auth.User']"}),
|
||||||
|
'works': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'wishlists'", 'symmetrical': 'False', 'through': "orm['core.Wishes']", 'to': "orm['core.Work']"})
|
||||||
|
},
|
||||||
|
'core.work': {
|
||||||
|
'Meta': {'ordering': "['title']", 'object_name': 'Work'},
|
||||||
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'language': ('django.db.models.fields.CharField', [], {'default': "'en'", 'max_length': '2'}),
|
||||||
|
'num_wishes': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||||
|
'openlibrary_lookup': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
|
||||||
|
'title': ('django.db.models.fields.CharField', [], {'max_length': '1000'})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
complete_apps = ['core']
|
|
@ -81,11 +81,20 @@ class CampaignAction(models.Model):
|
||||||
campaign = models.ForeignKey("Campaign", related_name="actions", null=False)
|
campaign = models.ForeignKey("Campaign", related_name="actions", null=False)
|
||||||
|
|
||||||
class Campaign(models.Model):
|
class Campaign(models.Model):
|
||||||
|
LICENSE_CHOICES = (('CC BY-NC-ND','CC BY-NC-ND'),
|
||||||
|
('CC BY-ND','CC BY-ND'),
|
||||||
|
('CC BY','CC BY'),
|
||||||
|
('CC BY-NC','CC BY-NC'),
|
||||||
|
( 'CC BY-NC-SA','CC BY-NC-SA'),
|
||||||
|
( 'CC BY-SA','CC BY-SA'),
|
||||||
|
( 'CC0','CC0'),
|
||||||
|
)
|
||||||
created = models.DateTimeField(auto_now_add=True)
|
created = models.DateTimeField(auto_now_add=True)
|
||||||
name = models.CharField(max_length=500, null=True, blank=False)
|
name = models.CharField(max_length=500, null=True, blank=False)
|
||||||
description = models.TextField(null=True, blank=False)
|
description = models.TextField(null=True, blank=False)
|
||||||
details = models.TextField(null=True, blank=False)
|
details = models.TextField(null=True, blank=False)
|
||||||
target = models.DecimalField(max_digits=14, decimal_places=2, null=True, blank=False)
|
target = models.DecimalField(max_digits=14, decimal_places=2, null=True, blank=False)
|
||||||
|
license = models.CharField(max_length=255, choices = LICENSE_CHOICES, default='CC BY-NC-ND')
|
||||||
left = models.DecimalField(max_digits=14, decimal_places=2, null=True, blank=False)
|
left = models.DecimalField(max_digits=14, decimal_places=2, null=True, blank=False)
|
||||||
deadline = models.DateTimeField()
|
deadline = models.DateTimeField()
|
||||||
activated = models.DateTimeField(null=True)
|
activated = models.DateTimeField(null=True)
|
||||||
|
|
|
@ -14,7 +14,7 @@ from selectable.forms import AutoCompleteSelectWidget,AutoCompleteSelectField
|
||||||
from regluit.core.models import UserProfile, RightsHolder, Claim, Campaign, Premium, Ebook
|
from regluit.core.models import UserProfile, RightsHolder, Claim, Campaign, Premium, Ebook
|
||||||
from regluit.core.lookups import OwnerLookup
|
from regluit.core.lookups import OwnerLookup
|
||||||
|
|
||||||
from regluit.utils.localdatetime import date_today
|
from regluit.utils.localdatetime import now
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ class ManageCampaignForm(forms.ModelForm):
|
||||||
target = forms.DecimalField( min_value= D('0.00') )
|
target = forms.DecimalField( min_value= D('0.00') )
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Campaign
|
model = Campaign
|
||||||
fields = 'description', 'details', 'target', 'deadline', 'paypal_receiver'
|
fields = 'description', 'details', 'license', 'target', 'deadline', 'paypal_receiver'
|
||||||
widgets = {
|
widgets = {
|
||||||
'description': forms.Textarea(attrs={'cols': 80, 'rows': 20}),
|
'description': forms.Textarea(attrs={'cols': 80, 'rows': 20}),
|
||||||
'details': forms.Textarea(attrs={'cols': 80, 'rows': 20}),
|
'details': forms.Textarea(attrs={'cols': 80, 'rows': 20}),
|
||||||
|
@ -160,11 +160,19 @@ class ManageCampaignForm(forms.ModelForm):
|
||||||
if self.instance:
|
if self.instance:
|
||||||
if self.instance.status == 'ACTIVE' and self.instance.deadline != new_deadline:
|
if self.instance.status == 'ACTIVE' and self.instance.deadline != new_deadline:
|
||||||
raise forms.ValidationError(_('The closing date for an ACTIVE campaign cannot be changed.'))
|
raise forms.ValidationError(_('The closing date for an ACTIVE campaign cannot be changed.'))
|
||||||
if new_deadline-date_today() > timedelta(days=int(settings.UNGLUEIT_LONGEST_DEADLINE)):
|
if new_deadline - now() > timedelta(days=int(settings.UNGLUEIT_LONGEST_DEADLINE)):
|
||||||
raise forms.ValidationError(_('The chosen closing date is more than %s days from now' % settings.UNGLUEIT_LONGEST_DEADLINE))
|
raise forms.ValidationError(_('The chosen closing date is more than %s days from now' % settings.UNGLUEIT_LONGEST_DEADLINE))
|
||||||
elif new_deadline-date_today() < timedelta(days=int(settings.UNGLUEIT_SHORTEST_DEADLINE)):
|
elif new_deadline - now() < timedelta(days=int(settings.UNGLUEIT_SHORTEST_DEADLINE)):
|
||||||
raise forms.ValidationError(_('The chosen closing date is less than %s days from now' % settings.UNGLUEIT_SHORTEST_DEADLINE))
|
raise forms.ValidationError(_('The chosen closing date is less than %s days from now' % settings.UNGLUEIT_SHORTEST_DEADLINE))
|
||||||
return new_deadline
|
return new_deadline
|
||||||
|
|
||||||
|
def clean_license(self):
|
||||||
|
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.'))
|
||||||
|
return new_license
|
||||||
|
|
||||||
|
|
||||||
class CampaignPledgeForm(forms.Form):
|
class CampaignPledgeForm(forms.Form):
|
||||||
preapproval_amount = forms.DecimalField(
|
preapproval_amount = forms.DecimalField(
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
{% block extra_extra_head %}
|
{% block extra_extra_head %}
|
||||||
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/themes/ui-lightness/jquery-ui.css" type="text/css" media="screen">
|
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/themes/ui-lightness/jquery-ui.css" type="text/css" media="screen">
|
||||||
{{ form.media.css }}
|
{{ form.media.css }}
|
||||||
|
<script type="text/javascript" src="{{ jquery_home }}"></script>
|
||||||
<script type="text/javascript" src="{{ jquery_ui_home }}"></script>
|
<script type="text/javascript" src="{{ jquery_ui_home }}"></script>
|
||||||
{{ form.media.js }}
|
{{ form.media.js }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -21,7 +22,7 @@
|
||||||
{% if campaigns_with_active_transactions %}
|
{% if campaigns_with_active_transactions %}
|
||||||
<form method="post" action="#">
|
<form method="post" action="#">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<ul>
|
<ul class="terms">
|
||||||
{% for campaign in campaigns_with_active_transactions %}
|
{% for campaign in campaigns_with_active_transactions %}
|
||||||
<li><input type="radio" name="active_campaign" value="{{campaign.id}}" />{{campaign.id}} | {{campaign.name}} </li>
|
<li><input type="radio" name="active_campaign" value="{{campaign.id}}" />{{campaign.id}} | {{campaign.name}} </li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
|
@ -34,7 +34,7 @@ Please fix the following before launching your campaign:
|
||||||
<form action="#" method="POST">
|
<form action="#" method="POST">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<p>This will be displayed in the Campaign tab for your work. It's your main pitch to supporters. It should include:</p>
|
<p>This will be displayed in the Campaign tab for your work. It's your main pitch to supporters. It should include:</p>
|
||||||
<ul>
|
<ul class="terms">
|
||||||
<li>A synopsis of the work.</li>
|
<li>A synopsis of the work.</li>
|
||||||
<li>Hyperlinks for the author(s), publisher making the offer, or for the work itself.</li>
|
<li>Hyperlinks for the author(s), publisher making the offer, or for the work itself.</li>
|
||||||
<li>Anything especially appealing about the work or author: awards, embedded video (460px max), etc.</li>
|
<li>Anything especially appealing about the work or author: awards, embedded video (460px max), etc.</li>
|
||||||
|
@ -42,7 +42,7 @@ Please fix the following before launching your campaign:
|
||||||
{{ form.description }}{{ form.description.errors }}
|
{{ form.description }}{{ form.description.errors }}
|
||||||
<h3>Offer details</h2>
|
<h3>Offer details</h2>
|
||||||
<p>This will be displayed on the Details tab for your work. It gives additional information for the highly curious. It should include:</p>
|
<p>This will be displayed on the Details tab for your work. It gives additional information for the highly curious. It should include:</p>
|
||||||
<ul>
|
<ul class="terms">
|
||||||
<li>Details about the edition being offered.</li>
|
<li>Details about the edition being offered.</li>
|
||||||
<li>Hyperlinks for the author(s), publisher making the offer, or for the work itself.</li>
|
<li>Hyperlinks for the author(s), publisher making the offer, or for the work itself.</li>
|
||||||
</uL>
|
</uL>
|
||||||
|
@ -50,6 +50,9 @@ Please fix the following before launching your campaign:
|
||||||
<h3>Target Price</h2>
|
<h3>Target Price</h2>
|
||||||
<p> This is the target price for your campaign. Once you launch the campaign, you won't be able to increase it.</p>
|
<p> This is the target price for your campaign. Once you launch the campaign, you won't be able to increase it.</p>
|
||||||
{{ form.target }}{{ form.target.errors }}
|
{{ form.target }}{{ form.target.errors }}
|
||||||
|
<h3>License being offered</h2>
|
||||||
|
<p> This is the license you are offering to use once the campaign succeeds. For more info on the licenses you can use, see <a href="http://creativecommons.org/">Creative Commons</a></p>
|
||||||
|
{{ form.license }}{{ form.license.errors }}
|
||||||
<h3>Ending date</h2>
|
<h3>Ending date</h2>
|
||||||
<p> This is the ending date of your campaign. Once you launch the campaign, you won't be able to change it.
|
<p> This is the ending date of your campaign. Once you launch the campaign, you won't be able to change it.
|
||||||
The ending date can't be more than six months away- that's a practical limit for credit card authorizations.</p>
|
The ending date can't be more than six months away- that's a practical limit for credit card authorizations.</p>
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
{% block extra_extra_head %}
|
{% block extra_extra_head %}
|
||||||
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/themes/ui-lightness/jquery-ui.css" type="text/css" media="screen">
|
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/themes/ui-lightness/jquery-ui.css" type="text/css" media="screen">
|
||||||
<link href="/static/css/dj.selectable.css" type="text/css" media="all" rel="stylesheet" />
|
<link href="/static/css/dj.selectable.css" type="text/css" media="all" rel="stylesheet" />
|
||||||
|
<script type="text/javascript" src="{{ jquery_home }}"></script>
|
||||||
<script type="text/javascript" src="{{ jquery_ui_home }}"></script>
|
<script type="text/javascript" src="{{ jquery_ui_home }}"></script>
|
||||||
<script type="text/javascript" src="/static/js/jquery.dj.selectable.js"></script>
|
<script type="text/javascript" src="/static/js/jquery.dj.selectable.js"></script>
|
||||||
|
|
||||||
|
@ -118,13 +119,13 @@ Needs to be written. What would you find helpful in a social media toolkit? <a
|
||||||
<p>Campaigns have rewards as a way to thank supporters. unglue.it includes a standard set of rewards in all campaigns. You are encouraged to add additional sweeteners to motivate people to donate.</p>
|
<p>Campaigns have rewards as a way to thank supporters. unglue.it includes a standard set of rewards in all campaigns. You are encouraged to add additional sweeteners to motivate people to donate.</p>
|
||||||
|
|
||||||
<p>Here are the standard rewards:</p>
|
<p>Here are the standard rewards:</p>
|
||||||
<ul>
|
<ul class="terms">
|
||||||
<li><em>Any level</em> — The unglued ebook delivered to your inbox</li>
|
<li><em>Any level</em> — The unglued ebook delivered to your inbox</li>
|
||||||
<li><em>$25</em> — Your name under "supporters" in the acknowledgements section</li>
|
<li><em>$25</em> — Your username under "supporters" in the acknowledgements section</li>
|
||||||
<li><em>$50</em> — Your name & link of your choice under "benefactors"</li>
|
<li><em>$50</em> — Your name & profile link under "benefactors"</li>
|
||||||
<li><em>$100</em> — Your name, link of your choice, & a brief message (140 characters max) under "bibliophiles"</li>
|
<li><em>$100</em> — Your name, profile link, & profile tagline under "bibliophiles"</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h2>More Questions</h2>
|
<h2>More Questions</h2>
|
||||||
|
<p> Check the FAQ to the left, or <a href="/feedback">Send us feedback.</a>
|
||||||
{% endblock %}
|
{% endblock %}
|
|
@ -1,35 +0,0 @@
|
||||||
{% extends "basedocumentation.html" %}
|
|
||||||
|
|
||||||
{% block title %}Campaign Setup{% endblock %}
|
|
||||||
|
|
||||||
{% block doccontent %}
|
|
||||||
|
|
||||||
<h2>Set up campaign</h2>
|
|
||||||
<div class="book-detail-info">
|
|
||||||
<h2 class="book-name">Title: {{ work.title }}</h2>
|
|
||||||
<h3 class="book-author">Authors: {{ work.author }}</h3>
|
|
||||||
<h3 class="book-year">Published: {{ work.publication_date }}</h3>
|
|
||||||
<h3 class="book-author">Language: {{ work.editions.all.0.language }}</h3>
|
|
||||||
</div>
|
|
||||||
<form action="#">
|
|
||||||
|
|
||||||
<h3>Description of the work to be offered</h3>
|
|
||||||
This should include:
|
|
||||||
<ul>
|
|
||||||
<li>A synopsis of the work.
|
|
||||||
<li>Hyperlinks for the author(s), publisher making the offer, or for the work itself.
|
|
||||||
</ul>
|
|
||||||
<textarea cols="80" rows="20" name="description">
|
|
||||||
</textarea>
|
|
||||||
<h3>Offer details</h3>
|
|
||||||
This should include:
|
|
||||||
<ul>
|
|
||||||
<li>Details about the edition being offered.
|
|
||||||
<li>Hyperlinks for the author(s), publisher making the offer, or for the work itself.
|
|
||||||
</uL>
|
|
||||||
<textarea cols="80" rows="20" name="details">
|
|
||||||
</textarea>
|
|
||||||
</ul>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
{% endblock %}
|
|
|
@ -197,7 +197,7 @@ $j(document).ready(function(){
|
||||||
{{ claim.rights_holder.rights_holder_name }}
|
{{ claim.rights_holder.rights_holder_name }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
, has agreed to release <i>{{work.title}}</i> to the world as a Creative Commons licensed ebook if ungluers can join together to raise ${{ work.last_campaign.target }} by {{ work.last_campaign.deadline }}.
|
, has agreed to release <i>{{work.title}}</i> to the world as a Creative Commons licensed ebook ({{ work.last_campaign.license }}) if ungluers can join together to raise ${{ work.last_campaign.target }} by {{ work.last_campaign.deadline }}.
|
||||||
You can help!</p>
|
You can help!</p>
|
||||||
{{ work.last_campaign.description|safe }}
|
{{ work.last_campaign.description|safe }}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
|
@ -44,8 +44,6 @@ urlpatterns = patterns(
|
||||||
url(r"^work/(?P<work_id>\d+)/goodreads/$", "work_goodreads", name="work_goodreads"),
|
url(r"^work/(?P<work_id>\d+)/goodreads/$", "work_goodreads", name="work_goodreads"),
|
||||||
url(r"^work/(?P<work_id>\d+)/openlibrary/$", "work_openlibrary", name="work_openlibrary"),
|
url(r"^work/(?P<work_id>\d+)/openlibrary/$", "work_openlibrary", name="work_openlibrary"),
|
||||||
url(r"^googlebooks/(?P<googlebooks_id>.+)/$", "googlebooks", name="googlebooks"),
|
url(r"^googlebooks/(?P<googlebooks_id>.+)/$", "googlebooks", name="googlebooks"),
|
||||||
#may want to deprecate the following
|
|
||||||
url(r"^setup/work/(?P<work_id>\d+)/$", "work", {'action':'setup_campaign'}, name="setup_campaign"),
|
|
||||||
url(r"^pledge/(?P<work_id>\d+)/$", login_required(PledgeView.as_view()), name="pledge"),
|
url(r"^pledge/(?P<work_id>\d+)/$", login_required(PledgeView.as_view()), name="pledge"),
|
||||||
url(r"^pledge/cancel/$", login_required(PledgeCancelView.as_view()), name="pledge_cancel"),
|
url(r"^pledge/cancel/$", login_required(PledgeCancelView.as_view()), name="pledge_cancel"),
|
||||||
url(r"^pledge/complete/$", login_required(PledgeCompleteView.as_view()), name="pledge_complete"),
|
url(r"^pledge/complete/$", login_required(PledgeCompleteView.as_view()), name="pledge_complete"),
|
||||||
|
|
|
@ -67,32 +67,32 @@ def slideshow(max):
|
||||||
# on the preview site there are no active campaigns, so we should show most-wished books instead
|
# on the preview site there are no active campaigns, so we should show most-wished books instead
|
||||||
worklist = models.Work.objects.order_by('-num_wishes')[:max]
|
worklist = models.Work.objects.order_by('-num_wishes')[:max]
|
||||||
else:
|
else:
|
||||||
worklist = []
|
worklist = []
|
||||||
if max > count:
|
if max > count:
|
||||||
# add all the works with active campaigns
|
# add all the works with active campaigns
|
||||||
for campaign in ending:
|
for campaign in ending:
|
||||||
worklist.append(campaign.work)
|
worklist.append(campaign.work)
|
||||||
|
|
||||||
# then fill out the rest of the list with popular but inactive works
|
# then fill out the rest of the list with popular but inactive works
|
||||||
remainder = max - count
|
remainder = max - count
|
||||||
remainder_works = models.Work.objects.exclude(campaigns__status='ACTIVE').order_by('-num_wishes')[:remainder]
|
remainder_works = models.Work.objects.exclude(campaigns__status='ACTIVE').order_by('-num_wishes')[:remainder]
|
||||||
worklist.extend(remainder_works)
|
worklist.extend(remainder_works)
|
||||||
else:
|
else:
|
||||||
# if the active campaign list has more works than we can fit
|
# if the active campaign list has more works than we can fit
|
||||||
# in our slideshow, it's the only source we need to draw from
|
# in our slideshow, it's the only source we need to draw from
|
||||||
while j < max:
|
while j < max:
|
||||||
worklist.append(ending[j].work)
|
worklist.append(ending[j].work)
|
||||||
j +=1
|
j +=1
|
||||||
|
|
||||||
return worklist
|
return worklist
|
||||||
|
|
||||||
def next(request):
|
def next(request):
|
||||||
if request.COOKIES.has_key('next'):
|
if request.COOKIES.has_key('next'):
|
||||||
response = HttpResponseRedirect(urllib.unquote(request.COOKIES['next']))
|
response = HttpResponseRedirect(urllib.unquote(request.COOKIES['next']))
|
||||||
response.delete_cookie('next')
|
response.delete_cookie('next')
|
||||||
return response
|
return response
|
||||||
else:
|
else:
|
||||||
return HttpResponseRedirect('/')
|
return HttpResponseRedirect('/')
|
||||||
|
|
||||||
def home(request):
|
def home(request):
|
||||||
if request.user.is_authenticated():
|
if request.user.is_authenticated():
|
||||||
|
@ -164,23 +164,19 @@ def work(request, work_id, action='display'):
|
||||||
base_url = request.build_absolute_uri("/")[:-1]
|
base_url = request.build_absolute_uri("/")[:-1]
|
||||||
|
|
||||||
|
|
||||||
#may want to deprecate the following
|
return render(request, 'work.html', {
|
||||||
if action == 'setup_campaign':
|
'work': work,
|
||||||
return render(request, 'setup_campaign.html', {'work': work})
|
'premiums': premiums,
|
||||||
else:
|
'ungluers': userlists.supporting_users(work, 5),
|
||||||
return render(request, 'work.html', {
|
'claimform': claimform,
|
||||||
'work': work,
|
'wishers': wishers,
|
||||||
'premiums': premiums,
|
'base_url': base_url,
|
||||||
'ungluers': userlists.supporting_users(work, 5),
|
'editions': editions,
|
||||||
'claimform': claimform,
|
'pubdate': pubdate,
|
||||||
'wishers': wishers,
|
'pledged':pledged,
|
||||||
'base_url': base_url,
|
'activetab': activetab,
|
||||||
'editions': editions,
|
'alert':alert
|
||||||
'pubdate': pubdate,
|
})
|
||||||
'pledged':pledged,
|
|
||||||
'activetab': activetab,
|
|
||||||
'alert':alert
|
|
||||||
})
|
|
||||||
|
|
||||||
def manage_campaign(request, id):
|
def manage_campaign(request, id):
|
||||||
campaign = get_object_or_404(models.Campaign, id=id)
|
campaign = get_object_or_404(models.Campaign, id=id)
|
||||||
|
@ -1546,19 +1542,19 @@ def emailshare(request):
|
||||||
title = book.title
|
title = book.title
|
||||||
# if title requires unicode let's ignore it for now
|
# if title requires unicode let's ignore it for now
|
||||||
try:
|
try:
|
||||||
title = ', '+str(title)+', '
|
title = ', '+str(title)+', '
|
||||||
except:
|
except:
|
||||||
title = ' '
|
title = ' '
|
||||||
try:
|
try:
|
||||||
status = book.last_campaign().status
|
status = book.last_campaign().status
|
||||||
except:
|
except:
|
||||||
status = None
|
status = None
|
||||||
|
|
||||||
# customize the call to action depending on campaign status
|
# customize the call to action depending on campaign status
|
||||||
if status == 'ACTIVE':
|
if status == 'ACTIVE':
|
||||||
message = 'Help me unglue one of my favorite books'+title+'on Unglue.It: '+next+'. If enough of us pledge to unglue this book, the creator will be paid and the ebook will become free to everyone on earth.'
|
message = 'Help me unglue one of my favorite books'+title+'on Unglue.It: '+next+'. If enough of us pledge to unglue this book, the creator will be paid and the ebook will become free to everyone on earth.'
|
||||||
else:
|
else:
|
||||||
message = 'Help me unglue one of my favorite books'+title+'on Unglue.It: '+next+'. If enough of us wishlist this book, Unglue.It may start a campaign to pay the creator and make the ebook free to everyone on earth.'
|
message = 'Help me unglue one of my favorite books'+title+'on Unglue.It: '+next+'. If enough of us wishlist this book, Unglue.It may start a campaign to pay the creator and make the ebook free to everyone on earth.'
|
||||||
form = EmailShareForm(initial={'next':next, 'subject': 'Come see one of my favorite books on Unglue.It', 'message': message})
|
form = EmailShareForm(initial={'next':next, 'subject': 'Come see one of my favorite books on Unglue.It', 'message': message})
|
||||||
except:
|
except:
|
||||||
next = ''
|
next = ''
|
||||||
|
|
Loading…
Reference in New Issue