permanent

Permanent PowerShell variable

筅森魡賤 提交于 2019-12-01 17:58:52
Is there a way to define a variable in PowerShell so when I open up a new PowerShell window, it'll keep the same value? I'll need this variable to keep its value, because I'll be needing to reboot my server every now and then, and I don't want to lose these values. JaredPar Have you considered other alternate sources for storing the variable? Variables in PowerShell are generally meant to persist only as long as the PowerShell session itself. However there are several other sources that PowerShell can easily query that are meant to persist longer. In particular the registry and file system.

How can I implement a global, implicit filter in Django admin?

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-28 10:27:58
A lot of my models have a foreign key to a "Company" model. Every logged in user can be part of one or more companies (User m2m Company, not null). I would like the current admin user to have "Company goggles" on, i.e. a select list, on the admin index page or maybe the base header, where they can switch their "current" Company. Doing that should automatically apply a "company equals" filter - for models that have a foreign key to Company - in addition to any other filters. What's the best way to achieve this? NB: This is meant as a comfort function for the admin interface, actual protection