I'm now using django filter to get the queryset I want,here is my code:
students = Student.objects.filter(
sales=current_user,
nickname = form_data['nickname'],
mobile = form_data['mobile'],
gender = form_data['gender'],
state = form_data['state'],
source = form_data['source'],
register_at = form_data['register_at'],
importance = form_data['importance'],
remaining = form_data['remaining'],
level = form_data['level'],
feature = form_data['feature'],
company_name = form_data['company']
).order_by(register_order, remaining_order, level_order)
now the question is :some of my form data fields may be null, cause the forms are input by the user, and he/she can choose to just input some fields, I wonder if this code could work when some fields are null, if not, how to rewrite it to get the queryset based on the fields user inputs?