-
Notifications
You must be signed in to change notification settings - Fork 430
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
Adding name col to CrontabSchedule model #478
Open
trianglesis
wants to merge
9
commits into
celery:main
Choose a base branch
from
trianglesis:master
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+89
−13
Open
Changes from 2 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
9be0fd7
Adding name col to CrontabSchedule model.
trianglesis 5eeb123
Adding name col to CrontabSchedule model.
trianglesis 27927ad
Adding name col to CrontabSchedule model. Add migrations.
trianglesis 58f1743
Adding name col to CrontabSchedule model. Add migrations. Generated b…
trianglesis d96af9c
Merge branch 'celery:master' into master
trianglesis 35ac4dc
django_celery_beat admin.py PeriodicTaskAdmin
b3ecccc
django_celery_beat admin.py PeriodicTaskAdmin
21de9a1
django_celery_beat admin.py PeriodicTaskAdmin
9bb7fa4
django_celery_beat admin.py PeriodicTaskAdmin
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -299,6 +299,13 @@ class CrontabSchedule(models.Model): | |
'Timezone to Run the Cron Schedule on. Default is UTC.'), | ||
) | ||
|
||
name = models.CharField( | ||
max_length=200, unique=False, | ||
null=True, blank=True, | ||
verbose_name=_('Name'), | ||
help_text=_('Short Description For This Cron Schedule'), | ||
) | ||
|
||
class Meta: | ||
"""Table information.""" | ||
|
||
|
@@ -308,10 +315,16 @@ class Meta: | |
'day_of_week', 'hour', 'minute', 'timezone'] | ||
|
||
def __str__(self): | ||
return '{0} {1} {2} {3} {4} (m/h/dM/MY/d) {5}'.format( | ||
|
||
name = None | ||
if self.name: | ||
name = '[{}]'.format(self.name) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here I wanted to achieve [Name in brackets], but leave an empty '' if there is no name. |
||
|
||
return '{0} {1} {2} {3} {4} (m/h/dM/MY/d) {5} {6}'.format( | ||
cronexp(self.minute), cronexp(self.hour), | ||
cronexp(self.day_of_month), cronexp(self.month_of_year), | ||
cronexp(self.day_of_week), str(self.timezone) | ||
cronexp(self.day_of_week), str(self.timezone), | ||
name if name else '', | ||
) | ||
|
||
@property | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would also like to have unit tests for new proposed changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't run any test from test_schedulers.py with the current setup.
Will try to figure out what am I doing wrong, and possibly add some tests.