We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When using Django 1.5.5, I'm running into the issue where dumpdata is only outputting the filename of the CroppableImageField, without its coord_csv.
It seems that the best way to solve this is to use value_to_string(): https://docs.djangoproject.com/en/1.6/howto/custom-model-fields/#django.db.models.Field.value_to_string
Adding this to CroppableImageField seems to work for me:
def value_to_string(self, obj): if obj.picture: value = obj.picture.filename + IMAGE_FIELD_DELIMITER + obj.picture.coords_csv else: value = '' return self.get_prep_value(value)
Note that this doesn't solve loaddata...
Edit: Found a way to make loaddata work! Overload get_db_prep_save(): https://docs.djangoproject.com/en/1.5/howto/custom-model-fields/#django.db.models.Field.get_db_prep_save
def get_db_prep_save(self, value, connection): return value.filename + IMAGE_FIELD_DELIMITER + value.coords_csv
The text was updated successfully, but these errors were encountered:
Great finds! Any chance you can submit a pull request?
Sorry, something went wrong.
Sure, when I'm less busy! Gimme a couple of days!
No branches or pull requests
When using Django 1.5.5, I'm running into the issue where dumpdata is only outputting the filename of the CroppableImageField, without its coord_csv.
It seems that the best way to solve this is to use value_to_string():
https://docs.djangoproject.com/en/1.6/howto/custom-model-fields/#django.db.models.Field.value_to_string
Adding this to CroppableImageField seems to work for me:
Note that this doesn't solve loaddata...
Edit:
Found a way to make loaddata work! Overload get_db_prep_save():
https://docs.djangoproject.com/en/1.5/howto/custom-model-fields/#django.db.models.Field.get_db_prep_save
The text was updated successfully, but these errors were encountered: