Csv report From filtered Data in django
i have a search field in my django app and filtering Data work well . when i want get csv report , whole of record will be print in csv not filtered data . thank you for help me .
qs=EventkindofProblem.object.all()
MyFilter=eventfilter(request.GET,queryset=qs)
return djqscsv.render_to_csv_response(myFilter.qs,append_data_stamp=True)
Checklist
- is the filtered result expected to be
all()? then the filter is working normally. you should use arguments that can filter out the queryset. - is the filtered result expected to be
None? then you will need to overridedjango-filter>-2.0.0's behavior, since django-filter (from2.0.0) returns all if form is invalid or the filtered result is null. (how to override django-filter non-strict filtering: Prevent all data from being displayed with Django-filter)
it'd be helpful if you could provide more details about what you're trying to fix.
i fallow this link and become OK : https://forum.djangoproject.com/t/download-filtered-data-as-csv/10284