When developing applications in Django, the need might arise to customize the user model. Specifically, you might want to create different types of users. In my case, I’m interested in creating a person user and a kit user. A person user can own multiple kit users, and both need to be able to authenticate to access an API. Luckily, Django’s authentication system is very flexible, and there are multiple ways to achieve this goal.
The standard way to implement this is to stick with the default user model,
django.contrib.auth.models.User, and create a complex user profile. The profile adds the desired fields and behaviors for the various user types in a new model, and links to the model through a field reference. This can get fairly complex quickly. It is especially difficult to express ownership of kits by users, without allowing ownership of users by users. Here, we will see how we can implement this using inheritance.
Continue reading “Creating Multiple Custom User Types Through Inheritance in Django”
Since building a new computer, my Windows 10 installation would sometimes crash. The error reported on the blue screen of death would always be page fault in nonpaged area. Interestingly, the system would be fine for months and then suddenly crash a few times per day — always when using Deluge, a torrent client. After some testing, it turned out that downloading a torrent with Deluge would reliably crash the system within an hour.
Debugging the crash minidump with Windows Debugger (WinDBG), it turned out the driver bcmwl63a was likely at fault. This driver is developed by Broadcom for 802.11 wireless network adapters. The driver was being used for my ASUS PCE-AC68 network adapter.
I was using version 7.35.338.0 of the Broadcom drivers for the adapter, supplied through the ASUS product utility version 22.214.171.124 that is available on the ASUS support website. The issue can be fixed by upgrading to version 7.35.351.0 of the Broadcom drivers, which ASUS supplies in version 126.96.36.199 of their utility. The issue can likely also be fixed by downgrading to version 188.8.131.52 (utility version 184.108.40.206), but I have not tested this. See this thread for more information.
First uninstall the old driver through Windows Device Manger (and uninstall the utility through the Control Panel, if installed). Then, instead of installing the new utility, I would recommend installing only the new driver (supplied in the same zip-file as the utility). This can be done manually in Device Manager by updating driver software for the PCE-AC68. Note that after uninstalling the old drivers, the adapter might show up as an unrecognized device, so be sure to check that if the PCE-AC68 is no longer present in the device list.
I was having trouble using suspend, hibernate and hybrid sleep functionality on Ubuntu 17.04 using Gnome 3.24. The troubles started immediately after installing the
I was hopeful and typed
systemctl hibernate, but the system got stuck on
After a hard shutdown, the system was no longer bootable. It would only boot in recovery after waiting for 5 minutes on
These issues were caused by having an encrypted swap file, but soon other issues surfaced, rooted in shaky support for hibernation in both Ubuntu and Gnome.
So, here’s a guide to how I set up hibernation.
Continue reading “Hibernation and Hybrid Sleep on Ubuntu 17.04, Gnome 3.24”