Hi Djangoers,

I have a problem on my hands I'm not sure how to approach and would
appreciate your guidance.

I'm building a site that will host articles for separate businesses and
each business will have a user who needs to log in and administer article
that only belong to a particular business.

So, I have the following model:

class Business(models.Model):
    id = models.AutoField(primary_key=True)
    name = models.CharField("Business Name", max_length=50, blank=False)
    slug = models.SlugField("Slug", max_length=255, unique=True,
blank=False)
    ....

class StaffProfile(models.Model):
    user = models.ForeignKey(User, unique=True)

    id = models.AutoField(primary_key=True)
    ....
    business = models.ManyToManyField(Business)


class Article(models.Model):
    id = models.AutoField(primary_key=True)
    business = models.ForeignKey(Business, null=False)
    ....

So, every business will have a separate subdomain and will have a unique
slug.

Users can belong to one or more businesses and my StaffProfile extends the
Django's user class.

What I don't know is how to authenticate a user into a particular business,
so that this user only has access to the business they are logged into.

What I want them to do is to choose which business they want to log into on
the login and once they enter the username, password and select the
business I want them to be able to access articles that only belong to that
business and none of the articles that belong to those other businesses.

Any help or suggestions will be highly appreciated. Thanks guys!

Mario

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to