django-fixturemedia icon indicating copy to clipboard operation
django-fixturemedia copied to clipboard

ImportError: cannot import name 'NoArgsCommand'

Open stephenHartzell opened this issue 7 years ago • 3 comments

This is an error in newer version of Django (1.10.3). I think this is all that needs done in a few places:

try:
    from django.core.management.base import CommandError, NoArgsCommand
except ImportError:
    from django.core.management import BaseCommand as NoArgsCommand
    from django.core.management import CommandError

stephenHartzell avatar Mar 12 '17 13:03 stephenHartzell

Experiencing same issue

Matlino avatar Jun 07 '17 12:06 Matlino

Same issue Django 1.11.2, django-fixture-media 0.1.4

chamalis avatar Jul 01 '17 14:07 chamalis

Hello,

I have updated the code to ensure compatibility with Django 1.10+. Here are the changes I made:

  • Replaced deprecated option_list with the add_arguments method in management commands.
  • Updated raw_input to input for Python 3 compatibility.
  • Handled apps without __file__ attribute in management commands.
  • Replaced handle_noargs with the handle method.
  • Ensured use of apps.get_app_configs instead of get_apps.

These changes should resolve compatibility issues and ensure the project works smoothly with Django 1.10+.

Please review and let me know if there are any issues or further adjustments needed.

Thank you!

shahriar-fattahi avatar Jul 11 '24 20:07 shahriar-fattahi