Added Flake8 lib and fixed PEP8 violations
This commit is contained in:
parent
0cbd3aa666
commit
edcfd3e9f4
65 changed files with 340 additions and 387 deletions
|
|
@ -1,5 +1,5 @@
|
|||
from django.contrib import admin
|
||||
from .models import BillingAddress, UserBillingAddress
|
||||
from .models import UserBillingAddress
|
||||
|
||||
# Register your models here.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
from django.utils.translation import ugettext as _
|
||||
from django.db import models
|
||||
from django import forms
|
||||
|
||||
# http://xml.coverpages.org/country3166.html
|
||||
COUNTRIES = (
|
||||
|
|
@ -255,4 +254,4 @@ class CountryField(models.CharField):
|
|||
super(CountryField, self).__init__(*args, **kwargs)
|
||||
|
||||
def get_internal_type(self):
|
||||
return "CharField"
|
||||
return "CharField"
|
||||
|
|
|
|||
|
|
@ -115,7 +115,8 @@ class BillingAddressForm(forms.ModelForm):
|
|||
|
||||
class UserBillingAddressForm(forms.ModelForm):
|
||||
user = forms.ModelChoiceField(queryset=CustomUser.objects.all(),
|
||||
widget=forms.HiddenInput())
|
||||
widget=forms.HiddenInput())
|
||||
|
||||
class Meta:
|
||||
model = UserBillingAddress
|
||||
fields = ['street_address', 'city', 'postal_code', 'country', 'user']
|
||||
|
|
@ -126,6 +127,7 @@ class UserBillingAddressForm(forms.ModelForm):
|
|||
'Country': _('Country'),
|
||||
}
|
||||
|
||||
|
||||
class ContactUsForm(forms.ModelForm):
|
||||
error_css_class = 'autofocus'
|
||||
|
||||
|
|
|
|||
|
|
@ -77,4 +77,3 @@ class DigitalGlarusRegistrationMailer(BaseMailer):
|
|||
self.registration = self.message
|
||||
self._message = self._message.format(slug=self._slug)
|
||||
super().__init__()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
from django.db import models
|
||||
from django.core import serializers
|
||||
from django.forms.models import model_to_dict
|
||||
|
||||
from membership.models import CustomUser
|
||||
|
||||
|
|
@ -18,6 +16,7 @@ class BaseBillingAddress(models.Model):
|
|||
class Meta:
|
||||
abstract = True
|
||||
|
||||
|
||||
class BillingAddress(BaseBillingAddress):
|
||||
|
||||
def __str__(self):
|
||||
|
|
|
|||
|
|
@ -127,22 +127,10 @@ class StripeUtils(object):
|
|||
id=id)
|
||||
|
||||
@handleStripeError
|
||||
def make_payment(self, user, amount, token):
|
||||
def make_payment(self, customer, amount, token):
|
||||
charge = self.stripe.Charge.create(
|
||||
amount=amount, # in cents
|
||||
currency=self.CURRENCY,
|
||||
customer=customer
|
||||
)
|
||||
return charge
|
||||
|
||||
@handleStripeError
|
||||
def create_plan(self, amount, name, id):
|
||||
self.stripe.Plan.create(
|
||||
amount=amount,
|
||||
interval=self.INTERVAL,
|
||||
name=name,
|
||||
currency=self.CURRENCY,
|
||||
id=id)
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue