I’ve been trying for the past day or so to extend the user class in django to allow me to add other fields to the model. After lots of fiddling and help from the guys in #django, I’ve finally come up with something that works, so I thought I’d stick it in here for posterity (and to remind myself how to do it in the future).
Basically, you need to do the following in your model (sorry for lack of indentations)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
|
and now the vital part…. do NOT try to install this model from whatever app you have created it in, it won’t work. I tried countless times to make it work before it was pointed out that what I actually needed to do was this:
1
|
|
Obvious, when you think about it, huh?
Now it’s all pretty much working, the only remaining issue is that..
1
|
|
..does not work. This isn’t the end of the world, but if anyone has any thoughts, I’d be very pleased to hear them.