Git Product home page Git Product logo

django-ecommerce's People

Contributors

dependabot[bot] avatar lwlook avatar s3h10r avatar thesubjectsteve avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-ecommerce's Issues

Import "_frozen_importlib" could not be resolved and Import "_frozen_importlib_external" could not be resolved

(venv) PS D:\Poligon\django-ecommerce-master> python manage.py runserver
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
File "C:\Python39\lib\threading.py", line 973, in _bootstrap_inner
self.run()
File "C:\Python39\lib\threading.py", line 910, in run
self._target(*self.args, **self.kwargs)
File "D:\Poligon\django-ecommerce-master\venv\lib\site-packages\django\utils\autoreload.py", line 54, in wrapper
fn(*args, **kwargs)
File "D:\Poligon\django-ecommerce-master\venv\lib\site-packages\django\core\management\commands\runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "D:\Poligon\django-ecommerce-master\venv\lib\site-packages\django\utils\autoreload.py", line 77, in raise_last_exception
raise exception[1]
File "D:\Poligon\django-ecommerce-master\venv\lib\site-packages\django\core\management_init
.py", line 337, in execute
autoreload.check_errors(django.setup)()
File "D:\Poligon\django-ecommerce-master\venv\lib\site-packages\django\utils\autoreload.py", line 54, in wrapper
fn(*args, **kwargs)
File "D:\Poligon\django-ecommerce-master\venv\lib\site-packages\django_init
.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "D:\Poligon\django-ecommerce-master\venv\lib\site-packages\django\apps\registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "D:\Poligon\django-ecommerce-master\venv\lib\site-packages\django\apps\config.py", line 90, in create
module = import_module(entry)
File "C:\Python39\lib\importlib_init
.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'allauth'

Please help What do i have to do ?

ModuleNotFoundError: allauth

(nex) PS C:\Users\nexta\Documents\python project\My e-commerce website> python manage.py rename nextecommerce
Traceback (most recent call last):
File "C:\Users\nexta\Documents\python project\My e-commerce website\manage.py", line 15, in
execute_from_command_line(sys.argv)
File "C:\Users\nexta\Documents\python project\My e-commerce website\nex\lib\site-packages\django\core\management_init_.py", line 446, in execute_from_command_line
utility.execute()
File "C:\Users\nexta\Documents\python project\My e-commerce website\nex\lib\site-packages\django\core\management_init_.py", line 420, in execute
django.setup()
File "C:\Users\nexta\Documents\python project\My e-commerce website\nex\lib\site-packages\django_init_.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\nexta\AppData\Local\Programs\Python\Python310\lib\importlib_init_.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1050, in _gcd_import File "", line 1027, in _find_and_load
File "", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'allauth'(nex)
PS C:\Users\nexta\Documents\python project\My e-commerce website>

How to fix this new to Projects!

import error

ImportError: cannot import name 'six' from 'django.utils' (C:\Program Files\Python310\lib\site-packages\django\utils_init_.py)****

Error.......

There is an error coming in views.py in class based CheckOutView in post method line no 107 that......name 'is_valid_form' is not defined
I am not getting it....could you please help me with that

Rename command issue

Rename command looks for projectname/settings.py but settings.py has been depreciated for settings/base.py.

Can be fixed by changing core/management/commands/rename.py from:

    files_to_rename = [f'{current_project_name}/settings.py',
                      f'{current_project_name}/wsgi.py', 'manage.py']

To:

    files_to_rename = [f'{current_project_name}/settings/base.py',
                       f'{current_project_name}/wsgi.py', 'manage.py']

After payment, Cart item quantity starts from previous quantity

Am following this course , have already reached and implemented the payment but every time i add the item to cart, the quantity starts from the previous one..

e.g for an order having 2 apples = 450, wen the payment is made and ordered field set to True, wen the same item is added to cart, it's quantity starts from 2 instead of 1

Attribute Error

i'm currently having issues with the last few minutes of the video. i'm trying to make payment so that the card can be saved but i keep getting a django attribute error message on the page. The funny thing is on my stripe logs, the order status returns 200(OK) but the web page displays an attribute error "sources". This is where the error seems to be occuring: "customer.sources.create(source=token)".

Invalid Parameter Error

I have an issue with the card payment of stripe. So when I did according to the youtube video and tried a dummy card number. It just threw me a, 'Invalid Parameter error'. Can anyone help me with that?
Here is my PaymentView...

class PaymentView(View):
    def get(self,  *args, **kwargs):
        return render(self.request, "payment.html")


    def post(self, *args, **kwargs):
        order = Order.objects.get(user=self.request.user, ordered=False)
        token = self.request.POST.get('stripeToken')
        amount = order.get_total()

        try:
            charge = stripe.Charge.create(
                amount=amount,
                currency="usd",
                source=token,
            )
            payment = Payment()
            payment.stripe_charge_id = charge['id']
            payment.user = self.request.user
            payment.amount = amount
            payment.save()

            order.ordered = True
            order.payment = payment
            order.save()
            messages.success(self.request, 'Your order has been successful !')
            return redirect('/')

        except stripe.error.CardError as e:
            # Since it's a decline, stripe.error.CardError will be caught
            body = e.json_body
            err = body.get('error', {})
            print('Status is: %s' % e.http_status)
            print('Code is: %s' % e.code)
            # param is '' in this case
            print('Param is: %s' % e.param)
            print('Message is: %s' % e.user_message)
            return redirect('/')

        except stripe.error.RateLimitError as e:
            # Too many requests made to the API too quickly
            messages.error(self.request, 'Rate Limit Error')
            return redirect('/')

        except stripe.error.InvalidRequestError as e:
            # Invalid parameters were supplied to Stripe's API
            messages.error(self.request, 'Invalid parameters')
            return redirect('/')

        except stripe.error.AuthenticationError as e:
            # Authentication with Stripe's API failed
            # (maybe you changed API keys recently)
            messages.error(self.request, 'Not authenticated')
            return redirect('/')

        except stripe.error.APIConnectionError as e:
            # Network communication with Stripe failed
            messages.error(self.request, 'Network error')
            return redirect('/')

        except stripe.error.StripeError as e:
            # Display a very generic error to the user, and maybe send
            # yourself an email
            messages.error(
                self.request, 'Something went wrong! Please try again !')
            return redirect('/')

        except Exception as e:
            # Something else happened, completely unrelated to Stripe
            messages.error(
                self.request, 'A serious error occured! We have been notified!')
            return redirect('/')

Failed to load media/images

Hello,
Please to help me I push to de ploy the project all worked fine but the image in media even uploaded in my project pass 2 hours and give 404 error ,

in settings.py:
STATIC_URL = '/static/'
MEDIA_URL = '/media/'

Django debug toolbar

INTERNAL_IPS = ['127.0.0.1']

# Static files settings

PROJECT_ROOT = os.path.dirname(os.path.abspath(file))

STATIC_ROOT = os.path.join(PROJECT_ROOT, 'staticfiles')
MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media')
#MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media')

# Extra places for collectstatic to find static files.

STATICFILES_DIRS = (
os.path.join(PROJECT_ROOT, 'static'),
)

and urls:

from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path, include

urlpatterns = [
path('admin/', admin.site.urls),
path('accounts/', include('allauth.urls')),
path('', include('core.urls', namespace='core'))
]+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

if settings.DEBUG:
import debug_toolbar
urlpatterns += [path('debug/', include(debug_toolbar.urls))]
urlpatterns += static(settings.MEDIA_URL,
document_root=settings.MEDIA_ROOT)
urlpatterns += static(settings.STATIC_URL,
document_root=settings.STATIC_ROOT)
image

Signup error

ConnectionRefusedError at /accounts/signup/
[WinError 10061] No connection could be made because the target machine actively refused it

pip install -r requirements.text

ERROR: Exception:
Traceback (most recent call last):
  File "c:\users\karshit\desktop\django-ecommerce-master\lib\site-packages\pip\_
internal\cli\base_command.py", line 180, in _main
    status = self.run(options, args)

  File "c:\users\karshit\desktop\django-ecommerce-master\lib\site-packages\pip\_
internal\cli\req_command.py", line 204, in wrapper
    return func(self, options, args)

  File "c:\users\karshit\desktop\django-ecommerce-master\lib\site-packages\pip\_
internal\commands\install.py", line 318, in run
    requirement_set = resolver.resolve(
  File "c:\users\karshit\desktop\django-ecommerce-master\lib\site-packages\pip\_
internal\resolution\resolvelib\resolver.py", line 127, in resolve
    result = self._result = resolver.resolve(
  File "c:\users\karshit\desktop\django-ecommerce-master\lib\site-packages\pip\_
vendor\resolvelib\resolvers.py", line 473, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
  File "c:\users\karshit\desktop\django-ecommerce-master\lib\site-packages\pip\_
vendor\resolvelib\resolvers.py", line 341, in resolve
    name, crit = self._merge_into_criterion(r, parent=None)
  File "c:\users\karshit\desktop\django-ecommerce-master\lib\site-packages\pip\_
vendor\resolvelib\resolvers.py", line 172, in _merge_into_criterion
    if not criterion.candidates:
  File "c:\users\karshit\desktop\django-ecommerce-master\lib\site-packages\pip\_
vendor\resolvelib\structs.py", line 139, in __bool__
    return bool(self._sequence)
  File "c:\users\karshit\desktop\django-ecommerce-master\lib\site-packages\pip\_
internal\resolution\resolvelib\found_candidates.py", line 143, in __bool__
    return any(self)
  File "c:\users\karshit\desktop\django-ecommerce-master\lib\site-packages\pip\_
internal\resolution\resolvelib\found_candidates.py", line 129, in <genexpr>
    return (c for c in iterator if id(c) not in self._incompatible_ids)
  File "c:\users\karshit\desktop\django-ecommerce-master\lib\site-packages\pip\_
internal\resolution\resolvelib\found_candidates.py", line 30, in _iter_built
    for version, func in infos:
  File "c:\users\karshit\desktop\django-ecommerce-master\lib\site-packages\pip\_
internal\resolution\resolvelib\factory.py", line 258, in iter_index_candidate_in
fos
    result = self._finder.find_best_candidate(
  File "c:\users\karshit\desktop\django-ecommerce-master\lib\site-packages\pip\_
internal\index\package_finder.py", line 879, in find_best_candidate
    candidates = self.find_all_candidates(project_name)
  File "c:\users\karshit\desktop\django-ecommerce-master\lib\site-packages\pip\_
internal\index\package_finder.py", line 824, in find_all_candidates
    page_candidates = list(page_candidates_it)
  File "c:\users\karshit\desktop\django-ecommerce-master\lib\site-packages\pip\_
internal\index\sources.py", line 134, in page_candidates
    yield from self._candidates_from_page(self._link)
  File "c:\users\karshit\desktop\django-ecommerce-master\lib\site-packages\pip\_
internal\index\package_finder.py", line 783, in process_project_url
    html_page = self._link_collector.fetch_page(project_url)
  File "c:\users\karshit\desktop\django-ecommerce-master\lib\site-packages\pip\_
internal\index\collector.py", line 512, in fetch_page
    return _get_html_page(location, session=self.session)
  File "c:\users\karshit\desktop\django-ecommerce-master\lib\site-packages\pip\_
internal\index\collector.py", line 422, in _get_html_page
    resp = _get_html_response(url, session=session)
  File "c:\users\karshit\desktop\django-ecommerce-master\lib\site-packages\pip\_
internal\index\collector.py", line 120, in _get_html_response
    resp = session.get(
  File "c:\users\karshit\desktop\django-ecommerce-master\lib\site-packages\pip\_
vendor\requests\sessions.py", line 555, in get
    return self.request('GET', url, **kwargs)
  File "c:\users\karshit\desktop\django-ecommerce-master\lib\site-packages\pip\_
internal\network\session.py", line 449, in request
    return super().request(method, url, *args, **kwargs)
  File "c:\users\karshit\desktop\django-ecommerce-master\lib\site-packages\pip\_
vendor\requests\sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "c:\users\karshit\desktop\django-ecommerce-master\lib\site-packages\pip\_
vendor\requests\sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "c:\users\karshit\desktop\django-ecommerce-master\lib\site-packages\pip\_
vendor\cachecontrol\adapter.py", line 53, in send
    resp = super(CacheControlAdapter, self).send(request, **kw)
  File "c:\users\karshit\desktop\django-ecommerce-master\lib\site-packages\pip\_
vendor\requests\adapters.py", line 439, in send
    resp = conn.urlopen(
  File "c:\users\karshit\desktop\django-ecommerce-master\lib\site-packages\pip\_
vendor\urllib3\connectionpool.py", line 696, in urlopen
    self._prepare_proxy(conn)
  File "c:\users\karshit\desktop\django-ecommerce-master\lib\site-packages\pip\_
vendor\urllib3\connectionpool.py", line 964, in _prepare_proxy
    conn.connect()
  File "c:\users\karshit\desktop\django-ecommerce-master\lib\site-packages\pip\_
vendor\urllib3\connection.py", line 359, in connect
    conn = self._connect_tls_proxy(hostname, conn)
  File "c:\users\karshit\desktop\django-ecommerce-master\lib\site-packages\pip\_
vendor\urllib3\connection.py", line 500, in _connect_tls_proxy
    return ssl_wrap_socket(
  File "c:\users\karshit\desktop\django-ecommerce-master\lib\site-packages\pip\_
vendor\urllib3\util\ssl_.py", line 432, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls)
  File "c:\users\karshit\desktop\django-ecommerce-master\lib\site-packages\pip\_
vendor\urllib3\util\ssl_.py", line 474, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock)
  File "C:\Users\karshit\AppData\Local\Programs\Python\Python38\lib\ssl.py", lin
e 500, in wrap_socket
    return self.sslsocket_class._create(
  File "C:\Users\karshit\AppData\Local\Programs\Python\Python38\lib\ssl.py", lin
e 997, in _create
    raise ValueError("check_hostname requires server_hostname")
ValueError: check_hostname requires server_hostname

ImportError: cannot import name 'config' from 'decouple'

i got this error when i try to runserver
please help!!!!!!!!!!!!!!
my steps
1- pip install virtualenv
2- virtualenv env
3- source env/bin/active
4- pip install -r requirements.txt
5- python manage.py runserver

`Traceback (most recent call last):
File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\commands\runserver.py", line 60, in execute
super().execute(*args, **options)
File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\base.py", line 364, in execute
output = self.handle(*args, **options)
File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\commands\runserver.py", line 67, in handle
if not settings.DEBUG and not settings.ALLOWED_HOSTS:
File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\conf_init
.py", line 79, in getattr
self.setup(name)
File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\conf_init
.py", line 66, in setup
self.wrapped = Settings(settings_module)
File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\conf_init
.py", line 157, in init
mod = importlib.import_module(self.SETTINGS_MODULE)
File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\importlib_init
.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1006, in _gcd_import
File "", line 983, in _find_and_load
File "", line 967, in _find_and_load_unlocked
File "", line 677, in _load_unlocked
File "", line 728, in exec_module
File "", line 219, in call_with_frames_removed
File "C:\Users\pc\Downloads\django-ecommerce-master\django-ecommerce-master\djecommerce\settings\development.py", line 1, in
from .base import *
File "C:\Users\pc\Downloads\django-ecommerce-master\django-ecommerce-master\djecommerce\settings\base.py", line 2, in
from decouple import config
ImportError: cannot import name 'config' from 'decouple' (C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\decouple_init
.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "manage.py", line 15, in
execute_from_command_line(sys.argv)
File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management_init_.py", line 381, in execute_from_command_line
utility.execute()
File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management_init_.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\base.py", line 336, in run_from_argv
connections.close_all()
File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\utils.py", line 219, in close_all
for alias in self:
File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\utils.py", line 213, in iter
return iter(self.databases)
File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\utils\functional.py", line 80, in get
res = instance.dict[self.name] = self.func(instance)
File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\utils.py", line 147, in databases
self.databases = settings.DATABASES
File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\conf_init
.py", line 79, in getattr
self.setup(name)
File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\conf_init
.py", line 66, in setup
self.wrapped = Settings(settings_module)
File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\conf_init
.py", line 157, in init
mod = importlib.import_module(self.SETTINGS_MODULE)
File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\importlib_init
.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1006, in _gcd_import
File "", line 983, in _find_and_load
File "", line 967, in _find_and_load_unlocked
File "", line 677, in load_unlocked
File "", line 728, in exec_module
File "", line 219, in call_with_frames_removed
File "C:\Users\pc\Downloads\django-ecommerce-master\django-ecommerce-master\djecommerce\settings\development.py", line 1, in
from .base import *
File "C:\Users\pc\Downloads\django-ecommerce-master\django-ecommerce-master\djecommerce\settings\base.py", line 2, in
from decouple import config
ImportError: cannot import name 'config' from 'decouple' (C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\decouple_init
.py)
`

Change Price Model Suggestion

Hi Matt,

Think it would make sense to change the model for the pricing elements to DecimalField, the use of Float messes up with the calculations of the discounts.

I have changed core/models.py for the time being to:

price = models.DecimalField(max_digits=5,decimal_places=2)
discount_price = models.DecimalField(max_digits=5,decimal_places=2)

Works much better from a currency / pricing perspective.

Tilly.

signup error

ConnectionRefusedError at /accounts/signup/ when user try to signup

ConnectionRefusedError: [Errno 111] Connection refused
[22/Aug/2019 18:19:02] "POST /accounts/signup/ HTTP/1.1" 500 192460

Add to cart

'ManyToManyDescriptor' object has no attribute 'filter'

def add_to_cart(request, slug):
Book = get_object_or_404(book, slug=slug)
order_book = orderbook.objects.create(Book=Book)
order_qs = Order.objects.filter(user=request.user, ordered=False)
if order_qs.exists():
order = order_qs[0]
if Order.books.filter(book_slug=book.slug).exists():
order_book.quantity += 1
order_book.save()
else:
ordered_date = timezone.now()
order = Order.objects.create(
user=request.user, ordered_date=ordered_date)
order.books.add(order_book)
return redirect("core:book", slug=slug)

Item stock not defined in the Item model

We never defined an item_stock field to the Item model. Since Order has a quantity field, to store how many unit of that item we want. But we never defined that in the Item model. I tried adding the item stock field, but the issue here is, I am not able to decrease the quantity of that item stock after an order is placed. Please help

search bar

guys the search bar isnt working how can i solve this issue??

revert

can you please revert back to the original code. You have attached your commerce site. or a separate branch would be good.

launching a django project from with help of visual studio

Hi,

Thanks for codes and videos.

I have a question about launching a project from a github on my computer.

I downloaded this project. Using Visual Studio, first created a new project from existing code, then added the environment (according to the requirements file). But when I start the server, such an error is issued.
django

Could you please advise what I'm doing wrong.

invalid parameters message with payment/stripe after submitting with card details

my views.py has
from django.conf import settings
from django.contrib import messages
from django.core.exceptions import ObjectDoesNotExist
from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import LoginRequiredMixin
from django.shortcuts import render, get_object_or_404
from django.views.generic import ListView, DetailView, View
from django.shortcuts import redirect
from django.utils import timezone
from .forms import CheckoutForm, CouponForm, RefundForm, PaymentForm
from .models import Item, OrderItem, Order, Address, Payment, Coupon, Refund, UserProfile

import random
import string
import stripe
stripe.api_key = settings.STRIPE_SECRET_KEY

def create_ref_code():
return ''.join(random.choices(string.ascii_lowercase + string.digits, k=20))

def products(request):
context = {
'items': Item.objects.all()
}
return render(request, "products.html", context)

def is_valid_form(values):
valid = True
for field in values:
if field == '':
valid = False
return valid

class CheckoutView(View):
def get(self, *args, **kwargs):
try:
order = Order.objects.get(user=self.request.user, ordered=False)
form = CheckoutForm()
context = {
'form': form,
'couponform': CouponForm(),
'order': order,
'DISPLAY_COUPON_FORM': True
}

        shipping_address_qs = Address.objects.filter(
            user=self.request.user,
            address_type='S',
            default=True
        )
        if shipping_address_qs.exists():
            context.update(
                {'default_shipping_address': shipping_address_qs[0]})

        billing_address_qs = Address.objects.filter(
            user=self.request.user,
            address_type='B',
            default=True
        )
        if billing_address_qs.exists():
            context.update(
                {'default_billing_address': billing_address_qs[0]})

        return render(self.request, "checkout.html", context)
    except ObjectDoesNotExist:
        messages.info(self.request, "You do not have an active order")
        return redirect("core:checkout")

def post(self, *args, **kwargs):
    form = CheckoutForm(self.request.POST or None)
    try:
        order = Order.objects.get(user=self.request.user, ordered=False)
        if form.is_valid():

            use_default_shipping = form.cleaned_data.get(
                'use_default_shipping')
            if use_default_shipping:
                print("Using the defualt shipping address")
                address_qs = Address.objects.filter(
                    user=self.request.user,
                    address_type='S',
                    default=True
                )
                if address_qs.exists():
                    shipping_address = address_qs[0]
                    order.shipping_address = shipping_address
                    order.save()
                else:
                    messages.info(
                        self.request, "No default shipping address available")
                    return redirect('core:checkout')
            else:
                print("User is entering a new shipping address")
                shipping_address1 = form.cleaned_data.get(
                    'shipping_address')
                shipping_address2 = form.cleaned_data.get(
                    'shipping_address2')
                shipping_country = form.cleaned_data.get(
                    'shipping_country')
                shipping_zip = form.cleaned_data.get('shipping_zip')

                if is_valid_form([shipping_address1, shipping_country, shipping_zip]):
                    shipping_address = Address(
                        user=self.request.user,
                        street_address=shipping_address1,
                        apartment_address=shipping_address2,
                        country=shipping_country,
                        zip=shipping_zip,
                        address_type='S'
                    )
                    shipping_address.save()

                    order.shipping_address = shipping_address
                    order.save()

                    set_default_shipping = form.cleaned_data.get(
                        'set_default_shipping')
                    if set_default_shipping:
                        shipping_address.default = True
                        shipping_address.save()

                else:
                    messages.info(
                        self.request, "Please fill in the required shipping address fields")

            use_default_billing = form.cleaned_data.get(
                'use_default_billing')
            same_billing_address = form.cleaned_data.get(
                'same_billing_address')

            if same_billing_address:
                billing_address = shipping_address
                billing_address.pk = None
                billing_address.save()
                billing_address.address_type = 'B'
                billing_address.save()
                order.billing_address = billing_address
                order.save()

            elif use_default_billing:
                print("Using the defualt billing address")
                address_qs = Address.objects.filter(
                    user=self.request.user,
                    address_type='B',
                    default=True
                )
                if address_qs.exists():
                    billing_address = address_qs[0]
                    order.billing_address = billing_address
                    order.save()
                else:
                    messages.info(
                        self.request, "No default billing address available")
                    return redirect('core:checkout')
            else:
                print("User is entering a new billing address")
                billing_address1 = form.cleaned_data.get(
                    'billing_address')
                billing_address2 = form.cleaned_data.get(
                    'billing_address2')
                billing_country = form.cleaned_data.get(
                    'billing_country')
                billing_zip = form.cleaned_data.get('billing_zip')

                if is_valid_form([billing_address1, billing_country, billing_zip]):
                    billing_address = Address(
                        user=self.request.user,
                        street_address=billing_address1,
                        apartment_address=billing_address2,
                        country=billing_country,
                        zip=billing_zip,
                        address_type='B'
                    )
                    billing_address.save()

                    order.billing_address = billing_address
                    order.save()

                    set_default_billing = form.cleaned_data.get(
                        'set_default_billing')
                    if set_default_billing:
                        billing_address.default = True
                        billing_address.save()

                else:
                    messages.info(
                        self.request, "Please fill in the required billing address fields")

            payment_option = form.cleaned_data.get('payment_option')

            if payment_option == 'S':
                return redirect('core:payment', payment_option='stripe')
            elif payment_option == 'P':
                return redirect('core:payment', payment_option='paypal')
            else:
                messages.warning(
                    self.request, "Invalid payment option selected")
                return redirect('core:checkout')
    except ObjectDoesNotExist:
        messages.warning(self.request, "You do not have an active order")
        return redirect("core:order-summary")

class PaymentView(View):
def get(self, *args, **kwargs):
order = Order.objects.get(user=self.request.user, ordered=False)
if order.billing_address:
context = {
'order': order,
'DISPLAY_COUPON_FORM': False
}
userprofile = self.request.user.userprofile
if userprofile.one_click_purchasing:
# fetch the users card list
cards = stripe.Customer.list_sources(
userprofile.stripe_customer_id,
limit=3,
object='card'
)
card_list = cards['data']
if len(card_list) > 0:
# update the context with the default card
context.update({
'card': card_list[0]
})
return render(self.request, "payment.html", context)
else:
messages.warning(self.request, "You have not added a billing address")
return redirect("core:checkout")

def post(self, *args, **kwargs):
    order = Order.objects.get(user=self.request.user, ordered=False)
    form = PaymentForm(self.request.POST)
    userprofile = UserProfile.objects.get(user=self.request.user)
    if form.is_valid():
        token = form.cleaned_data.get('stripeToken')
        save = form.cleaned_data.get('save')
        use_default = form.cleaned_data.get('use_default')

        if save:
            if not userprofile.stripe_customer_id:
                customer = stripe.Customer.create(
                    email=  self.request.user.email,
                    source=token
                )
                userprofile.stripe_customer_id = customer['id']
                userprofile.one_click_purchasing = True
                userprofile.save()
            else:
                stripe.Customer.create_source(
                    userprofile.stripe_customer_id,
                    source=token
                )
                # customer.sources.create(source=token)
                # userprofile.stripe_customer_id = customer['id']
                # userprofile.one_click_purchasing = True
                # userprofile.save()

        amount = int(order.get_total() * 100)

        try:
            if use_default:
                 # charge the customer because we cannot charge the token more than once
                charge = stripe.Charge.create(
                    amount=amount,  # cents
                    currency="inr",
                    customer=userprofile.stripe_customer_id
                )
            else:
                # charge once off on the token
                charge = stripe.Charge.create(
                    amount=amount,  # cents
                    currency="inr",
                    source=token
                )

            # create the payment
            payment = Payment()
            payment.stripe_charge_id = charge['id']
            payment.user = self.request.user
            payment.amount = order.get_total()
            payment.save()

            # assign the payment to the order

            order_items = order.items.all()
            order_items.update(ordered=True)
            for item in order_items:
                item.save()

            order.ordered = True
            order.payment = payment
            order.ref_code = create_ref_code()
            order.save()

            messages.success(self.request, "Your order was successful!")
            return redirect("/")

        except stripe.error.CardError as e:
            body = e.json_body
            err = body.get('error', {})
            messages.warning(self.request, f"{err.get('message')}")
            return redirect("/")

        except stripe.error.RateLimitError as e:
            # Too many requests made to the API too quickly
            messages.warning(self.request, "Rate limit error")
            return redirect("/")

        except stripe.error.InvalidRequestError as e:
            # Invalid parameters were supplied to Stripe's API
            print(e)
            messages.warning(self.request, "Invalid parameters")
            return redirect("/")

        except stripe.error.AuthenticationError as e:
            # Authentication with Stripe's API failed
            # (maybe you changed API keys recently)
            messages.warning(self.request, "Not authenticated")
            return redirect("/")

        except stripe.error.APIConnectionError as e:
            # Network communication with Stripe failed
            messages.warning(self.request, "Network error")
            return redirect("/")

        except stripe.error.StripeError as e:
            # Display a very generic error to the user, and maybe send
            # yourself an email
            messages.warning(
                self.request, "Something went wrong. You were not charged. Please try again.")
            return redirect("/")

        except Exception as e:
            # send an email to ourselves
            messages.warning(
                self.request, "A serious error occurred. We have been notifed.")
            return redirect("/")

    messages.warning(self.request, "Invalid data received")
    return redirect("/payment/stripe/")

class HomeView(ListView):
model = Item
paginate_by = 1
template_name = "home.html"

class OrderSummaryView(LoginRequiredMixin, View):
def get(self, *args, **kwargs):
try:
order = Order.objects.get(user=self.request.user, ordered=False)
context = {
'object': order
}
return render(self.request, 'order_summary.html', context)
except ObjectDoesNotExist:
messages.warning(self.request, "You do not have an active order")
return redirect("/")

class ItemDetailView(DetailView):
model = Item
template_name = "product.html"

@login_required
def add_to_cart(request, slug):
item = get_object_or_404(Item, slug=slug)
order_item, created = OrderItem.objects.get_or_create(
item=item,
user=request.user,
ordered=False
)
order_qs = Order.objects.filter(user=request.user, ordered=False)
if order_qs.exists():
order = order_qs[0]
# check if the order item is in the order
if order.items.filter(item__slug=item.slug).exists():
order_item.quantity += 1
order_item.save()
messages.info(request, "This item quantity was updated.")
return redirect("core:order-summary")
else:
order.items.add(order_item)
messages.info(request, "This item was added to your cart.")
return redirect("core:order-summary")
else:
ordered_date = timezone.now()
order = Order.objects.create(
user=request.user, ordered_date=ordered_date)
order.items.add(order_item)
messages.info(request, "This item was added to your cart.")
return redirect("core:order-summary")

@login_required
def remove_from_cart(request, slug):
item = get_object_or_404(Item, slug=slug)
order_qs = Order.objects.filter(
user=request.user,
ordered=False
)
if order_qs.exists():
order = order_qs[0]
# check if the order item is in the order
if order.items.filter(item__slug=item.slug).exists():
order_item = OrderItem.objects.filter(
item=item,
user=request.user,
ordered=False
)[0]
order.items.remove(order_item)
order_item.delete()
messages.info(request, "This item was removed from your cart.")
return redirect("core:order-summary")
else:
messages.info(request, "This item was not in your cart")
return redirect("core:product", slug=slug)
else:
messages.info(request, "You do not have an active order")
return redirect("core:product", slug=slug)

@login_required
def remove_single_item_from_cart(request, slug):
item = get_object_or_404(Item, slug=slug)
order_qs = Order.objects.filter(
user=request.user,
ordered=False
)
if order_qs.exists():
order = order_qs[0]
# check if the order item is in the order
if order.items.filter(item__slug=item.slug).exists():
order_item = OrderItem.objects.filter(
item=item,
user=request.user,
ordered=False
)[0]
if order_item.quantity > 1:
order_item.quantity -= 1
order_item.save()
else:
order.items.remove(order_item)
messages.info(request, "This item quantity was updated.")
return redirect("core:order-summary")
else:
messages.info(request, "This item was not in your cart")
return redirect("core:product", slug=slug)
else:
messages.info(request, "You do not have an active order")
return redirect("core:product", slug=slug)

def get_coupon(request, code):
try:
coupon = Coupon.objects.get(code=code)
return coupon
except ObjectDoesNotExist:
messages.info(request, "This coupon does not exist")
return redirect("core:checkout")

class AddCouponView(View):
def post(self, *args, **kwargs):
form = CouponForm(self.request.POST or None)
if form.is_valid():
try:
code = form.cleaned_data.get('code')
order = Order.objects.get(
user=self.request.user, ordered=False)
order.coupon = get_coupon(self.request, code)
order.save()
messages.success(self.request, "Successfully added coupon")
return redirect("core:checkout")
except ObjectDoesNotExist:
messages.info(self.request, "You do not have an active order")
return redirect("core:checkout")

class RefundRequestView(View):
def get(self, *args, **kwargs):
form = RefundForm()
context = {
'form': form
}
return render(self.request, "request_refund.html", context)

def post(self, *args, **kwargs):
    form = RefundForm(self.request.POST)
    if form.is_valid():
        ref_code = form.cleaned_data.get('ref_code')
        message = form.cleaned_data.get('message')
        email = form.cleaned_data.get('email')
        # edit the order
        try:
            order = Order.objects.get(ref_code=ref_code)
            order.refund_requested = True
            order.save()

            # store the refund
            refund = Refund()
            refund.order = order
            refund.reason = message
            refund.email = email
            refund.save()

            messages.info(self.request, "Your request was received.")
            return redirect("core:request-refund")

        except ObjectDoesNotExist:
            messages.info(self.request, "This order does not exist.")
            return redirect("core:request-refund")

and payment.html is...
{% extends "base.html" %}

{% block extra_head %}

<style> #stripeBtnLabel { font-family: "Helvetica Neue", Helvetica, sans-serif; font-size: 16px; font-variant: normal; padding: 0; margin: 0; -webkit-font-smoothing: antialiased; font-weight: 500; display: block; } #stripeBtn { border: none; border-radius: 4px; outline: none; text-decoration: none; color: #fff; background: #32325d; white-space: nowrap; display: inline-block; height: 40px; line-height: 40px; box-shadow: 0 4px 6px rgba(50, 50, 93, .11), 0 1px 3px rgba(0, 0, 0, .08); border-radius: 4px; font-size: 15px; font-weight: 600; letter-spacing: 0.025em; text-decoration: none; -webkit-transition: all 150ms ease; transition: all 150ms ease; float: left; width: 100% } button:hover { transform: translateY(-1px); box-shadow: 0 7px 14px rgba(50, 50, 93, .10), 0 3px 6px rgba(0, 0, 0, .08); background-color: #43458b; } .stripe-form { padding: 5px 30px; } #card-errors { height: 20px; padding: 4px 0; color: #fa755a; } .stripe-form-row { width: 100%; float: left; margin-top: 5px; margin-bottom: 5px; } /** * The CSS shown here will not be introduced in the Quickstart guide, but shows * how you can use CSS to style your Element's container. */ .StripeElement { box-sizing: border-box; height: 40px; padding: 10px 12px; border: 1px solid transparent; border-radius: 4px; background-color: white; box-shadow: 0 1px 3px 0 #e6ebf1; -webkit-transition: box-shadow 150ms ease; transition: box-shadow 150ms ease; } .StripeElement--focus { box-shadow: 0 1px 3px 0 #cfd7df; } .StripeElement--invalid { border-color: #fa755a; } .StripeElement--webkit-autofill { background-color: #fefde5 !important; } .current-card-form { display: none; } </style>

{% endblock extra_head %}

{% block content %}

    <h2 class="my-5 h2 text-center">Payment</h2>

    <div class="row">

        <div class="col-md-12 mb-4">
            <div class="card">

                <script src="https://js.stripe.com/v3/"></script>
                {% if card %}
                <div style="padding: 5px 30px;">
                    <div class="custom-control custom-checkbox">
                        <input type="checkbox" class="custom-control-input" name="save" id="use_default_card">
                        <label class="custom-control-label" for="use_default_card">Use default card:
                            **** **** **** {{ card.last4 }}
                            <span>Exp: {{ card.exp_month }}/{{ card.exp_year }}</span></label>
                    </div>
                </div>
                {% endif %}

                <div class="current-card-form">
                    <form action="." method="post" class="stripe-form">
                        {% csrf_token %}
                        <input type="hidden" name="use_default" value="true">
                        <div class="stripe-form-row">
                            <button id="stripeBtn">Submit Payment</button>
                        </div>
                        <div id="card-errors" role="alert"></div>
                    </form>
                </div>

                <div class="new-card-form">
                    <form action="." method="post" class="stripe-form" id="stripe-form">
                        {% csrf_token %}
                        <div class="stripe-form-row" id="creditCard">
                            <label for="card-element" id="stripeBtnLabel">
                                Credit or debit card
                            </label>
                            <div id="card-element" class="StripeElement StripeElement--empty">
                                <div class="__PrivateStripeElement"
                                    style="margin: 0px !important; padding: 0px !important; border: none !important; display: block !important; background: transparent !important; position: relative !important; opacity: 1 !important;">
                                    <iframe frameborder="0" allowtransparency="true" scrolling="no"
                                        name="__privateStripeFrame5" allowpaymentrequest="true"
                                        src="https://js.stripe.com/v3/elements-inner-card-19066928f2ed1ba3ffada645e45f5b50.html#style[base][color]=%2332325d&amp;style[base][fontFamily]=%22Helvetica+Neue%22%2C+Helvetica%2C+sans-serif&amp;style[base][fontSmoothing]=antialiased&amp;style[base][fontSize]=16px&amp;style[base][::placeholder][color]=%23aab7c4&amp;style[invalid][color]=%23fa755a&amp;style[invalid][iconColor]=%23fa755a&amp;componentName=card&amp;wait=false&amp;rtl=false&amp;keyMode=test&amp;origin=https%3A%2F%2Fstripe.com&amp;referrer=https%3A%2F%2Fstripe.com%2Fdocs%2Fstripe-js&amp;controllerId=__privateStripeController1"
                                        title="Secure payment input frame"
                                        style="border: none !important; margin: 0px !important; padding: 0px !important; width: 1px !important; min-width: 100% !important; overflow: hidden !important; display: block !important; height: 19.2px;"></iframe><input
                                        class="__PrivateStripeElement-input" aria-hidden="true" aria-label=" "
                                        autocomplete="false" maxlength="1"
                                        style="border: none !important; display: block !important; position: absolute !important; height: 1px !important; top: 0px !important; left: 0px !important; padding: 0px !important; margin: 0px !important; width: 100% !important; opacity: 0 !important; background: transparent !important; pointer-events: none !important; font-size: 16px !important;">
                                </div>
                            </div>
                        </div>
                        <div class="stripe-form-row">
                            <button id="stripeBtn">Submit Payment</button>
                        </div>
                        <div class="stripe-form-row">
                            <div class="custom-control custom-checkbox">
                                <input type="checkbox" class="custom-control-input" name="save" id="save_card_info">
                                <label class="custom-control-label" for="save_card_info">Save for future
                                    purchases</label>
                            </div>
                        </div>
                        <div id="card-errors" role="alert"></div>
                    </form>
                </div>

            </div>
        </div>

        {% include "order_snippet.html" %}

    </div>

</div>

{% endblock content %}

{% block extra_scripts %}

<script nonce=""> // Create a Stripe client. var stripe = Stripe(''); // Create an instance of Elements. var elements = stripe.elements(); // Custom styling can be passed to options when creating an Element. // (Note that this demo uses a wider set of styles than the guide below.) var style = { base: { color: '#32325d', fontFamily: '"Helvetica Neue", Helvetica, sans-serif', fontSmoothing: 'antialiased', fontSize: '16px', '::placeholder': { color: '#aab7c4' } }, invalid: { color: '#fa755a', iconColor: '#fa755a' } }; // Create an instance of the card Element. var card = elements.create('card', { style: style }); // Add an instance of the card Element into the `card-element`
. card.mount('#card-element'); // Handle real-time validation errors from the card Element. card.addEventListener('change', function (event) { var displayError = document.getElementById('card-errors'); if (event.error) { displayError.textContent = event.error.message; } else { displayError.textContent = ''; } }); // Handle form submission. var form = document.getElementById('stripe-form'); form.addEventListener('submit', function (event) { event.preventDefault(); stripe.createToken(card).then(function (result) { if (result.error) { // Inform the user if there was an error. var errorElement = document.getElementById('card-errors'); errorElement.textContent = result.error.message; } else { // Send the token to your server. stripeTokenHandler(result.token); } }); }); // Submit the form with the token ID. function stripeTokenHandler(token) { // Insert the token ID into the form so it gets submitted to the server var form = document.getElementById('stripe-form'); var hiddenInput = document.createElement('input'); hiddenInput.setAttribute('type', 'hidden'); hiddenInput.setAttribute('name', 'stripeToken'); hiddenInput.setAttribute('value', token.id); form.appendChild(hiddenInput); // Submit the form form.submit(); } var currentCardForm = $('.current-card-form'); var newCardForm = $('.new-card-form'); var use_default_card = document.querySelector("input[name=save]"); use_default_card.addEventListener('change', function () { if (this.checked) { newCardForm.hide(); currentCardForm.show() } else { newCardForm.show(); currentCardForm.hide() } }) </script>

{% endblock extra_scripts %}

On clicking signup button

No connection could be made because the target machine actively refused it
What we can do to remove this error i am trying to run on local server

manage.py rename function will not rename

The function rename is hardcoded to the project folder name 'demo', however, in this case, it is named 'djecommerce'. I solved this by changing the function to use 'djecommerce' instead of 'demo' so I would initially be able to change the name of the project. However, in the future renaming would require the function to be edited again to whatever the current project name is.

admin orders

in the admin panel when i click the orders it says AttributeError at /admin/core/order/24/change/
'NoneType' object has no attribute 'username' any solution??

ModuleNotFoundError: No module named 'decouple'

When I tried to run server with command:

python manage.py runserver

a big error log comes this isthe last part of that error log:

res = instance.__dict__[self.name] = self.func(instance)

File "C:\Users\kirti\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\utils.py", line 153, in databases
self.databases = settings.DATABASES
File "C:\Users\kirti\AppData\Local\Programs\Python\Python39\lib\site-packages\django\conf_init
.py", line 82, in getattr
self.setup(name)
File "C:\Users\kirti\AppData\Local\Programs\Python\Python39\lib\site-packages\django\conf_init
.py", line 69, in setup
self.wrapped = Settings(settings_module)
File "C:\Users\kirti\AppData\Local\Programs\Python\Python39\lib\site-packages\django\conf_init
.py", line 170, in init
mod = importlib.import_module(self.SETTINGS_MODULE)
File "C:\Users\kirti\AppData\Local\Programs\Python\Python39\lib\importlib_init
.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked

H:\study material\Web development\React\ecom\django-ecommerce>python manage.py runserver
Traceback (most recent call last):
File "C:\Users\kirti\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\base.py", line 330, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\kirti\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\commands\runserver.py", line 61, in execute
super().execute(*args, **options)
File "C:\Users\kirti\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\base.py", line 371, in execute
output = self.handle(*args, **options)
File "C:\Users\kirti\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\commands\runserver.py", line 68, in handle
if not settings.DEBUG and not settings.ALLOWED_HOSTS:
File "C:\Users\kirti\AppData\Local\Programs\Python\Python39\lib\site-packages\django\conf_init_.py", line 82, in getattr
self.setup(name)
File "C:\Users\kirti\AppData\Local\Programs\Python\Python39\lib\site-packages\django\conf_init
.py", line 69, in setup
self.wrapped = Settings(settings_module)
File "C:\Users\kirti\AppData\Local\Programs\Python\Python39\lib\site-packages\django\conf_init
.py", line 170, in init
mod = importlib.import_module(self.SETTINGS_MODULE)
File "C:\Users\kirti\AppData\Local\Programs\Python\Python39\lib\importlib_init
.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 790, in exec_module
File "", line 228, in _call_with_frames_removed
File "H:\study material\Web development\React\ecom\django-ecommerce\djecommerce\settings\development.py", line 1, in
from .base import *
File "H:\study material\Web development\React\ecom\django-ecommerce\djecommerce\settings\base.py", line 2, in
from decouple import config
ModuleNotFoundError: No module named 'decouple'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "H:\study material\Web development\React\ecom\django-ecommerce\manage.py", line 15, in
execute_from_command_line(sys.argv)
File "C:\Users\kirti\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management_init_.py", line
401, in execute_from_command_line
utility.execute()
File "C:\Users\kirti\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management_init_.py", line
395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\kirti\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\base.py", line 343, in run_from_argv
connections.close_all()
File "C:\Users\kirti\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\utils.py", line 232, in close_all
for alias in self:
File "C:\Users\kirti\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\utils.py", line 226, in iter
return iter(self.databases)
File "C:\Users\kirti\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\functional.py", line 48, in get
res = instance.dict[self.name] = self.func(instance)
File "C:\Users\kirti\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\utils.py", line 153, in databases
self.databases = settings.DATABASES
File "C:\Users\kirti\AppData\Local\Programs\Python\Python39\lib\site-packages\django\conf_init
.py", line 82, in getattr
self.setup(name)
File "C:\Users\kirti\AppData\Local\Programs\Python\Python39\lib\site-packages\django\conf_init
.py", line 69, in setup
self.wrapped = Settings(settings_module)
File "C:\Users\kirti\AppData\Local\Programs\Python\Python39\lib\site-packages\django\conf_init
.py", line 170, in init
mod = importlib.import_module(self.SETTINGS_MODULE)
File "C:\Users\kirti\AppData\Local\Programs\Python\Python39\lib\importlib_init
.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 790, in exec_module
File "", line 228, in _call_with_frames_removed
File "H:\study material\Web development\React\ecom\django-ecommerce\djecommerce\settings\development.py", line 1, in
from .base import *
File "H:\study material\Web development\React\ecom\django-ecommerce\djecommerce\settings\base.py", line 2, in
from decouple import config
ModuleNotFoundError: No module named 'decouple'

Got Connection refuse error on sign up page

Environment:

Request Method: POST
Request URL: http://127.0.0.1:8000/accounts/signup/

Django Version: 2.2.14
Python Version: 3.7.6
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'allauth',
'allauth.account',
'allauth.socialaccount',
'crispy_forms',
'django_countries',
'core',
'debug_toolbar']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'debug_toolbar.middleware.DebugToolbarMiddleware']

Traceback:

File "/opt/anaconda3/lib/python3.7/site-packages/django/core/handlers/exception.py" in inner
34. response = get_response(request)

File "/opt/anaconda3/lib/python3.7/site-packages/django/core/handlers/base.py" in _get_response
115. response = self.process_exception_by_middleware(e, request)

File "/opt/anaconda3/lib/python3.7/site-packages/django/core/handlers/base.py" in _get_response
113. response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/opt/anaconda3/lib/python3.7/site-packages/django/views/generic/base.py" in view
71. return self.dispatch(request, *args, **kwargs)

File "/opt/anaconda3/lib/python3.7/site-packages/django/utils/decorators.py" in _wrapper
45. return bound_method(*args, **kwargs)

File "/opt/anaconda3/lib/python3.7/site-packages/django/views/decorators/debug.py" in sensitive_post_parameters_wrapper
76. return view(request, *args, **kwargs)

File "/opt/anaconda3/lib/python3.7/site-packages/allauth/account/views.py" in dispatch
214. return super(SignupView, self).dispatch(request, *args, **kwargs)

File "/opt/anaconda3/lib/python3.7/site-packages/allauth/account/views.py" in dispatch
80. **kwargs)

File "/opt/anaconda3/lib/python3.7/site-packages/allauth/account/views.py" in dispatch
192. **kwargs)

File "/opt/anaconda3/lib/python3.7/site-packages/django/views/generic/base.py" in dispatch
97. return handler(request, *args, **kwargs)

File "/opt/anaconda3/lib/python3.7/site-packages/allauth/account/views.py" in post
103. response = self.form_valid(form)

File "/opt/anaconda3/lib/python3.7/site-packages/allauth/account/views.py" in form_valid
235. self.get_success_url())

File "/opt/anaconda3/lib/python3.7/site-packages/allauth/account/utils.py" in complete_signup
183. signal_kwargs=signal_kwargs)

File "/opt/anaconda3/lib/python3.7/site-packages/allauth/account/utils.py" in perform_login
143. send_email_confirmation(request, user, signup=signup)

File "/opt/anaconda3/lib/python3.7/site-packages/allauth/account/utils.py" in send_email_confirmation
314. signup=signup)

File "/opt/anaconda3/lib/python3.7/site-packages/allauth/account/models.py" in send_confirmation
60. confirmation.send(request, signup=signup)

File "/opt/anaconda3/lib/python3.7/site-packages/allauth/account/models.py" in send
166. get_adapter(request).send_confirmation_mail(request, self, signup)

File "/opt/anaconda3/lib/python3.7/site-packages/allauth/account/adapter.py" in send_confirmation_mail
450. ctx)

File "/opt/anaconda3/lib/python3.7/site-packages/allauth/account/adapter.py" in send_mail
137. msg.send()

File "/opt/anaconda3/lib/python3.7/site-packages/django/core/mail/message.py" in send
291. return self.get_connection(fail_silently).send_messages([self])

File "/opt/anaconda3/lib/python3.7/site-packages/django/core/mail/backends/smtp.py" in send_messages
103. new_conn_created = self.open()

File "/opt/anaconda3/lib/python3.7/site-packages/django/core/mail/backends/smtp.py" in open
63. self.connection = self.connection_class(self.host, self.port, **connection_params)

File "/opt/anaconda3/lib/python3.7/smtplib.py" in init
251. (code, msg) = self.connect(host, port)

File "/opt/anaconda3/lib/python3.7/smtplib.py" in connect
336. self.sock = self._get_socket(host, port, self.timeout)

File "/opt/anaconda3/lib/python3.7/smtplib.py" in _get_socket
307. self.source_address)

File "/opt/anaconda3/lib/python3.7/socket.py" in create_connection
728. raise err

File "/opt/anaconda3/lib/python3.7/socket.py" in create_connection
716. sock.connect(sa)

Exception Type: ConnectionRefusedError at /accounts/signup/
Exception Value: [Errno 61] Connection refused

Pillow 6.2.2

Collecting Pillow==6.2.2
Using cached Pillow-6.2.2.tar.gz (37.8 MB)
Using legacy 'setup.py install' for Pillow, since package 'wheel' is not installed.
Installing collected packages: Pillow
Running setup.py install for Pillow: started
Running setup.py install for Pillow: finished with status 'error'

ERROR: Command errored out with exit status 1:
 command: 'C:\Users\Nasser\PycharmProjects\Ecostore\ecostore\Scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Nasser\\AppData\\Local\\Temp\\pip-install-2jlsjfqz\\pillow_49ef0c2dcdc64cccb04edbfc6de127f8\\setup.py'"'"'; __file__='"'"'C:\\Users\\Nasser\\AppData\\Local\\Temp\\pip-install-2jlsjfqz\\pillow_49ef0c2dcdc64cccb04edbfc6de127f8\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Nasser\AppData\Local\Temp\pip-record-7lludxy7\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\Nasser\PycharmProjects\Ecostore\ecostore\include\site\python3.9\Pillow'
     cwd: C:\Users\Nasser\AppData\Local\Temp\pip-install-2jlsjfqz\pillow_49ef0c2dcdc64cccb04edbfc6de127f8\
Complete output (179 lines):
C:\Users\Nasser\AppData\Local\Temp\pip-install-2jlsjfqz\pillow_49ef0c2dcdc64cccb04edbfc6de127f8\setup.py:28: RuntimeWarning: Pillow does not yet support Python 3.9 and does not yet provide prebuilt Windows binaries. We do not recommend building from source on Windows.
  warnings.warn(
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.9
creating build\lib.win-amd64-3.9\PIL
copying src\PIL\BdfFontFile.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\BlpImagePlugin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\BmpImagePlugin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\BufrStubImagePlugin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\ContainerIO.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\CurImagePlugin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\DcxImagePlugin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\DdsImagePlugin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\EpsImagePlugin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\ExifTags.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\features.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\FitsStubImagePlugin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\FliImagePlugin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\FontFile.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\FpxImagePlugin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\FtexImagePlugin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\GbrImagePlugin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\GdImageFile.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\GifImagePlugin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\GimpGradientFile.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\GimpPaletteFile.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\GribStubImagePlugin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\Hdf5StubImagePlugin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\IcnsImagePlugin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\IcoImagePlugin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\Image.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\ImageChops.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\ImageCms.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\ImageColor.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\ImageDraw.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\ImageDraw2.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\ImageEnhance.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\ImageFile.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\ImageFilter.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\ImageFont.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\ImageGrab.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\ImageMath.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\ImageMode.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\ImageMorph.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\ImageOps.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\ImagePalette.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\ImagePath.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\ImageQt.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\ImageSequence.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\ImageShow.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\ImageStat.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\ImageTk.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\ImageTransform.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\ImageWin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\ImImagePlugin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\ImtImagePlugin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\IptcImagePlugin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\Jpeg2KImagePlugin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\JpegImagePlugin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\JpegPresets.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\McIdasImagePlugin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\MicImagePlugin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\MpegImagePlugin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\MpoImagePlugin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\MspImagePlugin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\PaletteFile.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\PalmImagePlugin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\PcdImagePlugin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\PcfFontFile.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\PcxImagePlugin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\PdfImagePlugin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\PdfParser.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\PixarImagePlugin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\PngImagePlugin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\PpmImagePlugin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\PsdImagePlugin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\PSDraw.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\PyAccess.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\SgiImagePlugin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\SpiderImagePlugin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\SunImagePlugin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\TarIO.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\TgaImagePlugin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\TiffImagePlugin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\TiffTags.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\WalImageFile.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\WebPImagePlugin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\WmfImagePlugin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\XbmImagePlugin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\XpmImagePlugin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\XVThumbImagePlugin.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\_binary.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\_tkinter_finder.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\_util.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\_version.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\__init__.py -> build\lib.win-amd64-3.9\PIL
copying src\PIL\__main__.py -> build\lib.win-amd64-3.9\PIL
running egg_info
writing src\Pillow.egg-info\PKG-INFO
writing dependency_links to src\Pillow.egg-info\dependency_links.txt
writing top-level names to src\Pillow.egg-info\top_level.txt
reading manifest file 'src\Pillow.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.c'
warning: no files found matching '*.h'
warning: no files found matching '*.sh'
warning: no previously-included files found matching '.appveyor.yml'
warning: no previously-included files found matching '.coveragerc'
warning: no previously-included files found matching '.codecov.yml'
warning: no previously-included files found matching '.editorconfig'
warning: no previously-included files found matching '.readthedocs.yml'
warning: no previously-included files found matching 'azure-pipelines.yml'
warning: no previously-included files matching '.git*' found anywhere in distribution
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '*.so' found anywhere in distribution
no previously-included directories found matching '.azure-pipelines'
no previously-included directories found matching '.travis'
adding license file 'LICENSE'
writing manifest file 'src\Pillow.egg-info\SOURCES.txt'
warning: build_py: byte-compiling is disabled, skipping.

running build_ext


The headers or library files could not be found for zlib,
a required dependency when compiling Pillow from source.

Please see the install instructions at:
   https://pillow.readthedocs.io/en/latest/installation.html

Traceback (most recent call last):
  File "C:\Users\Nasser\AppData\Local\Temp\pip-install-2jlsjfqz\pillow_49ef0c2dcdc64cccb04edbfc6de127f8\setup.py", line 852, in <module>
    setup(
  File "C:\Users\Nasser\PycharmProjects\Ecostore\ecostore\lib\site-packages\setuptools\__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "C:\Users\Nasser\AppData\Local\Programs\Python\Python39\lib\distutils\core.py", line 148, in setup
    dist.run_commands()
  File "C:\Users\Nasser\AppData\Local\Programs\Python\Python39\lib\distutils\dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "C:\Users\Nasser\AppData\Local\Programs\Python\Python39\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "C:\Users\Nasser\PycharmProjects\Ecostore\ecostore\lib\site-packages\setuptools\command\install.py", line 61, in run
    return orig.install.run(self)
  File "C:\Users\Nasser\AppData\Local\Programs\Python\Python39\lib\distutils\command\install.py", line 546, in run
    self.run_command('build')
  File "C:\Users\Nasser\AppData\Local\Programs\Python\Python39\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "C:\Users\Nasser\AppData\Local\Programs\Python\Python39\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "C:\Users\Nasser\AppData\Local\Programs\Python\Python39\lib\distutils\command\build.py", line 135, in run
    self.run_command(cmd_name)
  File "C:\Users\Nasser\AppData\Local\Programs\Python\Python39\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "C:\Users\Nasser\AppData\Local\Programs\Python\Python39\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "C:\Users\Nasser\AppData\Local\Programs\Python\Python39\lib\distutils\command\build_ext.py", line 340, in run
    self.build_extensions()
  File "C:\Users\Nasser\AppData\Local\Temp\pip-install-2jlsjfqz\pillow_49ef0c2dcdc64cccb04edbfc6de127f8\setup.py", line 687, in build_extensions
    raise RequiredDependencyException(f)
__main__.RequiredDependencyException: zlib

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\Nasser\AppData\Local\Temp\pip-install-2jlsjfqz\pillow_49ef0c2dcdc64cccb04edbfc6de127f8\setup.py", line 903, in <module>
    raise RequiredDependencyException(msg)
__main__.RequiredDependencyException:

The headers or library files could not be found for zlib,
a required dependency when compiling Pillow from source.

Please see the install instructions at:
   https://pillow.readthedocs.io/en/latest/installation.html


----------------------------------------

ERROR: Command errored out with exit status 1: 'C:\Users\Nasser\PycharmProjects\Ecostore\ecostore\Scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Nasser\AppData\Local\Temp\pip-install-2jlsjfqz\pillow_49ef0c2dcdc64cccb04edbfc6de127f8\setup.py'"'"'; file='"'"'C:\Users\Nasser\AppData\Local\Temp\pip-install-2jlsjfqz\pillow_49ef0c2dcdc64cccb04edbfc6de127f8\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\Nasser\AppData\Local\Temp\pip-record-7lludxy7\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\Nasser\PycharmProjects\Ecostore\ecostore\include\site\python3.9\Pillow' Check the logs for full command output.

setup and add e2e tests

If you want to have e2e tests for this project then we (a team from @JankariTech) would like to help on setting up e2e test and write some basic tests.

MultipleObjectsReturned at /product/shirt/ get() returned more than one Item -- it returned 2!

When I click on the product I get this error and not able to get product page.

Traceback (most recent call last):
File "C:\Users\Anmol\Envs\hybrid\lib\site-packages\django\core\handlers\exception.py", line 34, in inner
response = get_response(request)
File "C:\Users\Anmol\Envs\hybrid\lib\site-packages\django\core\handlers\base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "C:\Users\Anmol\Envs\hybrid\lib\site-packages\django\core\handlers\base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Users\Anmol\Envs\hybrid\lib\site-packages\django\views\generic\base.py", line 71, in view
return self.dispatch(request, *args, **kwargs)
File "C:\Users\Anmol\Envs\hybrid\lib\site-packages\django\views\generic\base.py", line 97, in dispatch
return handler(request, *args, **kwargs)
File "C:\Users\Anmol\Envs\hybrid\lib\site-packages\django\views\generic\detail.py", line 106, in get
self.object = self.get_object()
File "C:\Users\Anmol\Envs\hybrid\lib\site-packages\django\views\generic\detail.py", line 52, in get_object
obj = queryset.get()
File "C:\Users\Anmol\Envs\hybrid\lib\site-packages\django\db\models\query.py", line 410, in get
raise self.model.MultipleObjectsReturned(
core.models.Item.MultipleObjectsReturned: get() returned more than one Item -- it returned 2!

items in Order (many to many fields)

I'm not sur that this is an issues, but i figured out something, when multiple user are creating cart (independently of course) every instance of OrderItem are display on the many to many fields of the Order class, in the admin. I wondered if you did that on purpose or if it is an issue, because it's not really convenient if you want to check the product ordered by someone ?

Dependencies

I've not been able to download all the dependencies
so the prioject cant run
:(
This is sad

Please add license.txt

Just a friendly reminder to add a LICENSE file to this repo, so people know what permissions you grant related to code re-use and modification.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.