You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class StudentAchievementFilter(django_filters.FilterSet):
def __init__(self, data=None, queryset=None, user=None, *args, **kwargs):
super().__init__(data=data, queryset=queryset, *args, **kwargs)
if user.get_group == 'teacher':
del self.form.fields['teacher']
self.filters['student'].queryset = user.teacher.get_students
self.filters['team'].queryset = user.teacher.get_active_teams
The issue arises when del self.form.fields['teacher'] is placed before updating the querysets for 'student' and 'team'. In this scenario, it seems that the changes to the querysets do not get properly initialized.
Placing the deletion of the 'teacher' field before updating the querysets might interfere with the initialization process, possibly due to the internal mechanics of how Django handles form fields and queryset modifications. As a result, the querysets for 'student' and 'team' are not initialized.
The text was updated successfully, but these errors were encountered:
The issue arises when
del self.form.fields['teacher']
is placed before updating the querysets for'student'
and'team'
. In this scenario, it seems that the changes to the querysets do not get properly initialized.Placing the deletion of the 'teacher' field before updating the querysets might interfere with the initialization process, possibly due to the internal mechanics of how Django handles form fields and queryset modifications. As a result, the querysets for 'student' and 'team' are not initialized.
The text was updated successfully, but these errors were encountered: