Note that there are some explanatory texts on larger screens.

plurals
  1. POSome clarification of GAE Blobstore's create_upload_url()
    primarykey
    data
    text
    <p>I am using the GAE Blobstore to upload and serve images for my Django app. For admin users maintenance is available by wrapping the image in a Django model <code>Image</code> and supplying the standard admin features for this model: add, update, delete.</p> <p>To perform the actual upload, I modified the <code>change_form.html</code> template for the Image model and replaced <code>{{ form_url }}</code> with <code>{{ blobstore_url}}</code>. <code>{{ blobstore_url }}</code> gets set by overriding the <code>render_change_form</code> of <code>ImageAdmin</code>.</p> <p>I noticed that by by calling <code>create_upload_url("/admin/some/url")</code>, I get an encoded url to GAE Blobstore's upload facility and the argument of the function ("/admin/some/url") is actually the url to which GAE/Blobstore redirects upon completion of the upload.</p> <p>Not really relevant to question, but something I noticed as well is that in my first approach I just overwrote the value of <code>{{ form_url }}</code> but that does not seem to work as the form's action was not set; it either gets overwritten somewhere else or is ignored.</p> <p>Although this works the main downside is that this approach requires me to implement "admin/some/url" as a view from where I can process the required add or change of the model Image, which really is duplication of code as the default admin already supports these features.</p> <p>So my question is what would be the correct url to pass to <code>create_upload_url()</code> in order to run the standard admin functionality of validation and database update for the Image model after completion of the upload?</p> <p><strong>EDIT</strong></p> <p>Alternatively, it might be a better design to perform the upload after the default admin operation (e.g. insert or update) have completed...</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload