]> xn--ix-yja.es Git - alex.git/commitdiff
Add note about raw_id_fields
authoralexpdp7 <alex@pdp7.net>
Fri, 21 Feb 2025 15:23:40 +0000 (15:23 +0000)
committeralexpdp7 <alex@corcoles.net>
Fri, 21 Feb 2025 15:24:27 +0000 (16:24 +0100)
programming/python/about_django.md

index 1cf3bd75aff5b9319946c3543f0edb153a793783..625597765cabd203457203221475cb1b4b56ea8c 100644 (file)
@@ -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.