the open campaign form now automatically sets the end date and target to allowed values
parent
48666339a9
commit
9cbcea0f72
|
@ -94,8 +94,8 @@ class OpenCampaignForm(forms.ModelForm):
|
|||
userid = forms.IntegerField( required = True, widget = forms.HiddenInput )
|
||||
class Meta:
|
||||
model = Campaign
|
||||
fields = 'name', 'work', 'target', 'deadline', 'managers'
|
||||
widgets = { 'work': forms.HiddenInput, 'deadline': SelectDateWidget }
|
||||
fields = 'name', 'work', 'managers'
|
||||
widgets = { 'work': forms.HiddenInput }
|
||||
|
||||
class ManageCampaignForm(forms.ModelForm):
|
||||
paypal_receiver = forms.EmailField(
|
||||
|
|
|
@ -37,8 +37,6 @@
|
|||
{% csrf_token %}
|
||||
<p>Name the Campaign: {{ claim.campaign_form.name }}{{ claim.campaign_form.name.errors }}</p>
|
||||
<p>Choose your Campaign Manager(s): {{ 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>
|
||||
{{ claim.campaign_form.work }}{{ claim.campaign_form.work.errors }}
|
||||
{{ claim.campaign_form.userid }}{{ claim.campaign_form.userid.errors }}
|
||||
|
@ -92,7 +90,6 @@
|
|||
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 one or more managers for the campaign- someone who has an Unglue.it username.
|
||||
You'll also need to set an initial offering price and ending date for the campaign.
|
||||
The campaign managers will be able to set more parameters for the campaign.
|
||||
</li>
|
||||
<li>
|
||||
|
|
|
@ -241,7 +241,11 @@ def rh_tools(request):
|
|||
if request.method == 'POST' and int(request.POST['work']) == claim.work.id :
|
||||
claim.campaign_form = OpenCampaignForm(request.POST)
|
||||
if claim.campaign_form.is_valid():
|
||||
claim.campaign_form.save()
|
||||
new_campaign = claim.campaign_form.save(commit=False)
|
||||
new_campaign.deadline = datetime.date.today() + datetime.timedelta(days=int(settings.UNGLUEIT_LONGEST_DEADLINE))
|
||||
new_campaign.target = D(settings.UNGLUEIT_MINIMUM_TARGET)
|
||||
new_campaign.save()
|
||||
claim.campaign_form.save_m2m()
|
||||
claim.can_open_new=False
|
||||
else:
|
||||
claim.campaign_form = OpenCampaignForm(data={'work': claim.work, 'name': claim.work.title, 'userid': request.user.id})
|
||||
|
|
Loading…
Reference in New Issue