aboutsummaryrefslogtreecommitdiff
path: root/programming
diff options
context:
space:
mode:
authoralexpdp7 <alex@pdp7.net>2025-02-21 15:23:40 +0000
committeralexpdp7 <alex@corcoles.net>2025-02-21 16:24:27 +0100
commit5064a217f59ae508d0e7ccad7bc269f58d2a9b43 (patch)
tree0c4aed840febb123428c3dd2e2b18f07f54eab38 /programming
parentb1aa14fbfa8f7bca4f6c39ea50f4c7d65f7006f5 (diff)
Add note about raw_id_fields
Diffstat (limited to 'programming')
-rw-r--r--programming/python/about_django.md4
1 files changed, 4 insertions, 0 deletions
diff --git a/programming/python/about_django.md b/programming/python/about_django.md
index 1cf3bd75..62559776 100644
--- a/programming/python/about_django.md
+++ b/programming/python/about_django.md
@@ -128,3 +128,7 @@ If you know a good source for many of those, even if it is paid, feel free to le
For example, users belong to organizations and users should only see instances of some model related to their organization.
The FAQ contains [How do I limit admin access so that objects can only be edited by the users who created them?](https://docs.djangoproject.com/en/5.1/faq/admin/#how-do-i-limit-admin-access-so-that-objects-can-only-be-edited-by-the-users-who-created-them), which is a very similar question and points to the features you need to use to achieve these goals.
(These requirements are often related to requiring [extending the existing User model](https://docs.djangoproject.com/en/5.1/topics/auth/customizing/#extending-the-existing-user-model).)
+ * Having a search UI for reference fields instead of dropdowns.
+ Many projects similar to the admin only offer dropdowns for reference fields.
+ This does not work when the referenced objects are more than a couple.
+ Django calls this [`raw_id_fields`](https://docs.djangoproject.com/en/5.1/ref/contrib/admin/#django.contrib.admin.ModelAdmin.raw_id_fields), and it is difficult to learn that this feature exists.