diff --git a/core/models.py b/core/models.py index 99a6d956..4d9de8f0 100755 --- a/core/models.py +++ b/core/models.py @@ -793,7 +793,6 @@ class Work(models.Model): status = 0 campaign = self.last_campaign() if campaign is not None: - print campaign.status if(campaign.status == 'SUCCESSFUL'): status = 6 elif(campaign.status == 'ACTIVE'): @@ -801,7 +800,6 @@ class Work(models.Model): if target <= 0: status = 6 else: - print campaign.type if campaign.type == BUY2UNGLUE: status = int( 6 - 6*campaign.left/campaign.target) else: diff --git a/core/tests.py b/core/tests.py index 092a1b91..5f76b6e7 100755 --- a/core/tests.py +++ b/core/tests.py @@ -435,8 +435,6 @@ class CampaignTests(TestCase): ) self.assertTrue(c.set_dollar_per_day()<0.34) self.assertTrue(c.dollar_per_day>0.31) - #c.save() - #self.assertEqual(w.percent_unglued(),0) c._current_total = D(6000.1) c.status = 'ACTIVE' c.save() diff --git a/frontend/forms.py b/frontend/forms.py index cec81eb7..f5f33e88 100644 --- a/frontend/forms.py +++ b/frontend/forms.py @@ -3,7 +3,7 @@ external library imports """ import logging -from datetime import timedelta, datetime +from datetime import timedelta, datetime, date from decimal import Decimal as D """ @@ -360,10 +360,16 @@ class OfferForm(forms.ModelForm): widgets = { 'work': forms.HiddenInput, } + +date_selector=range(date.today().year, settings.MAX_CC_DATE.year+1) + def getManageCampaignForm ( instance, data=None, *args, **kwargs ): + def get_queryset(): work=instance.work return Edition.objects.filter(work = work) + def get_widget_class(widget_classes): + return widget_classes[instance.type-1] class ManageCampaignForm(forms.ModelForm): paypal_receiver = forms.EmailField( @@ -374,13 +380,16 @@ def getManageCampaignForm ( instance, data=None, *args, **kwargs ): target = forms.DecimalField( min_value= D(settings.UNGLUEIT_MINIMUM_TARGET), error_messages={'required': 'Please specify a target price.'} ) edition = forms.ModelChoiceField(get_queryset(), widget=RadioSelect(),empty_label='no edition selected',required = False,) minimum_target = settings.UNGLUEIT_MINIMUM_TARGET + maximum_target = settings.UNGLUEIT_MAXIMUM_TARGET + max_cc_date = settings.MAX_CC_DATE publisher = forms.ModelChoiceField(instance.work.publishers(), empty_label='no publisher selected', required = False,) class Meta: model = Campaign fields = 'description', 'details', 'license', 'target', 'deadline', 'paypal_receiver', 'edition', 'email', 'publisher', 'cc_date_initial', widgets = { - 'deadline': SelectDateWidget, 'cc_date_initial': SelectDateWidget, + 'deadline': get_widget_class((SelectDateWidget,forms.HiddenInput)), + 'cc_date_initial': get_widget_class((forms.HiddenInput,SelectDateWidget(years=date_selector))), } def clean_target(self): @@ -393,7 +402,7 @@ def getManageCampaignForm ( instance, data=None, *args, **kwargs ): return new_target def clean_deadline(self): - if self.data['type']=='1': + if self.instance.type=='1': new_deadline_date = self.cleaned_data['deadline'] new_deadline= new_deadline_date + timedelta(hours=23,minutes=59) if self.instance: @@ -405,7 +414,10 @@ def getManageCampaignForm ( instance, data=None, *args, **kwargs ): raise forms.ValidationError(_('The chosen closing date is in the past')) return new_deadline else: - return settings.B2U_ENDING + if self.instance.status == 'ACTIVE': + return self.instance.deadline + else: + return date.today() + settings.B2U_TERM def clean_license(self): new_license = self.cleaned_data['license'] diff --git a/frontend/templates/manage_campaign.html b/frontend/templates/manage_campaign.html index ca876d43..d9d6a1c2 100644 --- a/frontend/templates/manage_campaign.html +++ b/frontend/templates/manage_campaign.html @@ -87,7 +87,7 @@ Please fix the following before launching your campaign: {% endifequal %}
- book list status + book list status
@@ -143,47 +143,70 @@ Please fix the following before launching your campaign:

If the edition details are inaccurate (e.g. wrong cover image), go ahead and set up the campaign with that edition anyway. You'll be able to edit the edition details from this page later on.

{% endif %}

If you don't see an edition that matches what you want to release, you can create a new edition.

- {% ifnotequal campaign_status 'ACTIVE' %} -

Target Price

-

This is the target price for your campaign. The minimum target is ${{form.minimum_target|intcomma}}.

- -

Your target should be high enough to compensate you for potential lost future revenue from sales of this edition and reflect well on your brand, but low enough to seem realistic to supporters; people are more likely to back campaigns that they think will succeed.

- -

Once you launch the campaign, you'll be able to decrease your target, but not increase it.

- -

Please email us if you want to talk about pricing strategy.

- - {{ form.target.errors }}${{ form.target }} +{% ifnotequal campaign_status 'ACTIVE' %}

License being offered

This is the license you are offering to use once the campaign succeeds. For more information on the licenses you can use, see Creative Commons: About the Licenses. Once your campaign is active, you'll be able to switch to a less restrictive license, but not a more restrictive one. We encourage you to pick the least restrictive license you are comfortable with, as this will increase the ways people can use your unglued ebook and motivate more people to donate.

{{ form.license.errors }}{{ form.license }} -

Ending date

-

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. The latest ending you can choose right now is {{ campaign.latest_ending }}

- {% if campaign.rh.can_sell %} -

The ending date is ignored if you have chosen a Buy to Unglue campaign.

- {% endif %} - {{ form.deadline.errors }}{{ form.deadline }} - - {% else %} -

Target Price

-

The current target price for your campaign is ${{ campaign.target|intcomma }}. Since your campaign is active, you may lower, but not raise, this target.

- ${{ form.target.errors }}{{ form.target }} + {% ifequal campaign.type 1 %} +

Target Price

+

This is the target price for your campaign. The minimum target is ${{form.minimum_target|intcomma}}.

+ +

Your target should be high enough to compensate you for potential lost future revenue from sales of this edition and reflect well on your brand, but low enough to seem realistic to supporters; people are more likely to back campaigns that they think will succeed.

+ +

Once you launch the campaign, you'll be able to decrease your target, but not increase it.

+ +

Please email us if you want to talk about pricing strategy.

+ + {{ form.target.errors }}${{ form.target }} + +

Ending date

+

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. The latest ending you can choose right now is {{ campaign.latest_ending }}

+ {{ form.deadline.errors }}{{ form.deadline }} + {{ form.cc_date_inital }} + {% else %} +

Revenue Target

+

This is the revenue target for your campaign. If you hit this target, your book gets released immediately, for free, under the Creative Commons License that you've specified. With time the actual revenue needed to trigger Creative Commons will gradually decrease.

+ +

The minimum revenue target is ${{form.minimum_target|intcomma}}.The maximum revenue target is ${{form.maximum_target|intcomma}}. Yep.

+ +

Your target should be high enough to compensate you for potential lost future revenue from sales of this edition and reflect well on your brand, but low enough to seem realistic to supporters; people are more likely to back campaigns that they think will succeed.

+ +

Once you launch the campaign, you'll be able to decrease your target, but not increase it.

+ +

Please email us if you want to talk about pricing strategy.

+ + {{ form.target.errors }}${{ form.target }} + +

Initial CC Date

+

When you launch a Buy-To-Unglue campaign, you will specify a date in the future at which your book will become Creative Commons Licensed. eBooks sold via unglue.it will include a notice of this license. With every sale, the effective date of this license will advance a bit toward the present.

+

Before launching a campaign, you'll need to select Your initial CC Date. Together with your campaign revenue target, this will define when your book becomes "unglued". Your starting CC Date must be before {{ form.max_cc_date }}

+ {{ form.cc_date_initial.errors }}{{ form.cc_date_initial }} + {{ form.deadline }} + {% endifequal %} + +{% else %}

License being offered

If your campaign succeeds, you will be offering your ebook under a {{ campaign.license }} license.

Since your campaign is active, you may only change the license to remove restrictions. For more information on the licenses you can use, see Creative Commons: About the Licenses.

{{ form.license.errors }}{{ form.license }} - {% ifequal campaign.type 2 %} - -
{{ form.deadline }}
+

Target Price

+

The current target price for your campaign is ${{ campaign.target|intcomma }}. Since your campaign is active, you may lower, but not raise, this target.

+ ${{ form.target.errors }}{{ form.target }} + + {% ifequal campaign.type 1 %} +

Ending date

+

The ending date of your campaign is {{ campaign.deadline }}. Your campaign will conclude on this date or when you meet your target price, whichever is earlier. You may not change the ending date of an active campaign.

+ {{ form.deadline.errors }}{{ form.deadline }} {% else %} -

Ending date

-

The ending date of your campaign is {{ campaign.deadline }}. Your campaign will conclude on this date or when you meet your target price, whichever is earlier. You may not change the ending date of an active campaign.

- {{ form.deadline.errors }}{{ form.deadline }} + {{ form.deadline }} +

Ending date

+

Your sales campaign will run until {{ campaign.deadline }}. Contact unglue.it staff to extend it.

{% endifequal %} - {% endifnotequal %} +{% endifnotequal %}

Make Your Pitch

@@ -193,39 +216,13 @@ Please fix the following before launching your campaign: -

Above all, be engaging. The point here is not to tell ungluers everything about your book; it's to remind them why they love it.

- -

Looking for inspiration? Check out the all-time most-funded projects on crowdfunding sites Kickstarter or IndieGogo, or have a look at Kickstarter's Publishing category or IndieGogo's Writing category.

How to add video

We strongly encourage you to include video that communicates directly with your supporters. To add a video:

diff --git a/frontend/views.py b/frontend/views.py index 028558b7..dddbc179 100755 --- a/frontend/views.py +++ b/frontend/views.py @@ -585,6 +585,7 @@ def manage_campaign(request, id): form= getManageCampaignForm(instance=campaign, data=request.POST) if form.is_valid(): form.save() + campaign.set_dollar_per_day() if campaign.type==models.BUY2UNGLUE: offers= campaign.work.create_offers() for offer in offers: diff --git a/settings/common.py b/settings/common.py index b0eb352e..4b1d9c64 100644 --- a/settings/common.py +++ b/settings/common.py @@ -264,7 +264,7 @@ UNGLUEIT_MAXIMUM_TARGET = 10000000 # in US Dollars UNGLUEIT_LONGEST_DEADLINE = '180' # number of days allowed for a campaign UNGLUEIT_RECOMMENDED_USERNAME = 'unglueit' B2U_TERM = datetime.timedelta(days=5*365 +1 ) # 5 years? -MAX_CC_DATE = datetime.date( 2113,1,1) +MAX_CC_DATE = datetime.date( 2099,12,31) TEST_RUNNER = "djcelery.contrib.test_runner.CeleryTestSuiteRunner" import djcelery