Friday, February 22, 2013

Multi Client Django System

Dear Sirs,

Maybe this is a concept question, but here we go.

I'm doing test development to learn django and using admin for everything.

This is a Company/Employee/HeathInsurance CRUD system.

The main ideia is that I want to provide this for different companies and still not allow them to see each others registers.

A Django Admin user , should belong to Company or be associated with it somehow and only see the registers created by other members of the same company.

My question is Django Admin Groups from Auth Model would do the task or not.

I've thought about overriding save_mode and get the group to which the user belongs , then save it into some group field at HeathInsurance and Employee.

Then on admin.py thought about overriding the queryset and use a filter so you would only see registers from your company.

Is this feasible ? Is this the way?

Thanks everyone!

Best Regards,

Delcio

Here some model example
## models.py ##
class Company(models.Model):
    name = models.CharField(max_length=200, null=False)


class HeathInsurance(models.Model):
    nome = models.CharField(max_length=200, null=False)


class Employee(models.Model):
    name = models.CharField(max_length=200, null=False)
    company = models.ForeignKey(Company)
    health_insurance = models.ForeignKey(HeathInsurance)

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate