-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
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
python manage.py migrateThis raised the following exception
django.db.utils.OperationalError: no such table: myapp_peopleSo I think the issue lies here:
tutorial-django-crispy-range-slider/myproject/src/myapp/filters.py
Lines 17 to 31 in dfebe9d
| 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
Metadata
Metadata
Assignees
Labels
No labels