[ckan-dev] dataset-id

Crossbreed Crossbreed at sms.at
Mon Oct 1 10:29:23 UTC 2012


<html><body><div>Hi! I would like to copy the value of the ID-field into an other field when creating a new dataset. I have an extension which the PackageController implements. In this class (method: _save_new) i tried to set the ID to&nbsp; the other field, but the value of the ID seems to be &quot;none&quot;. So, how could I set the value of the ID-field to an other field, when creating a dataset? - Where is the value of the ID-field generated?<br />&nbsp;def _save_new(self, context, package_type=None):<br />...<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; data_dict = clean_dict(unflatten(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tuplize_dict(parse_params(request.POST))))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; data_dict[&#39;type&#39;] = package_type<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; context[&#39;message&#39;] = data_dict.get(&#39;log_messag
 e&#39;, &#39;&#39;)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; data_dict[&#39;testfield&#39;] = data_dict[&#39;id&#39;]<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pkg = get_action(&#39;package_create&#39;)(context, data_dict)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self._form_save_redirect(pkg[&#39;name&#39;], &#39;new&#39;)</div>
<div>&nbsp;</div>
<div>...</div>
<div>&nbsp;</div>
<div>kind regards!</div><br/><br/><hr/>Schau dir gleich die Seite von hsdf an! <a href="http://my.sms.at/crossbreed/" target="profil_sms_at">http://my.sms.at/crossbreed/</a><br/><hr/>Dein Eventkalender auf sms.at! Events anlegen, Freunde einladen & kein Top-Event mehr verpassen! <a href="http://www.sms.at/events/">http://www.sms.at/events/</a><br/></body></html>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20121001/570ebb57/attachment.htm>


More information about the ckan-dev mailing list