huiwenhw / django-calendar

Full calendar built using Django
https://www.huiwenteo.com/normal/2018/07/24/django-calendar.html
95 stars 40 forks source link

Adding/Editing Events should be visible only to Admin #4

Open sbkhbk opened 4 years ago

sbkhbk commented 4 years ago

Hello,

First of all, it's a great solution for my need. I was looking for exactly this type of calendar to solve my problem. But, one final step to make it better. I would like to know

  1. how to make add event & edit event visible only to admin user
  2. how to remove the link on the event? (i don't want that to be visible for everyone since it takes to edit event page)
BrendaH commented 4 years ago

1} Wrap the whole form inside an if checking user.is_staff 2) In the code where the link is made, put an if checking user.is_staff. If True you can output the link, if False you can just output the title.

Or you could just leave out the whole frontend adding of events and have the admin do that via the admin interface. Then you use the frontend only for displaying the events in a calendar. (That is my use case: just showing, not adding or editing in frontend)