I am looking to provide superuser access to objects belonging to a specific country.
eg. Swedish SU can only control Swedish entities, etc.
However, I am new to django (taking on the old system) and I need a life cycle.
I would like to be able to specify a relationship table.
I already added userprofile and I have a new field called super_user_country_link = models.ForeignKey (SuperUserToCountry, blank = True, null = True)
and then under the new class
class SuperUserToCountry(models.Model):
user = models.ForeignKey(User)
country = models.ForeignKey(Country)
I plan to run a script, then add an entry for each superuser and give them a link to country 0 (i.e. no country => su shared). Then I can delete these entries, as I start to enter entries specific to a specific country, so later I can call (using at home as an example):
if user.is_superuser:
if user.get_profile().super_user_county_link.country == 0:
elsif user.get_profile().super_user_county_link.country == 0
else
pass
Therefore, looking at this, this should mean that I can list several countries against one user, right? Maybe I changed my mind, but does it look right?
I come from a php background, so I just slightly doubt how correct this is ...