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

Cannot add photo #303

Closed
dboyer opened this issue Jan 30, 2017 · 6 comments
Closed

Cannot add photo #303

dboyer opened this issue Jan 30, 2017 · 6 comments
Assignees
Milestone

Comments

@dboyer
Copy link

dboyer commented Jan 30, 2017

Tested on testmap0125second

  1. Registered a new account
  2. Visited the map which is set to public
  3. Public user permissions are yes to add tree, add tree photo, add planting site and no to can delete any tree, can delete any photo, can delete any planting site
  4. Add tree with species and diameter - it saves
  5. Add photo - both from camera and a small existing screenshot in the gallery
  6. Receive "cannot save the tree" when click save

I tried steps 4-6 with the account I used to create the tree map and I was able to save successfully.

@RobinIsTheBird
Copy link
Contributor

RobinIsTheBird commented Jan 30, 2017

Confirmed the bug. Furthermore, if I change only the diameter, I get the same "cannot save tree" message when tap save.

Added to the Fix Immediate card.

@dboyer dboyer added this to the 2.14.0 milestone Jan 30, 2017
RobinIsTheBird added a commit to RobinIsTheBird/otm-core that referenced this issue Jan 30, 2017
The android app sends `updated_by`. It doesn't know it's a foreign key,
neither does the api, so it gets set to the `id` rather than the model.
This causes a `ValueError` in auditing.

The api already has a list of attributes to ignore.
`updated_by` can be safely ignored because it is set in auditing.
Same for `updated_at`. Since they are supposed to be set in auditing,
they really should both be ignored.

So ignore them.

--

Connects to OpenTreeMap/otm-android#303
Connects to OpenTreeMap/otm-android#304
RobinIsTheBird added a commit to RobinIsTheBird/otm-core that referenced this issue Jan 30, 2017
The android app sends `updated_by`. It doesn't know it's a foreign key,
neither does the api, so it gets set to the `id` rather than the model.
This causes a `ValueError` in auditing.

The api already has a list of attributes to ignore.
`updated_by` can be safely ignored because it is set in auditing.
Same for `updated_at`. Since they are supposed to be set in auditing,
they really should both be ignored.

So ignore them.

--

Connects to OpenTreeMap/otm-android#303
Connects to OpenTreeMap/otm-android#304
@dboyer
Copy link
Author

dboyer commented Feb 1, 2017

I can now upload a photo, but it does not display on the record despite successfully saving and reloading the page.

Tested on testmap0125. I uninstalled and reinstalled the apk.

@dboyer
Copy link
Author

dboyer commented Feb 1, 2017

The images are appearing on the website but not on the Android app - /testmap0125/features/2774134/

@hectcastro
Copy link

Some potentially relevant traceback info from Papertrail:

Jan 30 11:42:40 ip-10-0-3-68 app:  Traceback (most recent call last):
Jan 30 11:42:40 ip-10-0-3-68 app:    File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 132, in get_response
Jan 30 11:42:40 ip-10-0-3-68 app:      response = wrapped_callback(request, *callback_args, **callback_kwargs)
Jan 30 11:42:40 ip-10-0-3-68 app:    File "/usr/local/lib/python2.7/dist-packages/django/views/decorators/csrf.py", line 58, in wrapped_view
Jan 30 11:42:40 ip-10-0-3-68 app:      return view_func(*args, **kwargs)
Jan 30 11:42:40 ip-10-0-3-68 app:    File "/opt/app/core/opentreemap/api/decorators.py", line 107, in wrapperf
Jan 30 11:42:40 ip-10-0-3-68 app:      return view_f(request, *args, **kwargs)
Jan 30 11:42:40 ip-10-0-3-68 app:    File "/opt/app/core/opentreemap/api/decorators.py", line 151, in wrapper
Jan 30 11:42:40 ip-10-0-3-68 app:      return view_f(request, *args, **kwargs)
Jan 30 11:42:40 ip-10-0-3-68 app:    File "/opt/app/core/opentreemap/treemap/decorators.py", line 46, in wrapper
Jan 30 11:42:40 ip-10-0-3-68 app:      return view_fn(request, instance, *args, **kwargs)
Jan 30 11:42:40 ip-10-0-3-68 app:    File "/usr/local/lib/python2.7/dist-packages/django_tinsel/decorators.py", line 125, in newreq
Jan 30 11:42:40 ip-10-0-3-68 app:      outp = req_function(request, *args, **kwargs)
Jan 30 11:42:40 ip-10-0-3-68 app:    File "/usr/local/lib/python2.7/dist-packages/django_tinsel/decorators.py", line 106, in newreq
Jan 30 11:42:40 ip-10-0-3-68 app:      outp = req_function(request, *args, **kwargs)
Jan 30 11:42:40 ip-10-0-3-68 app:    File "/usr/local/lib/python2.7/dist-packages/django_tinsel/decorators.py", line 35, in routed
Jan 30 11:42:40 ip-10-0-3-68 app:      return kwargs['ELSE'](request, *args2, **kwargs2)
Jan 30 11:42:40 ip-10-0-3-68 app:    File "/opt/app/core/opentreemap/api/decorators.py", line 122, in wrapperf
Jan 30 11:42:40 ip-10-0-3-68 app:      return view_f(request, *args, **kwargs)
Jan 30 11:42:40 ip-10-0-3-68 app:    File "/opt/app/core/opentreemap/treemap/decorators.py", line 216, in wrapper
Jan 30 11:42:40 ip-10-0-3-68 app:      return view_fn(request, instance, *args, **kwargs)
Jan 30 11:42:40 ip-10-0-3-68 app:    File "/usr/local/lib/python2.7/dist-packages/django_tinsel/decorators.py", line 33, in routed
Jan 30 11:42:40 ip-10-0-3-68 app:      return req_method(request, *args2, **kwargs2)
Jan 30 11:42:40 ip-10-0-3-68 app:    File "/opt/app/core/opentreemap/api/plots.py", line 109, in update_or_create_plot
Jan 30 11:42:40 ip-10-0-3-68 app:      plot, __ = update_map_feature(data, request.user, plot)
Jan 30 11:42:40 ip-10-0-3-68 app:    File "/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py", line 145, in inner
Jan 30 11:42:40 ip-10-0-3-68 app:      return func(*args, **kwargs)
Jan 30 11:42:40 ip-10-0-3-68 app:    File "/opt/app/core/opentreemap/treemap/views/map_feature.py", line 315, in update_map_feature
Jan 30 11:42:40 ip-10-0-3-68 app:      set_attr_on_model(model, field, value)
Jan 30 11:42:40 ip-10-0-3-68 app:    File "/opt/app/core/opentreemap/treemap/views/map_feature.py", line 261, in set_attr_on_model
Jan 30 11:42:40 ip-10-0-3-68 app:      model.apply_change(attr, val)
Jan 30 11:42:40 ip-10-0-3-68 app:    File "/opt/app/core/opentreemap/treemap/udf.py", line 1186, in apply_change
Jan 30 11:42:40 ip-10-0-3-68 app:      super(UDFModel, self).apply_change(key, val)
Jan 30 11:42:40 ip-10-0-3-68 app:    File "/opt/app/core/opentreemap/treemap/audit.py", line 550, in apply_change
Jan 30 11:42:40 ip-10-0-3-68 app:      setattr(self, key, orig_value)
Jan 30 11:42:40 ip-10-0-3-68 app:    File "/usr/local/lib/python2.7/dist-packages/django/db/models/fields/related.py", line 639, in __set__
Jan 30 11:42:40 ip-10-0-3-68 app:      self.field.rel.to._meta.object_name,
Jan 30 11:42:40 ip-10-0-3-68 app:  ValueError: Cannot assign "6774": "Plot.updated_by" must be a "User" instance.

@RobinIsTheBird
Copy link
Contributor

RobinIsTheBird commented Feb 1, 2017

Thanx, @hectcastro! Looks like that s/t was before yesterday's PR, which was intended to fix it.

I am not reproducing the s/t with a development build of release/2.14.0 and a master apk.

@RobinIsTheBird
Copy link
Contributor

All tree photos appear in both the little tree info pop-up and the full page tree details screen for me.

Using the development build of otm release/2.14.0, and an otm-android master apk.

On the android app, either logged out, or logged into a treemap on my local db as either rschaufler or rgs01, I can see all pictures uploaded by either account. Logged in as either account, I can add photos to trees created by either account, and see them immediately.

I'll try connecting to staging and viewing testmap0125.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants