Closed leebrooks0 closed 9 years ago
I think it's because you're using a 3.x version of django rest framework and it's not compatible with this module.
From: http://www.django-rest-framework.org/api-guide/fields/ you can read:
Note that the WritableField class that was present in version 2.x no longer exists. You should subclass Field and override to_internal_value() if the field supports data input.
correct, I wrote my own little custom field, if there is interest i can submit a PR, but that will break backwards compatibility
Yes, it would be nice :) I also need to add this module to my project but didn't work for the same reason as you :(
I just created a module fields.py and then imported it in my models
from django_hstore.dict import HStoreDict
from rest_framework import serializers
class HStoreField(serializers.Field):
def to_representation(self, value):
return value
def to_internal_value(self, data):
return HStoreDict(data)
Thank you very much :+1:
thank you both for contributing to the discussion, follow pull request https://github.com/djangonauts/django-rest-framework-hstore/pull/6 to stay up to date with DRF 3.1 compatibility.
I'm closing this because is a duplicate of #4.
Hi
Thank you for your library, it is just what I need for the task I am working on. Unfortunately I keep getting an import error. I am using Django 1.7 and I keep getting this error:
I tried pulling the repo locally and ran the tests:
Am I doing something wrong?