-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DictionaryField + south schemamigration results in wrong default field value. #57
Comments
for this reason: I seem to remember that it was necessary for the schema mode to work but now I don't remember clearly. I'll investigate asap |
removing the forced default does not cause issues. Setting None as a default value in schema mode does not work and support it would complicate things a bit to no advantage. Could you verify again with the latest changes? |
Removing the forced default does not affect the schemamigration. Maybe something can be done with south to overcome this issue with it's introspection. I will try later this week to come up with something. |
As a side note: your commit acd1a9b breaks functionality for me. models.py:352: in serialize
> 'total': self.total,
../env/src/django-hstore/django_hstore/virtual.py:47: in __get__
> return getattr(instance, self.hstore_field_name).get(self.name, self.default)
E AttributeError: 'NoneType' object has no attribute 'get' test_stats.py:486: in test_conditions_true
> dummy.total = 1000
../env/src/django-hstore/django_hstore/virtual.py:54: in __set__
> hstore_dictionary[self.name] = value
E TypeError: 'NoneType' object does not support item assignment The default of the DictionaryField is turned into a NoneType object and the VirtualFields in the schema cannot be accessed anymore. |
that's why the dictionary field should not have default=None, i wrote it in the previous comment |
This is probably the correct way to fix this: |
it should be fixed now in the dev version |
let us know if you encounter other issues. |
I'm using the latest 1.3.0 release and noticed something odd using the DictionaryField and South (0.8.4) schemamigrations.
I have the following field:
Now when I add a schemamigration for this new field, I end up with a wrong default value on the migration:
Running this migration results in:
The default value on the migration should be a None instead of an empty Dict {}.
To fix this I have to change the default value to None in the forwards migration and in the frozen models.
Do you know what might be causing this?
The text was updated successfully, but these errors were encountered: