igorsimb / mp-monitor

Django app for scraping Wildberries
1 stars 0 forks source link

Clicking "Delete Interval" with no running intervals leads to `DoesNotExist` error #34

Closed igorsimb closed 9 months ago

igorsimb commented 1 year ago

Error

DoesNotExist
django_celery_beat.models.PeriodicTask.DoesNotExist: PeriodicTask matching query does not exist.

Problem lies in destroy_scrape_interval_task function. It does not check if a task even exists.

igorsimb commented 9 months ago

An easy solution could be hiding the "Delete Interval" button from the UI if no interval is running.

igorsimb commented 9 months ago

Eventually did both: removed the button from the front end and prevented accessing the delete interval view via a direct link (e.g. if user knows the exact urlpattern for the view).