tags:

views:

22

answers:

2

I'm looking to give super user access to users of a program I'm devving.

All the entities have a country id value, so i'm just lookign to hook up my user model to have a country ID

Looking at Django Auth, It should be nice and easy to add a super_user_country_id field.

However, how frowned upon is it to modify the core django classes?

Is there any easier way to go about this or?

+1  A: 

At the moment, the recommended way is to create a Profile model and link it to the User model with a OneToOneField or a ForeignKey (depending on your requirements). Here's a good tutorial on the topic.

The Django devs have repeatedly expressed their intent to make extending the User model more straightforward, but AFAIK, no concrete design has been proposed, yet.

piquadrat
Thanks! My boss and I are far more comfortable with an approach like this.
Philip
+1  A: 

Adding a custom UserProfile would be one way to go about this. UserProfile can link to Country and you can prevent users based on their UserProfile. I found James Bennett's article on extending the User model useful when I had a similar requirement.

It is generally not a good idea to patch auth (or other built in) classes. Custom patches can become a pain to maintain and keep up to date.

Manoj Govindan