Hi, thanks a lot for the tutorial :-)
I cloned the project to give it a try and stumbled upon an error when running the initial migration with
This raised the following exception
django.db.utils.OperationalError: no such table: myapp_people
So I think the issue lies here:
|
class AllRangeFilter(RangeFilter): |
|
def __init__(self, *args, **kwargs): |
|
super().__init__(*args, **kwargs) |
|
values = [p.age for p in People.objects.all()] |
|
min_value = min(values) |
|
max_value = max(values) |
|
self.extra['widget'] = CustomRangeWidget(attrs={'data-range_min':min_value,'data-range_max':max_value}) |
|
|
|
class PeopleFilter(FilterSet): |
|
age = AllRangeFilter() |
|
|
|
class Meta: |
|
model = People |
|
fields = ['age'] |
|
form = PeopleFilterFormHelper |
In line 26, the AllRangeFilter is instantiated. This causes a database query in line 20.
It seems like filters.py is imported when running the migration and thus the data base query is executed. I could work around the issue by temporarily commenting line 26.
Best regards,
Lars