Skip to content

Commit

Permalink
pep
Browse files Browse the repository at this point in the history
  • Loading branch information
dom-inic committed May 2, 2024
1 parent b9b7cfb commit 3f2ddac
Show file tree
Hide file tree
Showing 14 changed files with 35 additions and 20 deletions.
1 change: 1 addition & 0 deletions cart/cart.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from decimal import Decimal
from django.conf import settings

from shop.models import Product
from coupon.models import Coupon

Expand Down
5 changes: 3 additions & 2 deletions cart/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
from django.views.decorators.http import require_POST
from django.http import HttpResponseRedirect, JsonResponse
from django.urls import reverse

from shop.models import Product
from shop.recommender import Recommender
from coupon.forms import CouponApplyForm
from .cart import Cart
from .forms import CartAddProductForm
from coupon.forms import CouponApplyForm
from shop.recommender import Recommender

@require_POST
def cart_add(request, product_id):
Expand Down
1 change: 1 addition & 0 deletions coupon/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from django.shortcuts import render, redirect
from django.utils import timezone
from django.views.decorators.http import require_POST

from . models import Coupon
from . forms import CouponApplyForm

Expand Down
2 changes: 2 additions & 0 deletions orders/forms.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from django import forms

from localflavor.us.forms import USZipCodeField

from . models import Order

class OrderCreateForm(forms.ModelForm):
Expand Down
8 changes: 5 additions & 3 deletions orders/models.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
from django.db import models
from shop.models import Product
from decimal import Decimal

from django.db import models
from django.core.validators import MaxValueValidator, MinValueValidator
from coupon.models import Coupon
from django.utils.translation import gettext_lazy as _

from shop.models import Product
from coupon.models import Coupon


class Order(models.Model):
first_name = models.CharField(_('first name'),max_length=50)
Expand Down
2 changes: 2 additions & 0 deletions orders/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
from django.http import HttpResponse
from django.template.loader import render_to_string
from django.contrib.auth.decorators import login_required

import weasyprint

from . models import OrderItem, Order
from . forms import OrderCreateForm
from cart.cart import Cart
Expand Down
7 changes: 5 additions & 2 deletions payment/tasks.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
from io import BytesIO
from celery import shared_task
import weasyprint

from django.template.loader import render_to_string
from django.core.mail import EmailMessage
from django.conf import settings

from celery import shared_task
import weasyprint

from orders.models import Order

@shared_task
Expand Down
3 changes: 2 additions & 1 deletion payment/urls.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from django.urls import path
from . import views
from django.utils.translation import gettext_lazy as _

from . import views

app_name='payment'

urlpatterns = [
Expand Down
7 changes: 5 additions & 2 deletions payment/views.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
from django.shortcuts import render, redirect, get_object_or_404
from django.conf import settings
from orders.models import Order
from django.contrib.auth.decorators import login_required

import braintree

from orders.models import Order
from . tasks import payment_completed
from django.contrib.auth.decorators import login_required

# instantiate braintree payment gateway

gateway = braintree.BraintreeGateway(settings.BRAINTREE_CONF)
Expand Down
3 changes: 1 addition & 2 deletions procentapi/settings/development.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# deployed but still under development
# for local use development
import os
from procentapi.settings.base import BASE_DIR
from . base import *
from . base import * # noqa: F403


DEBUG = True
Expand Down
3 changes: 1 addition & 2 deletions procentapi/settings/local.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# for local use development
import os
from procentapi.settings.base import BASE_DIR
from . base import *
from . base import * # noqa: F403


DEBUG = True
Expand Down
9 changes: 4 additions & 5 deletions procentapi/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
# production but not under development
import os

from procentapi.settings.base import BASE_DIR
from . base import *
from . base import * # noqa: F403
import django_heroku

DEBUG = False
Expand All @@ -12,14 +11,14 @@
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3', # noqa: F405
}
}

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles/')
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles/') # noqa: F405
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static'),
os.path.join(BASE_DIR, 'static'), # noqa: F405
]
REDIS_HOST = os.environ['REDIS_HOST']
REDIS_PORT = os.environ['REDIS_PORT']
Expand Down
1 change: 1 addition & 0 deletions shop/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from django.db import models
from django.urls import reverse

from parler.models import TranslatableModel, TranslatedFields

# Create your models here.
Expand Down
3 changes: 2 additions & 1 deletion shop/views.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from django.shortcuts import render, get_object_or_404
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.core.paginator import Paginator

from . models import Category, Product
from cart.forms import CartAddProductForm
from . recommender import Recommender
Expand Down

0 comments on commit 3f2ddac

Please sign in to comment.