Sorry, we don't support your browser.  Install a modern browser

Infer `query` in files field when `uploads` is specified#242

Let’s say I have the following field blueprint:

myField:
  type: files
  uploads:
    parent: site.page("my/page")
    template: foo

In the panel, this will list files from the page where the field exists, but upload files to my/page. This means that any files you upload won’t get listed in the very same field with which you uploaded them. This makes no sense. To fix it, you need to change the blueprint to this:

myField:
  type: files
  query: site.page("my/page").files.template("foo")
  uploads:
    parent: site.page("my/page")
    template: foo

I’m wondering if it would be better to automatically set query based on uploads.parent and uploads.template?

2 months ago