For the task at hand, to filter users having a personal token, do so:
if only_users_with_personal_token:
users_list = users_list.select_related('personal_token')
This way is a little inconvenient and counterintuitive, but it is a mathematically correct model (one-to-one relation, as it is understood by Django). Don't expect mathematically correct DB relations to be quite intuitive.
Testing
Only tested that it compiles. We will test it together with the frontend, as testing now would be extra work that is not really necessary.
Description
I added
PersonalToken
model.For the task at hand, to filter users having a personal token, do so:
This way is a little inconvenient and counterintuitive, but it is a mathematically correct model (one-to-one relation, as it is understood by Django). Don't expect mathematically correct DB relations to be quite intuitive.
Testing
Only tested that it compiles. We will test it together with the frontend, as testing now would be extra work that is not really necessary.