Skip to content

TaskTYpe Once should check that schedule time is set #270

Closed
@sliverc

Description

@sliverc

Describe the bug

I added a new task in the Django Admin. For TaskType is assigned "Run once". I did not assign any value at schedule time, assigned all other values and pressed saved.

An exception was then raised:

TypeError at /admin/scheduler/task/1/change/

'<' not supported between instances of 'str' and 'datetime.datetime'

To Reproduce
Steps to reproduce the behavior:

  1. Go to Django Admin
  2. Click on 'Tasks Scheduler" -> Tasks.
  3. Add a new task
  4. assign all required values, choose TaskType "Run once" and leave the schedule time empty
  5. Press "Save".

Expected behavior would be that when pressing save that I cannot save a task like this as it is invalid, and it shows me a message that I need to assign the schedule timed.

This I guess should be added to the Task.clean function see here https://github.com/django-commons/django-tasks-scheduler/blob/master/scheduler/models/task.py#L436

There it already checks for the other task types but not for "Run once"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions