diff --git a/tubesync/sync/migrations/0016_merge_0015_auto_20230213_0603_0015_auto_20230214_2052.py b/tubesync/sync/migrations/0016_merge_0015_auto_20230213_0603_0015_auto_20230214_2052.py new file mode 100644 index 0000000..8b7618b --- /dev/null +++ b/tubesync/sync/migrations/0016_merge_0015_auto_20230213_0603_0015_auto_20230214_2052.py @@ -0,0 +1,14 @@ +# Generated by Django 3.2.18 on 2023-02-18 10:49 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('sync', '0015_auto_20230213_0603'), + ('sync', '0015_auto_20230214_2052'), + ] + + operations = [ + ] diff --git a/tubesync/sync/models.py b/tubesync/sync/models.py index a438b5c..a40970f 100644 --- a/tubesync/sync/models.py +++ b/tubesync/sync/models.py @@ -34,7 +34,7 @@ class CustomCheckboxSelectMultiple(CheckboxSelectMultiple): ctx["multipleChoiceProperties"] = [] for _group, options, _index in ctx["optgroups"]: for option in options: - if not isinstance(value,list) and ( option["value"] in value.selected_choices or ( value.allow_all and value.all_choice in value.selected_choices ) ): + if not isinstance(value,str) and not isinstance(value,list) and ( option["value"] in value.selected_choices or ( value.allow_all and value.all_choice in value.selected_choices ) ): checked = True else: checked = False @@ -114,10 +114,19 @@ class CommaSepChoiceField(models.Field): if value is None: return "" if not isinstance(value,list): - print("?! CommaSepChoiceField -> ",value) return "" - return ",".join(value) + if self.all_choice not in value: + return ",".join(value) + else: + return self.all_choice + + def get_text_for_value(self, val): + fval = [i for i in self.possible_choices if i[0] == val] + if len(fval) <= 0: + return [] + else: + return fval[0][1] class Source(models.Model): ''' diff --git a/tubesync/sync/templates/sync/source.html b/tubesync/sync/templates/sync/source.html index 1668e3b..1b789ed 100644 --- a/tubesync/sync/templates/sync/source.html +++ b/tubesync/sync/templates/sync/source.html @@ -130,6 +130,39 @@ UUID UUID
{{ source.uuid }} + + {{ _("Embed thumbnail?") }}: + {{ _("Embed thumbnail?") }}
+ + + {{ _("Embed metadata?") }}: + {{ _("Embed metadata?") }}
+ + + + {{ _("SponsorBlock?") }}: + {{ _("Sponsorblock enabled?") }}
+ + + {% if source.enable_sponsorblock %} + + {{ _("What blocked?") }}: + {{ _("What blocked?") }}
+ {% if source.sponsorblock_categories.all_choice in source.sponsorblock_categories.selected_choices %} + {% for k,v in source.sponsorblock_categories.possible_choices %} + {{ v }}:
+ {% endfor %} + {% else %} + {% for c in source.sponsorblock_categories.selected_choices %} + {% for k,v in source.sponsorblock_categories.possible_choices %} + {% if k == c %} {{ v }}:
{% endif %} + {% endfor %} + {% endfor %} + {% endif %} +
+ + {% endif %} +