SanomaCZ / ella-hope

Brand new admin for Ella 3+
Other
3 stars 0 forks source link

creating/deleting listing for aricle doesn't work #49

Open yedpodtrzitko opened 11 years ago

yedpodtrzitko commented 11 years ago

adding listing

steps to reproduce

Traceback (most recent call last):

  File "/home/yed/skript/sanoma/daz2/venv/lib/python2.7/site-packages/tastypie/resources.py", line 202, in wrapper
    response = callback(request, *args, **kwargs)

  File "/home/yed/skript/sanoma/daz2/venv/lib/python2.7/site-packages/tastypie/resources.py", line 441, in dispatch_list
    return self.dispatch('list', request, **kwargs)

  File "/home/yed/skript/sanoma/daz2/venv/lib/python2.7/site-packages/tastypie/resources.py", line 474, in dispatch
    response = method(request, **kwargs)

  File "/home/yed/skript/sanoma/daz2/venv/lib/python2.7/site-packages/tastypie/resources.py", line 1268, in post_list
    updated_bundle = self.obj_create(bundle, request=request, **self.remove_api_resource_names(kwargs))

  File "/home/yed/skript/sanoma/daz2/venv/lib/python2.7/site-packages/tastypie/resources.py", line 1939, in obj_create
    bundle = self.full_hydrate(bundle)

  File "/home/yed/skript/sanoma/daz2/venv/lib/python2.7/site-packages/tastypie/resources.py", line 781, in full_hydrate
    value = field_object.hydrate(bundle)

  File "/home/yed/skript/sanoma/daz2/venv/lib/python2.7/site-packages/tastypie/fields.py", line 658, in hydrate
    value = super(ToOneField, self).hydrate(bundle)

  File "/home/yed/skript/sanoma/daz2/venv/lib/python2.7/site-packages/tastypie/fields.py", line 152, in hydrate
    elif self.attribute and getattr(bundle.obj, self.attribute, None):

  File "/home/yed/skript/sanoma/daz2/venv/lib/python2.7/site-packages/django/db/models/fields/related.py", line 343, in __get__
    raise self.field.rel.to.DoesNotExist

DoesNotExist

deleting listing

steps to reproduce

yedpodtrzitko commented 11 years ago

update: it happens to gallery

yedpodtrzitko commented 11 years ago

but deleting doesn't work even for articles

mrpohoda commented 11 years ago

Is it possible in API to save listing for gallery @miso-belica ?

yedpodtrzitko commented 11 years ago

it is - you already do it in article's form, afaik

miso-belica commented 11 years ago

Yes, you only change resource_uri of publishable.

You are sending this for article:

{
  "category": "/admin-api/category/3/",
  "commercial": true,
  "publish_from": "2013-1-14T11:37",
  "publishable": "/admin-api/article/26/"
}

You should send JSON below for gallery resource. See working cURL example https://github.com/SanomaCZ/ella-hub/blob/master/tests/test_ella_dev_server.sh#L208-L216

{
  "category": "/admin-api/category/3/",
  "commercial": false,
  "publish_from": "2013-1-14T11:37",
  "publishable": "/admin-api/gallery/305/"
}

There is missing required attribute publishable in your request now. https://github.com/SanomaCZ/ella-hub/blob/master/doc/api.rst#listing