[Answer]-Django user injection in model properties

0๐Ÿ‘

โœ…

Iโ€™ve resolved it in a less elegant way, but it worked for me.

Iโ€™ve created a sort of singleton in my User defined class, with a property that i set in every view i need it.

The property is User.current.

Then, inside the models, where i need that i get the current user looking in User.current.

๐Ÿ‘คapelliciari

1๐Ÿ‘

Write custom template tags that take the user and set a context variable to indicate presence or absence of the criterion.

Leave a comment