halfway through implementation of campaign management. can't launch campaigns yet. migrate schemas!

pull/1/head
eric 2011-11-20 22:23:51 -05:00
parent 8169e7ecb3
commit 43d3f3f553
8 changed files with 307 additions and 14 deletions

View File

@ -0,0 +1,198 @@
# 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.details'
db.add_column('core_campaign', 'details', self.gf('django.db.models.fields.TextField')(null=True), keep_default=False)
# Adding M2M table for field managers on 'Campaign'
db.create_table('core_campaign_managers', (
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
('campaign', models.ForeignKey(orm['core.campaign'], null=False)),
('user', models.ForeignKey(orm['auth.user'], null=False))
))
db.create_unique('core_campaign_managers', ['campaign_id', 'user_id'])
def backwards(self, orm):
# Deleting field 'Campaign.details'
db.delete_column('core_campaign', 'details')
# Removing M2M table for field managers on 'Campaign'
db.delete_table('core_campaign_managers')
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'}),
'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'}),
'suspended': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
'suspended_reason': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'target': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '14', 'decimal_places': '2'}),
'withdrawn': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
'withdrawn_reason': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'work': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'campaigns'", 'to': "orm['core.Work']"})
},
'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(2011, 11, 20, 22, 6, 56, 483212)', '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.CharField', [], {'max_length': '1024'})
},
'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'}),
'googlebooks_id': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'isbn_10': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True'}),
'isbn_13': ('django.db.models.fields.CharField', [], {'max_length': '13', 'null': 'True'}),
'language': ('django.db.models.fields.CharField', [], {'max_length': '2', 'null': 'True'}),
'oclc': ('django.db.models.fields.CharField', [], {'max_length': '25', 'null': 'True'}),
'public_domain': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'publication_date': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
'publisher': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'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.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': {'object_name': 'Subject'},
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'editions': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'subjects'", '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.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.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', 'to': "orm['core.Work']"})
},
'core.work': {
'Meta': {'object_name': 'Work'},
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'openlibrary_id': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '1000'})
}
}
complete_apps = ['core']

View File

@ -73,6 +73,7 @@ class Campaign(models.Model):
created = models.DateTimeField(auto_now_add=True)
name = models.CharField(max_length=500, null=True, blank=False)
description = 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)
deadline = models.DateTimeField()
activated = models.DateTimeField(null=True)
@ -83,7 +84,7 @@ class Campaign(models.Model):
paypal_receiver = models.CharField(max_length=100, blank=True)
amazon_receiver = models.CharField(max_length=100, blank=True)
work = models.ForeignKey("Work", related_name="campaigns", null=False)
manager = models.ManyToManyField(User, related_name="campaigns", null=False)
managers = models.ManyToManyField(User, related_name="campaigns", null=False)
def __unicode__(self):
try:

View File

@ -2,6 +2,7 @@ from django import forms
from django.db import models
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from django.forms.extras.widgets import SelectDateWidget
from decimal import Decimal as D
from selectable.forms import AutoCompleteSelectMultipleWidget,AutoCompleteSelectMultipleField
@ -24,7 +25,10 @@ class RightsHolderForm(forms.ModelForm):
widget=AutoCompleteSelectWidget(OwnerLookup),
required=True,
)
email = forms.EmailField(
label=_("notification email address for rights holder"),
max_length=100,
)
class Meta:
model = RightsHolder
@ -70,18 +74,33 @@ class UserData(forms.Form):
raise forms.ValidationError(_("Your username is already "+oldusername))
class OpenCampaignForm(forms.ModelForm):
manager = AutoCompleteSelectMultipleField(
managers = AutoCompleteSelectMultipleField(
OwnerLookup,
label='Campaign Manager',
label='Campaign Managers',
widget=AutoCompleteSelectMultipleWidget(OwnerLookup),
required=False,
)
userid = forms.IntegerField( required = True, widget = forms.HiddenInput )
class Meta:
model = Campaign
fields = 'name', 'work', 'target', 'deadline', 'manager'
fields = 'name', 'work', 'target', 'deadline', 'managers'
widgets = { 'work': forms.HiddenInput }
class ManageCampaignForm(forms.ModelForm):
paypal_receiver = forms.EmailField(
label=_("email address to collect Paypal funds"),
max_length=100,
)
target = forms.DecimalField( min_value=1000.00 )
class Meta:
model = Campaign
fields = 'description', 'details', 'target', 'deadline', 'paypal_receiver'
widgets = {
'description': forms.Textarea(attrs={'cols': 80, 'rows': 20}),
'details': forms.Textarea(attrs={'cols': 80, 'rows': 20}),
'deadline': SelectDateWidget
}
class CampaignPledgeForm(forms.Form):
preapproval_amount = forms.DecimalField(
@ -92,7 +111,7 @@ class CampaignPledgeForm(forms.Form):
decimal_places=2,
label="Pledge Amount",
)
anonymous = forms.BooleanField(required=False, label="Don't display my username in the supporters list")
anonymous = forms.BooleanField(required=False, label=_("Don't display my username in the supporters list"))
class GoodreadsShelfLoadingForm(forms.Form):
goodreads_shelf_name_number = forms.CharField(widget=forms.Select(choices=(

View File

@ -1,6 +1,6 @@
{% extends "base.html" %}
{% extends "basedocumentation.html" %}
{% block content %}
{% block doccontent %}
<h2>Campaigns</h2>
<ul>
{% for campaign in campaign_list %}

View File

@ -0,0 +1,51 @@
{% extends "basedocumentation.html" %}
{% block title %}Campaign Management{% endblock %}
{% block doccontent %}
{% if not request.user in campaign.managers.all %}
<h2>You're not a manager for this campaign</h2>
{% else %}
<h1>Manage the campaign</h1>
<h2>The work</h2>
<div class="book-detail-info">
<h2 class="book-name">Title: {{ campaign.work.title }}</h2>
<h3 class="book-author">Authors: {{ campaign.work.author }}</h3>
<h3 class="book-year">Published: {{ campaign.work.editions.all.0.publication_date }}</h3>
<h3 class="book-author">Language: {{ campaign.work.editions.all.0.language }}</h3>
</div>
<h3>Description of the offering</h2>
<form action="#" method="POST">
{% csrf_token %}
<p>This should include:</p>
<ul>
<li>A synopsis of the work.</li>
<li>Hyperlinks for the author(s), publisher making the offer, or for the work itself.</li>
</ul>
{{ form.description }}{{ form.description.errors }}
<h3>Offer details</h2>
<p>This should include:</p>
<ul>
<li>Details about the edition being offered.</li>
<li>Hyperlinks for the author(s), publisher making the offer, or for the work itself.</li>
</uL>
{{ form.details }}{{ form.details.errors }}
<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>
{{ form.target }}{{ form.target.errors }}
<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.
The ending date can't be more than six months away- that's a practical limit for credit card authorizations.</p>
{{ form.deadline }}{{ form.deadline.errors }}
<h3>Paypal collection address</h2>
<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>
{{ form.paypal_receiver }}{{ form.paypal_receiver.errors }}
{{ campaign.errors }}
<input type="submit" name="save" value="Save Campaign" />
<input type="submit" name="launch" value="Launch Campaign" />
</form>
{% endif %}
{% endblock %}

View File

@ -11,6 +11,21 @@
{% block doccontent %}
<h1>unglue.it Tools for Rightsholders</h1>
{% if request.user.campaigns.all %}
<h2>Campaigns You Manage</h2>
<dl>
{% for campaign in request.user.campaigns.all %}
<dt>Work: <a href="{% url work work_id=campaign.work.id %}">{{campaign.work.title }}</a></dt>
<dd>
<ul>
<li>Campaign: <a href="{% url manage_campaign campaign.id %}">{{ campaign.name }}</a></li>
<li>Status: {{ campaign.status }} </li>
<li>Created: {{ campaign.created }}</li>
</ul>
</dd>
{% endfor %}
</dl>
{% endif %}
{% if request.user.rights_holder.count %}
<h2>Works You Have Claimed</h2>
<dl>
@ -26,7 +41,7 @@
<form method="POST" action="#">
{% csrf_token %}
<p>Name the Campaign: {{ claim.campaign_form.name }}{{ claim.campaign_form.name.errors }}</p>
<p>Choose a Campaign Manager: {{ claim.campaign_form.manager }}{{ claim.campaign_form.manager.errors }}</p>
<p>Choose a Campaign Manager: {{ claim.campaign_form.managers }}{{ claim.campaign_form.managers.errors }}</p>
<p>Pick a Campaign End Date: {{ claim.campaign_form.deadline }} (You can change this before launching the campaign.){{ claim.campaign_form.deadline.errors }}</p>
<p>Set Your Price: {{ claim.campaign_form.target }} (You can change this before launching the campaign.){{ claim.campaign_form.deadline.errors }}</p>
<p>
@ -40,7 +55,7 @@
<h3>Campaigns for this work</h3>
{% for campaign in claim.campaigns %}
<p>Name: {{ campaign.name }} {{ campaign.status }} <br />Created: {{ campaign.created }}<br />
Manager(s): {% for user in campaign.manager.all %} <a href="{% url supporter user.username %}">{{ user.username }} </a> {% endfor %}</p>
Manager(s): {% for user in campaign.managers.all %} <a href="{% url supporter user.username %}">{{ user.username }} </a> {% endfor %}</p>
{% endfor %}
{% endif %}
{% endif %}
@ -80,10 +95,9 @@
<li>
When a claim has been approved, you're ready to open a campaign for the work.
A form will appear with the claim listing, above.
You'll need to pick a manager for the campaign- someone who has an Unglue.it username.
If you don't pick a campaign manager, that role will be assigned to you by default.
The campaign manager will be able to set parameters of the campaign.
Only you and the campaign manager will be able to see the campaign before the campaign is launged, so tweak away!
You'll need to pick one or more managers for the campaign- someone who has an Unglue.it username.
The campaign managers will be able to set parameters of the campaign.
Only you and the campaign managers will be able to see the campaign before the campaign is launged, so tweak away!
</li>
<li>
When a campaign is ready to launch, it will be activated.

View File

@ -16,6 +16,7 @@ urlpatterns = patterns(
url(r"^privacy/$", TemplateView.as_view(template_name="privacy.html"),
name="privacy"),
url(r"^rightsholders/$", "rh_tools", name="rightsholders"),
url(r"^rightsholders/campaign/(?P<id>\d+)/$", "manage_campaign", name="manage_campaign"),
url(r"^rightsholders/claim/$", "claim", name="claim"),
url(r"^rh_admin/$", "rh_admin", name="rh_admin"),
url(r"^faq/$", TemplateView.as_view(template_name="faq.html"),
@ -33,6 +34,7 @@ urlpatterns = patterns(
url(r"^stub/", "stub", name="stub"),
url(r"^work/(?P<work_id>\d+)/$", "work", name="work"),
url(r"^workstub/(?P<title>.+)/(?P<imagebase>.+)/(?P<image>.+)/(?P<author>.+)/(?P<googlebooks_id>.+)/$", "workstub", name="workstub"),
#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+)/$", "pledge", name="pledge"),
url(r"^celery/clear/$","clear_celery_tasks", name="clear_celery_tasks"),

View File

@ -29,6 +29,7 @@ from regluit.core.search import gluejar_search
from regluit.core.goodreads import GoodreadsClient
from regluit.frontend.forms import UserData, ProfileForm, CampaignPledgeForm, GoodreadsShelfLoadingForm
from regluit.frontend.forms import RightsHolderForm, ClaimForm, LibraryThingForm, OpenCampaignForm
from regluit.frontend.forms import ManageCampaignForm
from regluit.payment.manager import PaymentManager
from regluit.payment.parameters import TARGET_TYPE_CAMPAIGN
@ -62,6 +63,8 @@ def work(request, work_id, action='display'):
premiums = models.Premium.objects.filter(q)
else:
premiums = None
#may want to deprecate the following
if action == 'setup_campaign':
return render(request, 'setup_campaign.html', {'work': work})
else:
@ -71,6 +74,11 @@ def work(request, work_id, action='display'):
'ungluers': userlists.supporting_users(work, 5),
'claimform': claimform,
})
def manage_campaign(request, id):
campaign = get_object_or_404(models.Campaign, id=id)
form= ManageCampaignForm(instance=campaign)
return render(request, 'manage_campaign.html', {'campaign': campaign, 'form':form})
def workstub(request, title, imagebase, image, author, googlebooks_id, action='display'):
premiums = None