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
def get_form_class(self):
"""
Returns a django Form suitable of validating the filterset data.
This method should be overridden if the form class needs to be
customized relative to the filterset instance.
"""
from collections import OrderedDict
fields = OrderedDict([
(name, filter_.field)
for name, filter_ in self.filters.items()])
**print("Output get_form_class fields " + str(fields))**
return type(str('%sForm' % self.__class__.__name__),
(self._meta.form,), fields)
@property
def form(self):
if not hasattr(self, '_form'):
Form = self.get_form_class()
if self.is_bound:
self._form = Form(self.data, prefix=self.form_prefix)
else:
self._form = Form(prefix=self.form_prefix)
**print("Output def form " + str(self._form))**
exit
return self._form
As you see i insert normal defs only i have insert 2 print.
First print from def get_form_class(self): shows me
Output get_form_class fields OrderedDict([('price', <django_filters.fields.RangeField object at 0x7f7402336a00>)])
This is what i expect. 'price' is fieldname... Wunderfull
Next print:
Output def form [invalid name]:
You can see when form is create now label have name [invalid name]
Why?
The text was updated successfully, but these errors were encountered:
Hello,
my Filter:
class ProductFilter(django_filters.FilterSet):
class Meta:
model = StockRecord
fields = ['price']
i extend Productfilter with this defs:
As you see i insert normal defs only i have insert 2 print.
First print from def get_form_class(self): shows me
Output get_form_class fields OrderedDict([('price', <django_filters.fields.RangeField object at 0x7f7402336a00>)])
This is what i expect. 'price' is fieldname... Wunderfull
Next print:
Output def form [invalid name]:
You can see when form is create now label have name [invalid name]
Why?
The text was updated successfully, but these errors were encountered: