Closed xmnlab closed 7 months ago
Hi @xmnlab
To restrict specific surveys by users or roles you can extending use views class. There will definitely be a lot of overriding.
for example on your project
from djf_surveys.views import SurveyListView
class NewSurveyListView(SurveyListView):
def dispatch(self, request, *args, **kwargs):
# your code to handle restrict roles
return super().dispatch(request, *args, **kwargs)
or get specific data by user
from djf_surveys.views import SurveyListView
class NewSurveyListView(SurveyListView):
def get_queryset(self):
queryset = super().get_queryset()
survey_by_user = queryset.filter(user=self.request.user)
return survey_by_user
and many thing you can do.
great! thank you so much. I will try that! appreciate your quick response.
Hi everyone!
first of all, this is a very nice and useful django project.
I would like to know if there is a way to restrict specific surveys by users or roles. if not, do you have any recommendation for extending this app in a way that I could do it?
All the best,