MCPcopy Create free account
hub / github.com/Dispatcharr/Dispatcharr / update

Method update

apps/epg/serializers.py:59–75  ·  view source on GitHub ↗
(self, instance, validated_data)

Source from the content-addressed store, hash-verified

57 return data
58
59 def update(self, instance, validated_data):
60 # Pop cron_expression before it reaches model fields
61 # If not present (partial update), preserve the existing cron from the PeriodicTask
62 if 'cron_expression' in validated_data:
63 cron_expr = validated_data.pop('cron_expression')
64 else:
65 cron_expr = ''
66 if instance.refresh_task_id and instance.refresh_task and instance.refresh_task.crontab:
67 ct = instance.refresh_task.crontab
68 cron_expr = f'{ct.minute} {ct.hour} {ct.day_of_month} {ct.month_of_year} {ct.day_of_week}'
69 instance._cron_expression = cron_expr
70 for attr, value in validated_data.items():
71 if attr == 'password' and not value:
72 continue
73 setattr(instance, attr, value)
74 instance.save()
75 return instance
76
77 def create(self, validated_data):
78 cron_expr = validated_data.pop('cron_expression', '')

Callers 11

_set_epg_source_statusFunction · 0.45
send_epg_updateFunction · 0.45
_refresh_epg_data_implFunction · 0.45
parse_channels_onlyFunction · 0.45
_create_programMethod · 0.45
_create_programMethod · 0.45
_create_programMethod · 0.45
_make_sd_sourceMethod · 0.45
MigrationClass · 0.45
copy_index_backwardFunction · 0.45

Calls 1

saveMethod · 0.45

Tested by 4

_create_programMethod · 0.36
_create_programMethod · 0.36
_create_programMethod · 0.36
_make_sd_sourceMethod · 0.36