Skip to content

Commit

Permalink
Updates to make flake8 happy
Browse files Browse the repository at this point in the history
  • Loading branch information
dougharris committed Dec 23, 2022
1 parent e1dd53e commit 2d096c6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
11 changes: 7 additions & 4 deletions django_celery_beat/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ class PeriodicTaskAdmin(admin.ModelAdmin):
'classes': ('extrapretty', 'wide'),
}),
(_('Schedule'), {
'fields': ('interval', 'crontab', 'crontab_translation', 'solar', 'clocked',
'start_time', 'last_run_at', 'one_off'),
'fields': ('interval', 'crontab', 'crontab_translation', 'solar',
'clocked', 'start_time', 'last_run_at', 'one_off'),
'classes': ('extrapretty', 'wide'),
}),
(_('Arguments'), {
Expand All @@ -146,14 +146,16 @@ def crontab_translation(self, obj):

change_form_template = 'admin/djcelery/change_periodictask_form.html'

def changeform_view(self, request, object_id=None, form_url='', extra_context=None):
def changeform_view(self, request, object_id=None, form_url='',
extra_context=None):
extra_context = extra_context or {}
crontabs = CrontabSchedule.objects.all()
crontab_dict = {}
for crontab in crontabs:
crontab_dict[crontab.id] = crontab.human_readable
extra_context['readable_crontabs'] = crontab_dict
return super().changeform_view(request, object_id, extra_context=extra_context)
return super().changeform_view(request, object_id,
extra_context=extra_context)

def changelist_view(self, request, extra_context=None):
extra_context = extra_context or {}
Expand Down Expand Up @@ -260,6 +262,7 @@ class ClockedScheduleAdmin(admin.ModelAdmin):
'clocked_time',
)


class CrontabScheduleAdmin(admin.ModelAdmin):
list_display = ('__str__', 'human_readable')

Expand Down
4 changes: 2 additions & 2 deletions django_celery_beat/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,8 @@ class CrontabSchedule(models.Model):
max_length=64, default='*',
verbose_name=_('Day(s) Of The Week'),
help_text=_(
'Cron Days Of The Week to Run. Use "*" for "all", Sunday is 0 or 7, Monday is 1. '
'(Example: "0,5")'),
'Cron Days Of The Week to Run. Use "*" for "all", Sunday '
'is 0 or 7, Monday is 1. (Example: "0,5")'),
validators=[validators.day_of_week_validator],
)
day_of_month = models.CharField(
Expand Down

0 comments on commit 2d096c6

Please sign in to comment.