jvdm / inkirinet-hotspot

Inkirinet Hotspot is a Django-based web application offering frontend and management for the Inkiri Center's WiFi hotspot.
Mozilla Public License 2.0
2 stars 0 forks source link

Sheets polling fails to add new contracts #3

Closed jvdm closed 3 years ago

jvdm commented 3 years ago

Desired Behavior

./manage.py inkirinetsheetspoll should be able to create Contracts on new rows.

Current Behavior

The command fails:

$ python /home/inkirinet-service/local_manage.py inkirinetsheetspoll
Traceback (most recent call last):
  File "/home/inkirinet-service/venv/lib/python3.7/site-packages/django/db/models/query.py", line 573, in get_or_create
    return self.get(**kwargs), False
  File "/home/inkirinet-service/venv/lib/python3.7/site-packages/django/db/models/query.py", line 431, in get
    self.model._meta.object_name
inkirinethotspot.apps.contracts.models.DoesNotExist: Contract matching query does not exist.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/inkirinet-service/local_manage.py", line 22, in <module>
    main()
  File "/home/inkirinet-service/local_manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/home/inkirinet-service/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "/home/inkirinet-service/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 395, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/inkirinet-service/venv/lib/python3.7/site-packages/django/core/management/base.py", line 330, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/inkirinet-service/venv/lib/python3.7/site-packages/django/core/management/base.py", line 371, in execute
    output = self.handle(*args, **options)
  File "/home/inkirinet-service/venv/lib/python3.7/site-packages/inkirinethotspot/apps/contracts/management/commands/inkirinetsheetspoll.py", line 21, in handle
    'max_devices': sheet_contract.max_devices,
  File "/home/inkirinet-service/venv/lib/python3.7/site-packages/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/home/inkirinet-service/venv/lib/python3.7/site-packages/django/db/models/query.py", line 575, in get_or_create
    params = self._extract_model_params(defaults, **kwargs)
  File "/home/inkirinet-service/venv/lib/python3.7/site-packages/django/db/models/query.py", line 641, in _extract_model_params
    "', '".join(sorted(invalid_params)),
django.core.exceptions.FieldError: Invalid field name(s) for model Contract: 'active', 'name'.