SanomaCZ / ella-hope

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

unable to save a new article #15

Closed yedpodtrzitko closed 11 years ago

yedpodtrzitko commented 11 years ago

response for article's save request says:

POST http://localhost:8000/admin-api/article/ 404 NOT FOUND

POST:

{"title":"title","slug":"title","category":"/admin-api/category/1/","source":"","content":"jkasjdaskdjas d","description":"","photo":"","related-name":"","publish_from_date":"2012-11-28","publish_from_time":"13:27","publish_to_date":"","publish_to_time":"","enable_comments":"","state":"added","announced":false,"publish_from":"2012-11-28T13:27","publish_to":null,"published":"true","static":false,"photo_displayed":true,"app_data":null}

RESPONSE:

{"error_message": "The URL provided '' was not a link to a valid resource.", "traceback": "Traceback (most recent call last):\n\n  File \"/home/yed/skript/sanoma/daz2/venv/src/django-tastypie/tastypie/resources.py\", line 202, in wrapper\n    response = callback(request, *args, **kwargs)\n\n  File \"/home/yed/skript/sanoma/daz2/venv/src/django-tastypie/tastypie/resources.py\", line 441, in dispatch_list\n    return self.dispatch('list', request, **kwargs)\n\n  File \"/home/yed/skript/sanoma/daz2/venv/src/django-tastypie/tastypie/resources.py\", line 474, in dispatch\n    response = method(request, **kwargs)\n\n  File \"/home/yed/skript/sanoma/daz2/venv/src/django-tastypie/tastypie/resources.py\", line 1258, in post_list\n    updated_bundle = self.obj_create(bundle, request=request, **self.remove_api_resource_names(kwargs))\n\n  File \"/home/yed/skript/sanoma/daz2/venv/src/django-tastypie/tastypie/resources.py\", line 1925, in obj_create\n    bundle = self.full_hydrate(bundle)\n\n  File \"/home/yed/skript/sanoma/daz2/venv/src/django-tastypie/tastypie/resources.py\", line 780, in full_hydrate\n    value = field_object.hydrate(bundle)\n\n  File \"/home/yed/skript/sanoma/daz2/venv/src/django-tastypie/tastypie/fields.py\", line 661, in hydrate\n    return self.build_related_resource(value, request=bundle.request)\n\n  File \"/home/yed/skript/sanoma/daz2/venv/src/django-tastypie/tastypie/fields.py\", line 595, in build_related_resource\n    return self.resource_from_uri(self.fk_resource, value, **kwargs)\n\n  File \"/home/yed/skript/sanoma/daz2/venv/src/django-tastypie/tastypie/fields.py\", line 528, in resource_from_uri\n    obj = fk_resource.get_via_uri(uri, request=request)\n\n  File \"/home/yed/skript/sanoma/daz2/venv/src/django-tastypie/tastypie/resources.py\", line 721, in get_via_uri\n    raise NotFound(\"The URL provided '%s' was not a link to a valid resource.\" % uri)\n\nNotFound: The URL provided '' was not a link to a valid resource.\n"}
mrpohoda commented 11 years ago

Try to save it with title photo. I though that title photo is not mandatory but maybe there was a change in api. How should it be - mandatory or optional?

yedpodtrzitko commented 11 years ago

I'm not able to add photo in this moment, because photo's modal is broken .(

yedpodtrzitko commented 11 years ago

ad photo: I'm not sure, but I think it should reflect model properties - photo is not mandatory in model so it shouldn't be required in form as well. Also I can imagine an editor's use case, when he wants to save (unpublished) article without photo.

yedpodtrzitko commented 11 years ago

does not work for me

yedpodtrzitko commented 11 years ago

ok, so it depends on source for real. I'm not sure why, because source has attributes blank=True and null=True.

mrpohoda commented 11 years ago

So I added source as required and article can be saved now.

yedpodtrzitko commented 11 years ago

yep, but to have source as a mandatory field is not expected/desired behaviour.