Self hosted FLOSS fitness/workout, nutrition and weight tracker
Use Django's media class on forms, not our own static_files
Roland Geider59a166d8d908
diff --git a/exercises/views.py b/exercises/views.pyindex b6514471d..0cd981c4c 100644--- a/exercises/views.py+++ b/exercises/views.py@@ -197,7 +197,6 @@ class ExercisesEditAddView(YamlFormMixin):'description']select_lists = ['category']- static_files = ['js/tinymce/tiny_mce.js']title = ugettext_lazy('Add exercise')custom_js = 'init_tinymce();'@@ -210,7 +209,10 @@ class ExercisesEditAddView(YamlFormMixin):language = load_language()category = ModelChoiceField(queryset=ExerciseCategory.objects.filter(language = language.id))class Meta:- model = Exercise+ model = Exercise++ class Media:+ js = {'js/tinymce/tiny_mce.js'}return ExerciseFormdiff --git a/manager/templates/form.html b/manager/templates/form.htmlindex 677751cd6..3ad47f04d 100644--- a/manager/templates/form.html+++ b/manager/templates/form.html@@ -3,9 +3,8 @@{% load staticfiles %}{% block header %}-{% for file in static_files %}- <script src="{% static file %}"></script>-{% endfor %}++{{ form.media }}{% if custom_js %}<script type="text/javascript">diff --git a/workout_manager/generic_views.py b/workout_manager/generic_views.pyindex 53a4f048a..0246bc1e7 100644--- a/workout_manager/generic_views.py+++ b/workout_manager/generic_views.py@@ -31,7 +31,6 @@ class YamlFormMixin(ModelFormMixin):form_fields = []active_tab = ''select_lists = []- static_files = []custom_js = ''form_action = ''form_action_urlname = ''@@ -65,9 +64,6 @@ class YamlFormMixin(ModelFormMixin):# another way of detecting themcontext['select_lists'] = self.select_lists- # List of additional JS static files, will be passed to {% static %}- context['static_files'] = self.static_files-# Custom JS code on form (autocompleter, editor, etc.)context['custom_js'] = self.custom_js