awesto/cookiecutter-django-shop

cannot import name 'SmartCardInventory' from '<project name>.models'

Closed this issue · 2 comments

What happened?

After running the cookiecutter https://github.com/awesto/cookiecutter-django-shop, pipenv install and npm install with no apparent errors.

ran pipenv run ./manage.py initialize_shop_demo

File "./mbartist3/admin.py", line 14, in
from mbartist3.models import SmartCardInventory, SmartPhoneInventory
ImportError: cannot import name 'SmartCardInventory' from 'mbartist3.models'

What should've happened instead?

I should have been able to move to the next step

export DJANGO_DEBUG=1
pipenv run ./manage.py runserver

Steps to reproduce

cookiecutter https://github.com/awesto/cookiecutter-django-shop
pipenv install
npm install
pipenv run ./manage.py initialize_shop_demo

Reasoning that it might be the inventory choice that I made I ran it again:

rhildred@helmsdeep:~/source/projects$ cookiecutter https://github.com/awesto/cookiecutter-django-shop
You've downloaded /home/rhildred/.cookiecutters/cookiecutter-django-shop before. Is it okay to delete and re-download it? [yes]: 
project_name [My SHOP]: MBartist
project_slug [mbartist]: 
app_name [mbartist]: 
appName [MBartist]: 
description [Blueprint for an e-commerce site based on django-SHOP]: Artist alley on the internet
author_name [John Doe]: Rich Hildred
email [john@example.com]: rhildred@mailinator.com
virtual_host [www.example.com]: mbartist.petlady.ca
version [1.0.0]: 1.3.0
timezone [UTC]: EST
Select dockerize:
1 - n
2 - runserver
3 - uwsgi
4 - nginx
Choose from 1, 2, 3, 4 [1]: 1
use_i18n [y]: 
languages [de, en]: 
use_paypal [y]: y
use_stripe [y]: m
use_sendcloud [y]: n
printable_invoice [y]: y
Select delivery_handling:
1 - partial
2 - common
3 - n
Choose from 1, 2, 3 [1]: 2
Select products_model:
1 - polymorphic
2 - smartcard
3 - commodity
Choose from 1, 2, 3 [1]: 2
use_compressor [n]: y
use_elasticsearch [y]: y
Select stock_management:
1 - simple
2 - inventory
3 - n
Choose from 1, 2, 3 [1]: 3
debug [y]:

This time I got:

    value = self.to_internal_value(data)
  File "/home/rhildred/source/projects/mbartist/mbartist/management/translation.py", line 11, in to_internal_value
    data = self._swap_translated_data(data)
  File "/home/rhildred/source/projects/mbartist/mbartist/management/translation.py", line 21, in _swap_translated_data
    for language in translations.keys():
AttributeError: 'int' object has no attribute 'keys'

I got it to "work" by also removing internationalization.