Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

documentation or design issue? #114

Closed
Eagllus opened this issue Nov 10, 2015 · 4 comments
Closed

documentation or design issue? #114

Eagllus opened this issue Nov 10, 2015 · 4 comments

Comments

@Eagllus
Copy link
Collaborator

Eagllus commented Nov 10, 2015

For a scheduled task you give the example (first one).

# Use the schedule wrapper
from django_q.tasks import schedule

schedule('math.copysign',
         2, -2,
         hook='hooks.print_result',
         schedule_type=Schedule.DAILY)

However Schedule.DAILY is not imported here, so this should be

# Use the schedule wrapper
from django_q.tasks import schedule
from django_q.tasks import Schedule

schedule('math.copysign',
         2, -2,
         hook='hooks.print_result',
         schedule_type=Schedule.DAILY)

While your second example

# Or create the object directly
from django_q.models import Schedule

Schedule.objects.create(func='math.copysign',
                        hook='hooks.print_result',
                        args='2,-2',
                        schedule_type=Schedule.DAILY
                        )

Does idd only need the single import. I think it's more recommended to only use the second option

@Koed00
Copy link
Owner

Koed00 commented Nov 10, 2015

We can also write the first example like this:

# Use the schedule wrapper
from django_q.tasks import schedule

schedule('math.copysign',
         2, -2,
         hook='hooks.print_result',
         schedule_type='D')

@Eagllus
Copy link
Collaborator Author

Eagllus commented Nov 10, 2015

I think thats more recommended 😄
Want me to create a pull request for the change?

@Koed00
Copy link
Owner

Koed00 commented Nov 10, 2015

Yes please. I'm travelling so any help is welcome.

@Eagllus
Copy link
Collaborator Author

Eagllus commented Nov 10, 2015

pull request is up #115

@Eagllus Eagllus closed this as completed Nov 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants