Skip to content
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

ValidationError when saving: (0.5,0.5) is in invalid ppoi #7

Closed
Bartvds opened this issue Feb 22, 2015 · 1 comment

Comments

Projects
None yet
2 participants
@Bartvds
Copy link

commented Feb 22, 2015

I get this ValidationError when I try to use the code from the PPOIField tutorial.

The weird thing is I can upload an image, and it shows up in the widget as expected. Then I save again (with or without changing anything) and then it throws this error.

Note my admin uses django-suit, but I'd think it doesn't interfere. (I just tried versatileimagefield
late as experiment, I'll look into it next time)

ValidationError at /dashboard/content/image/2/
["(0.5,0.5) is in invalid ppoi. A valid ppoi must provide two coordinates, one for the x axis and one for the y, where both values are between 0 and 1. You may pass it as either a two-position tuple like this: (0.5,0.5) or as a string where the two values are separated by an 'x' like this: '0.5x0.5'."]

Stack:

Traceback:
File "/home/vagrant/.virtualenvs/my-project/lib/python3.4/site-packages/django/core/handlers/base.py" in get_response
  111.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/vagrant/.virtualenvs/my-project/lib/python3.4/site-packages/django/contrib/admin/options.py" in wrapper
  583.                 return self.admin_site.admin_view(view)(*args, **kwargs)
File "/home/vagrant/.virtualenvs/my-project/lib/python3.4/site-packages/django/utils/decorators.py" in _wrapped_view
  105.                     response = view_func(request, *args, **kwargs)
File "/home/vagrant/.virtualenvs/my-project/lib/python3.4/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
  52.         response = view_func(request, *args, **kwargs)
File "/home/vagrant/.virtualenvs/my-project/lib/python3.4/site-packages/django/contrib/admin/sites.py" in inner
  206.             return view(request, *args, **kwargs)
File "/home/vagrant/.virtualenvs/my-project/lib/python3.4/site-packages/django/contrib/admin/options.py" in change_view
  1456.         return self.changeform_view(request, object_id, form_url, extra_context)
File "/home/vagrant/.virtualenvs/my-project/lib/python3.4/site-packages/django/utils/decorators.py" in _wrapper
  29.             return bound_func(*args, **kwargs)
File "/home/vagrant/.virtualenvs/my-project/lib/python3.4/site-packages/django/utils/decorators.py" in _wrapped_view
  105.                     response = view_func(request, *args, **kwargs)
File "/home/vagrant/.virtualenvs/my-project/lib/python3.4/site-packages/django/utils/decorators.py" in bound_func
  25.                 return func.__get__(self, type(self))(*args2, **kwargs2)
File "/home/vagrant/.virtualenvs/my-project/lib/python3.4/site-packages/django/db/transaction.py" in inner
  394.                 return func(*args, **kwargs)
File "/home/vagrant/.virtualenvs/my-project/lib/python3.4/site-packages/django/contrib/admin/options.py" in changeform_view
  1396.             if form.is_valid():
File "/home/vagrant/.virtualenvs/my-project/lib/python3.4/site-packages/django/forms/forms.py" in is_valid
  162.         return self.is_bound and not bool(self.errors)
File "/home/vagrant/.virtualenvs/my-project/lib/python3.4/site-packages/django/forms/forms.py" in errors
  154.             self.full_clean()
File "/home/vagrant/.virtualenvs/my-project/lib/python3.4/site-packages/django/forms/forms.py" in full_clean
  355.         self._post_clean()
File "/home/vagrant/.virtualenvs/my-project/lib/python3.4/site-packages/django/forms/models.py" in _post_clean
  406.         self.instance = construct_instance(self, self.instance, opts.fields, opts.exclude)
File "/home/vagrant/.virtualenvs/my-project/lib/python3.4/site-packages/django/forms/models.py" in construct_instance
  60.             f.save_form_data(instance, cleaned_data[f.name])
File "/home/vagrant/.virtualenvs/my-project/lib/python3.4/site-packages/django/db/models/fields/__init__.py" in save_form_data
  804.         setattr(instance, self.name, data)
File "/home/vagrant/.virtualenvs/my-project/lib/python3.4/site-packages/django/db/models/fields/subclassing.py" in __set__
  37.         obj.__dict__[self.field.name] = self.field.to_python(value)
File "/home/vagrant/.virtualenvs/my-project/lib/python3.4/site-packages/versatileimagefield/fields.py" in to_python
  171.             value, return_converted_tuple=True
File "/home/vagrant/.virtualenvs/my-project/lib/python3.4/site-packages/versatileimagefield/validators.py" in validate_ppoi
  72.             code='invalid_ppoi'

respondcreate added a commit that referenced this issue Feb 24, 2015

Ensuring PPOIField validates in admin #7
Includes:
* Adding test coverage

respondcreate added a commit that referenced this issue Feb 24, 2015

respondcreate added a commit that referenced this issue Feb 24, 2015

Making PPOIField uneditable #7
Includes stripping out PPOIFieldWidget and PPOIAdminField since PPOI
values should only be set on a VersatileImageField. PPOIField is for
PPOI value storage only.
@respondcreate

This comment has been minimized.

Copy link
Owner

commented Feb 24, 2015

Hey @Bartvds !

Thanks for filing this ticket! I found the source of the problem, patched it and re-released as 0.5.3. Upgrade via pip and you should be good to go:

$ pip install django-versatileimagefield==0.5.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.