BezBartek / django-db-views

Creating automatic migrations for Views models witch working reverse and full command options like in normal makemigrations
MIT License
62 stars 12 forks source link

Exception in makeviewmigrations #6

Closed ishirav closed 4 years ago

ishirav commented 4 years ago

When running makeviewmigrations for a new view, I get this exception:

bin/manage makeviewmigrations
Traceback (most recent call last):
  File "bin/manage", line 44, in <module>
    sys.exit(cronorc_server.scripts.manage.main())
  File "myproject/scripts/manage.py", line 17, in main
    execute_from_command_line(sys.argv)
  File "myproject/eggs/Django-2.2.9-py3.7.egg/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "myproject/eggs/Django-2.2.9-py3.7.egg/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "myproject/eggs/Django-2.2.9-py3.7.egg/django/core/management/base.py", line 323, in run_from_argv
    self.execute(*args, **cmd_options)
  File "myproject/eggs/Django-2.2.9-py3.7.egg/django/core/management/base.py", line 364, in execute
    output = self.handle(*args, **options)
  File "myproject/eggs/django_db_views-0.0.7-py3.7.egg/django_db_views/management/commands/makeviewmigrations.py", line 75, in handle
    migration_name=self.migration_name,
  File "myproject/eggs/Django-2.2.9-py3.7.egg/django/db/migrations/autodetector.py", line 43, in changes
    changes = self._detect_changes(convert_apps, graph)
  File "myproject/eggs/django_db_views-0.0.7-py3.7.egg/django_db_views/autodetector.py", line 66, in _detect_changes
    self.generate_views_operations(graph)
  File "myproject/eggs/django_db_views-0.0.7-py3.7.egg/django_db_views/autodetector.py", line 119, in generate_views_operations
    BackwardViewMigration(current_view_definition.strip(";"), view_model._meta.db_table),
AttributeError: 'NoneType' object has no attribute 'strip'
BezBartek commented 4 years ago

Hello, Did you set an attribute named 'view_definition', as a string? It looks like instead of a string, somehow you have None as a view definition. I need more details, please paste here your DBView model.