it turns out that offer editing didn't quite work

pull/1/head
eric 2014-02-25 14:29:54 -05:00
parent 482d9be31d
commit e72f55f919
3 changed files with 7 additions and 1 deletions

View File

@ -407,10 +407,10 @@ class OfferForm(forms.ModelForm):
class Meta: class Meta:
model = Offer model = Offer
fields = 'work', 'price', 'license'
widgets = { widgets = {
'work': forms.HiddenInput, 'work': forms.HiddenInput,
'license': forms.HiddenInput, 'license': forms.HiddenInput,
'active': forms.HiddenInput,
} }
date_selector=range(date.today().year, settings.MAX_CC_DATE.year+1) date_selector=range(date.today().year, settings.MAX_CC_DATE.year+1)

View File

@ -395,7 +395,11 @@ Please fix the following before launching your campaign:
{{ offer.offer_form.active }} {{ offer.offer_form.active }}
{{ offer.offer_form.license }} {{ offer.offer_form.license }}
{{ offer.offer_form.work }}</span> {{ offer.offer_form.work }}</span>
{% if offer.active %}
<input type="submit" name="change_offer" value="Change Price" /> <input type="submit" name="change_offer" value="Change Price" />
{% else %}
<input type="submit" name="change_offer" value="Set Offer" /> <span class="yikes"><i>This offer is not active</a>
{% endif %}
</div></form> </div></form>
<p /> <p />
{% endfor %} {% endfor %}

View File

@ -665,6 +665,8 @@ def manage_campaign(request, id, action='manage'):
offer.offer_form=OfferForm(instance=offer, data = request.POST, prefix='offer_%d'%offer.id) offer.offer_form=OfferForm(instance=offer, data = request.POST, prefix='offer_%d'%offer.id)
if offer.offer_form.is_valid(): if offer.offer_form.is_valid():
offer.offer_form.save() offer.offer_form.save()
offer.active = True
offer.save()
alerts.append(_('Offer has been changed')) alerts.append(_('Offer has been changed'))
else: else:
alerts.append(_('Offer has not been changed')) alerts.append(_('Offer has not been changed'))