Skip to content

Commit ce2e675

Browse files
committed
Use the setting for a cleared media_format
1 parent 795c984 commit ce2e675

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tubesync/sync/forms.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11

22
from django import forms, VERSION as DJANGO_VERSION
3+
from django.conf import settings
34
from django.utils.translation import gettext_lazy as _
45

56
from .models import Source
@@ -29,6 +30,12 @@
2930
},
3031
)
3132

33+
def source_clean_media_format(self):
34+
data = self.cleaned_data.get('media_format', '').strip()
35+
return data or getattr(settings, 'MEDIA_FORMATSTR', settings.MEDIA_FORMATSTR_DEFAULT)
36+
37+
SourceForm.clean_media_format = source_clean_media_format
38+
3239
class ValidateSourceForm(forms.Form):
3340

3441
source_url = forms.URLField(

0 commit comments

Comments
 (0)