Django admin inline through one to one field - django

Item has foreign key to User and User has OneToOne to Profile.
I have admin for Profile. How can I show all items as inlines?
I do not have foreign key from Profile to Item, so I need something like user__itemset but it seems it can't be used in Django admin.

Related

Django - How to make admin not have own profile model

How to make the admin not have a profile created. I have a Profile, Relationships one to one model and want to exclude admin.

django admin search by foreign key in add form

In the form to add new objects in Django admin, sometimes there are linked foreign keys that are selectable in a dropdown. Is there a way to include a searchbox for the foreign keys within the form?
For example, let's say I have a Book model with a foreign key to Author object. Instead of scrolling through all the author ids when I create a new Book object, can I search for Author "James" specifically?
Use autocomplete fields in your custom admin.
Django Documentation - Autocomplete Fields

How to make a model's entries as a field.options list in other model's field?

I have two models - Account, like checking, wallet, credit, etc. and Transaction which includes each purchase and earning. Transaction has a foreign key to Account.
In Transaction, I want users to select the Account of purchase. I considered the field.choices but the choices are permanent.
I want users to select a choice of Account from Account models. How do I do that?
If you are using a django form for creating/updating transaction model objects, then it will default to a selection field with all of your Account model objects as options. Model foreign key fields default in django forms as a ModelChoiceField which will render to a template as <select>.

How to extend django admin user model with new fields?

I want to add more fields to django built in admin user model. How can I achieve it?
Actually , There are three users on django server, student , teacher and parent. And by adding a 'role' field to user model, I can identify which type of user is log-ged in . So how can I extend the model field.
I'm expecting to identify different role of users in login.

How to extend a user model without use profile method?

I want to add a column to django auth_user table. But I do not want to create a new table.
As the document peovided for extending User model, there are four ways.
proxy model
Add a oneToOne field
Creating a Custom User Model Extending AbstractUser
Creating a Custom User Model Extending AbstractBaseUser
It works some time. But How could I add a field to the auth user model it provied?