First of all, I’m sorry for messed up question here.
I’m a bit confused right now because of searching for this.
I’m trying to make a website to manage reservation schedule for the store chain.
So, I made branch management, timetable management and custom user model yet.
What I’ve done and want to make is this.
-
Information
- The ‘branch info’ here means branch name, open time, close time, count of equipment, address, phone number
- Timetable is consist of id, foreign key branch, is holiday or not, period, start time and end time
-
Done
- In my custom user model, each user is seperated into three.
- Superuser (the user whose boolean field ‘is_superuser’ is True and ‘is_staff’ is also True)
- Staff (the user whose only boolean field ‘is_staff’ is True)
- Normal user (the user whose all boolean fields above is ‘False’)
- Each user have the branch they are belonging to (foreign key ‘branch’).
- Even superuser have their branch and I made ‘Development’ branch for developer.
- In my custom user model, each user is seperated into three.
-
Want to make
- Each user except superuser can do
- View their own branch’s info
- View their own branch’s timetable
- View their own branch’s schedule.
- Staffs can do
- View, edit their own branch’s users’ info (normal user and other staffs)
- View, edit their own branch’s branch info (can’t delete)
- View, edit their own branch’s timetable
- View, add, edit, delete their own branch’s schedule
- Superusers can do
- In short, they can do everything.
- View, add, edit, delete all branches and branches’ info
- View, add, edit, delete all users and users’ info
- View, add, edit, delete all branches timetables
- View, add, edit, delete all branches schedules
- In short, they can do everything.
- Each user except superuser can do
What I think as solutions are these.
- Make each branch as group and give permissions by user, staff, superuser
- Make user, staff, superuser as group and filter object by branch as foreign key
When I made model for user and timetable, each model have branch as foreign key.
What I want to know is which one is applicable or have better solution and how to make it.