You are not logged in.

Change Language:

Freelancer? Consultant? Check out: WorkTrail - Time Tracking made easy
Profile for delcio

Name delcio
Email Address n/a
Posts1
  • Multi Client Django Admin System
    Board » Django » Models
    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)


Powered by Sphene Community Tools