I am reorganizing one of my projects to be more re-usable and just generally structured better and am now getting the error below whenever I run makemigrations
- I've spent half the day trying to figure this out on my own but have run out of Google results on searches and am in need of some assistance. What I've done was remove a custom user model I had setup so I can use Django's built-in User model and I also namespaced my apps urls. I don't want to include a bunch of code yet that will do nothing but dirty up this post as I am hoping the Traceback has clues that I am not seeing. If you are looking at this and have an idea of what could be the culprit for the error, can you please advice on what you need to see to offer assistance? Thank you.
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Users/rooster/.virtualenvs/ddm_dev/lib/python3.5/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
utility.execute()
File "/Users/rooster/.virtualenvs/ddm_dev/lib/python3.5/site-packages/django/core/management/__init__.py", line 345, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/rooster/.virtualenvs/ddm_dev/lib/python3.5/site-packages/django/core/management/base.py", line 348, in run_from_argv
self.execute(*args, **cmd_options)
File "/Users/rooster/.virtualenvs/ddm_dev/lib/python3.5/site-packages/django/core/management/base.py", line 399, in execute
output = self.handle(*args, **options)
File "/Users/rooster/.virtualenvs/ddm_dev/lib/python3.5/site-packages/django/core/management/commands/makemigrations.py", line 132, in handle
migration_name=self.migration_name,
File "/Users/rooster/.virtualenvs/ddm_dev/lib/python3.5/site-packages/django/db/migrations/autodetector.py", line 45, in changes
changes = self._detect_changes(convert_apps, graph)
File "/Users/rooster/.virtualenvs/ddm_dev/lib/python3.5/site-packages/django/db/migrations/autodetector.py", line 128, in _detect_changes
self.old_apps = self.from_state.concrete_apps
File "/Users/rooster/.virtualenvs/ddm_dev/lib/python3.5/site-packages/django/db/migrations/state.py", line 166, in concrete_apps
self.apps = StateApps(self.real_apps, self.models, ignore_swappable=True)
File "/Users/rooster/.virtualenvs/ddm_dev/lib/python3.5/site-packages/django/db/migrations/state.py", line 228, in __init__
self.render_multiple(list(models.values()) + self.real_models)
File "/Users/rooster/.virtualenvs/ddm_dev/lib/python3.5/site-packages/django/db/migrations/state.py", line 296, in render_multiple
model.render(self)
File "/Users/rooster/.virtualenvs/ddm_dev/lib/python3.5/site-packages/django/db/migrations/state.py", line 585, in render
body,
File "/Users/rooster/.virtualenvs/ddm_dev/lib/python3.5/site-packages/django/db/models/base.py", line 158, in __new__
new_class.add_to_class(obj_name, obj)
File "/Users/rooster/.virtualenvs/ddm_dev/lib/python3.5/site-packages/django/db/models/base.py", line 299, in add_to_class
value.contribute_to_class(cls, name)
File "/Users/rooster/.virtualenvs/ddm_dev/lib/python3.5/site-packages/django/db/models/fields/related.py", line 707, in contribute_to_class
super(ForeignObject, self).contribute_to_class(cls, name, virtual_only=virtual_only)
File "/Users/rooster/.virtualenvs/ddm_dev/lib/python3.5/site-packages/django/db/models/fields/related.py", line 307, in contribute_to_class
lazy_related_operation(resolve_related_class, cls, self.remote_field.model, field=self)
File "/Users/rooster/.virtualenvs/ddm_dev/lib/python3.5/site-packages/django/db/models/fields/related.py", line 84, in lazy_related_operation
return apps.lazy_model_operation(partial(function, **kwargs), *model_keys)
File "/Users/rooster/.virtualenvs/ddm_dev/lib/python3.5/site-packages/django/db/models/fields/related.py", line 82, in <genexpr>
model_keys = (make_model_tuple(m) for m in models)
File "/Users/rooster/.virtualenvs/ddm_dev/lib/python3.5/site-packages/django/db/models/utils.py", line 13, in make_model_tuple
app_label, model_name = model.split(".")
ValueError: too many values to unpack (expected 2)
choices expected 2 arguments. if it is more or less then 2 you get this error.
all_choices = (('pick1', 'value1' ), ('pick2', 'value2'), ('pick3', 'value3'))
This error would only occur if split()
returns more than 2 elements:
app_label, model_name = model.split(".")
ValueError: too many values to unpack (expected 2)
This means that either app_label
or model_name
has a dot (.
) in it. My money is on the former as model names are automatically generated
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With