I have a model that holds user address. This model has to have first_name
and last_name
fields since one would like to set address to a recipient (like his company, etc.). What I'm trying to achieve is:
- If the
first_name
/last_name
field in the address is filled - return simply that field - If the
first_name
/last_name
field in the address is empty - fetch the corrresponding field data from a foreignkey pointing to a properdjango.auth.models.User
- I'd like this to be treated as normal Django field that would be present in fields lookup
- I don't want to create a method, since it's a refactoring and
Address.first_name
/last_name
are used in various places in the application (also in model forms, etc.), so I need this to me as smooth as possible, or else, I will have to tinker around in a lot of places.