question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature request: A standardised API to allow developers to customise model edit forms based on the current user

See original GitHub issue

Issue Summary

In Django ModelAdmin there’s a get_field_queryset(self, db, db_field, request) method, which allows the filtering of items displayed in the aforementioned fields based on the request.

https://github.com/django/django/blob/3f8ee58ccc5c55e62625ad797ddde05778fe1bec/django/contrib/admin/options.py#L206-L217

In the Wagtail ModelAdmin such method does not exist.

Is there a way to achieve a similar functionality as with Django get_field_queryset()?

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ababiccommented, Sep 8, 2019

In addition to the above, I think it might also be nice to bring in some additional flexibility to the get_edit_handler() method on Page, by allowing it to accept optional object and request arguments (a bit more like the version on the ModelAdmin class:https://github.com/wagtail/wagtail/blob/master/wagtail/contrib/modeladmin/options.py#L399), and trying to be consistent about providing those values in the various editing UIs. This would make it easier to do things like following (all of which I have done at some point):

  • using different edit handlers classes/panel sets for create and update views
  • surfacing different fields to different levels of user
  • modifying the edit interface based on an object-specific field values
1reaction
ababiccommented, Sep 2, 2019

@gasman I have renamed/reopened this as, following a discussion on Slack, I feel it makes sense to have a ticket here to discuss (if anything) what we can do to provide a better API for this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Apply Edits (Feature Service)—ArcGIS REST APIs
This allows an editor to apply a single block of edits partially, complete another task, and then complete the block of edits. When...
Read more >
RESTful web API design - Best Practices - Microsoft Learn
As the API evolves, existing client applications should continue to function without ... REST APIs use a stateless request model.
Read more >
Django Tutorial Part 9: Working with forms - MDN Web Docs
Objective: To understand how to write forms to get information from users and update the database. To understand how the generic class-based ......
Read more >
What is an Application Programming Interface (API)? - IBM
Application programming interfaces, or APIs, simplify software development by enabling applications to exchange data and functionality ...
Read more >
lightning-record-edit-form - Salesforce Developers
Use the lightning-record-edit-form component to create a form that's used to add a Salesforce record or update fields in an existing record on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found