Private
Public Access
1
0

added subscription_id

This commit is contained in:
Sander Roosendaal
2018-12-19 21:51:39 +01:00
parent d70725f2b3
commit a0a03a90df
5 changed files with 19 additions and 4 deletions

View File

@@ -124,7 +124,7 @@ class VirtualRaceResultAdmin(admin.ModelAdmin):
search_fields = ['race__name','username']
class PaidPlanAdmin(admin.ModelAdmin):
list_display = ('name','shortname','price','paymenttype','paymentprocessor','clubsize')
list_display = ('name','shortname','price','paymenttype','paymentprocessor','clubsize','external_id')
admin.site.unregister(User)
admin.site.register(User,UserAdmin)

View File

@@ -114,6 +114,7 @@ def create_subscription(rower,data):
rower.clubsize = plan.clubsize
rower.paymenttype = plan.paymenttype
rower.rowerplan = plan.shortname
rower.subscription_id = result.subscription.id
rower.save()
return True
else:

View File

@@ -571,7 +571,7 @@ class PaidPlan(models.Model):
clubsize = models.IntegerField(default=0)
def __unicode__(self):
return '{name} - {shortname} at {price} EURO ({paymenttype} payment)'.format(
return '{name} - {shortname} at {price:.2f} EURO ({paymenttype} payment)'.format(
name = self.name,
shortname = self.shortname,
price = self.price,
@@ -623,6 +623,8 @@ class Rower(models.Model):
postal_code = models.CharField(default='',blank=True,null=True,max_length=200)
customer_id = models.CharField(default=None,null=True,blank=True,max_length=200)
subscription_id = models.CharField(default=None,null=True,
blank=True,max_length=200)
rowerplan = models.CharField(default='basic',max_length=30,
choices=plans)
@@ -634,7 +636,7 @@ class Rower(models.Model):
paymentprocessor = models.CharField(max_length=50,
choices=paymentprocessors,
null=True,blank=True,
default=None)
default='braintree')
paidplan = models.ForeignKey(PaidPlan,null=True,default=None)

View File

@@ -22,7 +22,7 @@ def setrowerplans():
if paidplans:
r.paidplan = paidplans[0]
r.paymenttype = 'paypal'
r.paymentprocessor = 'paypal'
r.save()
else:
print 'Could not set plan for ',r

View File

@@ -241,6 +241,18 @@
{% endif %}
</button>
</td>
{% elif rower and rower.rowerplan == 'coach' and rower.clubsize < 100 %}
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>
<button style="width:100%">
{% if user|existing_customer %}
<a href="/rowers/upgrade">UPGRADE NOW</a>
{% else %}
<a href="/rowers/billing">BUY NOW</a>
{% endif %}
</button>
</td>
{% else %}
<td colspan=3>
&nbsp;