Open caclement opened 6 months ago
Hello, Thank you for this. Yes the documentation is missing that
class MyReport(ReportView):
# ....
def get_form_kwargs(self):
kwargs = super().get_form_kwargs()
kwargs["request"] = self.request # send the request as a form kwarg, as you'd do in any CBV
return kwargs
class RequestLogForm(BaseReportForm, forms.Form):
# ...
def __init__(self, request, *args, **kwargs):
# special init signature to accept the request and attach it
self.request = request
# ....
Thanks ! It works perfectly. Awsome application by the way.
In the documentation it seems you managed to refer to self.request.user when creating customs filters.
https://django-slick-reporting.readthedocs.io/en/latest/topics/filter_form.html
However when I do it, I get an error :
The error is : AttributeError: 'ManagerForm' object has no attribute 'request'