datadesk / django-bigbuild

The open-source engine that powers bigbuilder, the Los Angeles Times Data Desk's system for publishing standalone pages
http://www.latimes.com/projects/
MIT License
24 stars 0 forks source link

Fix Django 2.0 bugs #50

Open palewire opened 6 years ago

palewire commented 6 years ago

It appears the JSONField dependency has some issue.

palewire commented 6 years ago
======================================================================
ERROR: setUpClass (bigbuild.tests.test_commands.TestCommands)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/datadesk/django-bigbuild/bigbuild/tests/__init__.py", line 40, in setUpClass
    Page.create(slug=slugify('My Fake Page'), published=True, force=True),
  File "/home/travis/build/datadesk/django-bigbuild/bigbuild/models/base.py", line 169, in create
    index_template_context=index_template_context,
  File "/home/travis/build/datadesk/django-bigbuild/bigbuild/models/pages.py", line 72, in create_directory
    self.write_frontmatter()
  File "/home/travis/build/datadesk/django-bigbuild/bigbuild/models/pages.py", line 99, in write_frontmatter
    f.write(serializer.serialize([self]))
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/django/core/serializers/base.py", line 89, in serialize
    self.handle_field(obj, field)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/django/core/serializers/pyyaml.py", line 54, in handle_field
    super().handle_field(obj, field)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/django/core/serializers/python.py", line 50, in handle_field
    self._current[field.name] = self._value_from_field(obj, field)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/django/core/serializers/python.py", line 47, in _value_from_field
    return value if is_protected_type(value) else field.value_to_string(obj)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/jsonfield/fields.py", line 114, in value_to_string
    return self._get_val_from_obj(obj)
AttributeError: 'JSONField' object has no attribute '_get_val_from_obj'
palewire commented 6 years ago

Dude here says to use the built-in field. We might be able to do this since we are never actually touching a database. https://github.com/dmkoch/django-jsonfield