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 Supporter, DGGallery, DGPicture, Booking, BookingPrice,\
|
||||
from .models import DGGallery, DGPicture, Booking, BookingPrice,\
|
||||
MembershipOrder, Membership, MembershipType, BookingOrder, BookingCancellation
|
||||
|
||||
from django.core.urlresolvers import reverse
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
from cms.plugin_base import CMSPluginBase
|
||||
from cms.plugin_pool import plugin_pool
|
||||
from cms.wizards import wizard_base
|
||||
from .models import DGGalleryPlugin, DGSupportersPlugin, Supporter
|
||||
from django.utils.translation import ugettext as _
|
||||
#
|
||||
|
||||
|
||||
class CMSGalleryPlugin(CMSPluginBase):
|
||||
model = DGGalleryPlugin
|
||||
name = _("Digital Glarus Gallery")
|
||||
|
|
@ -11,12 +11,13 @@ class CMSGalleryPlugin(CMSPluginBase):
|
|||
|
||||
def render(self, context, instance, placeholder):
|
||||
context.update({
|
||||
'gallery':instance.dgGallery,
|
||||
'object':instance,
|
||||
'placeholder':placeholder
|
||||
'gallery': instance.dgGallery,
|
||||
'object': instance,
|
||||
'placeholder': placeholder
|
||||
})
|
||||
return context
|
||||
|
||||
|
||||
class CMSSupportersPlugin(CMSPluginBase):
|
||||
name = _("Digital Glarus Supporters")
|
||||
model = DGSupportersPlugin
|
||||
|
|
@ -26,11 +27,10 @@ class CMSSupportersPlugin(CMSPluginBase):
|
|||
context.update({
|
||||
'supporters': Supporter.objects.all().order_by('name'),
|
||||
'object': instance,
|
||||
'placeholder':placeholder
|
||||
'placeholder': placeholder
|
||||
})
|
||||
return context
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
|
||||
plugin_pool.register_plugin(CMSGalleryPlugin)
|
||||
plugin_pool.register_plugin(CMSSupportersPlugin)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
from django import forms
|
||||
from django.db.models import Q
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
from utils.models import BillingAddress
|
||||
|
|
@ -92,7 +91,7 @@ class CancelBookingForm(forms.ModelForm):
|
|||
class BookingDateForm(forms.Form):
|
||||
start_date = forms.DateField(required=False,
|
||||
widget=forms.TextInput(attrs={'id': 'booking-date-1',
|
||||
'value': 'Select your date'}))
|
||||
'value': 'Select your date'}))
|
||||
end_date = forms.DateField(required=False,
|
||||
widget=forms.TextInput(attrs={'id': 'booking-date-2'}))
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ from django.conf import settings
|
|||
import stripe
|
||||
stripe.api_key = settings.STRIPE_API_PRIVATE_KEY
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = "Record payment plans for Digital Glarus on stripe"
|
||||
|
||||
|
|
@ -10,5 +11,3 @@ class Command(BaseCommand):
|
|||
print("Available plans:")
|
||||
for plan in stripe.Plan.all():
|
||||
print(plan)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -11,11 +11,11 @@ PAYMENT_PLANS = [
|
|||
'id': "spontaneus"
|
||||
}),
|
||||
('committed', {
|
||||
'amount':36000,
|
||||
'interval':'year',
|
||||
'name':'The Committed',
|
||||
'currency':'chf',
|
||||
'id':'committed'
|
||||
'amount': 36000,
|
||||
'interval': 'year',
|
||||
'name': 'The Committed',
|
||||
'currency': 'chf',
|
||||
'id': 'committed'
|
||||
})
|
||||
]
|
||||
|
||||
|
|
@ -26,8 +26,6 @@ class Command(BaseCommand):
|
|||
def handle(self, *args, **options):
|
||||
for payment_plan, data in PAYMENT_PLANS:
|
||||
try:
|
||||
res = stripe.Plan.create(**data)
|
||||
stripe.Plan.create(**data)
|
||||
except stripe.InvalidRequestError as e:
|
||||
print(e)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ class Membership(models.Model):
|
|||
has_order_current_month = Q(membershiporder__customer__user=user,
|
||||
membershiporder__created_at__month=datetime.today().month)
|
||||
# has_order_past_month = Q(membershiporder__customer__user=user,
|
||||
# membershiporder__created_at__month=past_month)
|
||||
# membershiporder__created_at__month=past_month)
|
||||
active_membership = Q(active=True)
|
||||
# return cls.objects.filter(has_order_past_month | has_order_current_month).\
|
||||
return cls.objects.filter(has_order_current_month).\
|
||||
|
|
@ -316,17 +316,20 @@ class DGGallery(models.Model):
|
|||
|
||||
class Meta:
|
||||
verbose_name_plural = 'dgGallery'
|
||||
#
|
||||
|
||||
|
||||
class DGPicture(models.Model):
|
||||
gallery = models.ForeignKey(DGGallery)
|
||||
image = FilerImageField(related_name='dg_gallery')
|
||||
image = FilerImageField(related_name='dg_gallery')
|
||||
description = models.CharField(max_length=60)
|
||||
|
||||
def __str__(self):
|
||||
return "%s" % (self.image.name)
|
||||
|
||||
|
||||
class DGGalleryPlugin(CMSPlugin):
|
||||
dgGallery = models.ForeignKey(DGGallery)
|
||||
|
||||
|
||||
class DGSupportersPlugin(CMSPlugin):
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import json
|
||||
from model_mommy import mommy
|
||||
from unittest import mock
|
||||
|
||||
|
|
@ -150,7 +149,7 @@ class MembershipPaymentViewTest(BaseTestCase):
|
|||
# self.assertTrue(HostingOrder.objects.filter(customer=stripe_customer).exists())
|
||||
# hosting_order = HostingOrder.objects.filter(customer=stripe_customer)[0]
|
||||
# vm_plan = {
|
||||
# 'cores': hosting_order.vm_plan.cores,
|
||||
# 'cores': hosting_order.vm_plan.cores,
|
||||
# 'memory': hosting_order.vm_plan.memory,
|
||||
# 'disk_size': hosting_order.vm_plan.disk_size,
|
||||
# 'price': hosting_order.vm_plan.price,
|
||||
|
|
|
|||
|
|
@ -720,7 +720,9 @@ class ContactView(FormView):
|
|||
messages.add_message(self.request, messages.SUCCESS, self.success_message)
|
||||
return super(ContactView, self).form_valid(form)
|
||||
|
||||
############## OLD VIEWS
|
||||
|
||||
# OLD VIEWS
|
||||
|
||||
|
||||
def blog(request):
|
||||
tags = ["digitalglarus"]
|
||||
|
|
@ -751,6 +753,3 @@ def supporters(request):
|
|||
'supporters': Supporter.objects.order_by('name')
|
||||
}
|
||||
return render(request, 'supporters.html', context)
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue