0

I am new to Django and working on my first project in Django. I am providing a simpler example for my application where - I have 3 different types of users for the application.

  1. Teacher's Assistant - Schedules/plans the timetable and courses for the teacher depending on day's agenda
  2. Teacher - approves the items on the agenda and marks if an item on the schedule is completed
  3. Student - views the schedule of an individual teacher

Currently, I have this whole application ready with all its functionalities, where the assistant would create a timetable/schedule (ie., add/edit/delete various model objects which are subjects) for the teacher depending upon her courses and agenda for the class.

Currently, when the assistant, makes changes to the schedule (such as deletes, or edits an existing model object) these changes directly update the model object.

What I would want to achieve is that, only when the Assistant publishes the schedule, the teacher can approve and students should be able to view it, and the assistant should have his own version of the schedule where he can make changes and edits to it (These changes and edits should not be viewed by other two roles unless they are published). Currently, all the changes made by the Assistant are directly updated in the model objects and the same are rendered onto the pages of the Teacher and Student. I have only one model class for storing the information about the item being scheduled.

How can I design this? Any suggestions/documentation or piece of code would really help.

Thanks in advance!

Edit 1 : The only solution comes to my mind is when the Assistant hits the publish button, storing a copy of the model objects and rendering this copy onto the pages of other users? But how do I write this in Django?

8
  • One option could be to make two separate models -AssistantSchedule and TeacherSchedule with similar structure Commented Dec 9, 2019 at 18:53
  • If I understood your question well, you may use a boolean field publish in the schedule model, which may be approved as per your use and filter only schedules that have publish=True in your views when showing them to students. Commented Dec 9, 2019 at 18:57
  • @Abhyudai yes this actually makes sense, I was trying to think of an elegant way to avoid duplication of the same model. I am going to try implementing this real quick and see it's working. Thanks a lot ! Commented Dec 9, 2019 at 19:35
  • Thanks, @bhaskarc I am trying to see a way to eliminate soo much of duplication Commented Dec 9, 2019 at 19:35
  • 1
    Yes LinkedIn would be great www.linkedin.com/in/krushika29 We can connect here @Abhyudai Commented Dec 9, 2019 at 19:53

1 Answer 1

1

Add two extra variables (created_at and publish_flag) in the model. In view you will send the publish_tag=true and most recent created_at.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.