Tengo un problema en mi proyecto 'Django' y necesito ayuda con este error, el error ocurre cuando quiero crear migraciones, uso PyCharm para trabajar y a la vez uso la consola de cuya IDE, cuando ejecuto la creación de la migración "python manage.py makemigrations" me sale todo este error:
Traceback (most recent call last):
File "manage.py", line 22, in <module>
main()
File "manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\Users\circi\Documents\Django\Gout.io\ve\lib\site-packages\django\core\management\__init__.py", line 401, in exec
ute_from_command_line
utility.execute()
File "C:\Users\circi\Documents\Django\Gout.io\ve\lib\site-packages\django\core\management\__init__.py", line 377, in exec
ute
django.setup()
File "C:\Users\circi\Documents\Django\Gout.io\ve\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\circi\Documents\Django\Gout.io\ve\lib\site-packages\django\apps\registry.py", line 122, in populate
app_config.ready()
File "C:\Users\circi\Documents\Django\Gout.io\ve\lib\site-packages\django\contrib\admin\apps.py", line 24, in ready
self.module.autodiscover()
File "C:\Users\circi\Documents\Django\Gout.io\ve\lib\site-packages\django\contrib\admin\__init__.py", line 24, in autodis
cover
autodiscover_modules('admin', register_to=site)
File "C:\Users\circi\Documents\Django\Gout.io\ve\lib\site-packages\django\utils\module_loading.py", line 47, in autodisco
ver_modules
import_module('%s.%s' % (app_config.name, module_to_search))
File "c:\users\circi\appdata\local\programs\python\python38\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\circi\Documents\Django\Gout.io\GoutApp\admin.py", line 2, in <module>
from .models.product import Product
File "C:\Users\circi\Documents\Django\Gout.io\GoutApp\models\product.py", line 34, in <module>
class Product(models.Model):
File "C:\Users\circi\Documents\Django\Gout.io\GoutApp\models\product.py", line 40, in Product
choiceGameCategory = MultiSelectField(choices=GameCategory)
File "C:\Users\circi\Documents\Django\Gout.io\ve\lib\site-packages\multiselectfield\db\fields.py", line 71, in __init__
self.max_length = get_max_length(self.choices, self.max_length)
File "C:\Users\circi\Documents\Django\Gout.io\ve\lib\site-packages\multiselectfield\utils.py", line 31, in get_max_length
return len(','.join([string_type(key) for key, label in choices]))
File "C:\Users\circi\Documents\Django\Gout.io\ve\lib\site-packages\multiselectfield\utils.py", line 31, in <listcomp>
return len(','.join([string_type(key) for key, label in choices]))
ValueError: too many values to unpack (expected 2)
Este fracmento muestra como tengo el código en el archivo urls.py:
from django.contrib import admin
from django.urls import path
from django.urls import path, include
from django.conf.urls.static import static
from . import settings
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('GoutApp.urls'))
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Este fracmento muestra como tengo el código en el archivo admin.py:
from django.contrib import admin
from .models.product import Product
class AdminProduct(admin.ModelAdmin):
list_display = ['name', 'Pricing', 'choicePrice', 'choiceApp', 'choiceGameCategory']
# Register your models here.
admin.site.register(Product, AdminProduct)
La manera en que el directorio está organizada es de la siguente forma: