changeset 1017:21c592cac71c

ManifestStaticFilesStorage: stop using form Media. It's okay for the admin, but not for user facing stuff.
author Brian Neal <bgneal@gmail.com>
date Sun, 06 Dec 2015 14:48:30 -0600
parents fd70e9d547ed
children 02ae9a4a846a
files bio/forms.py comments/forms.py downloads/forms.py forums/forms.py gcalendar/forms.py membermap/forms.py membermap/views.py messages/forms.py news/forms.py sg101/templates/bio/edit_profile.html sg101/templates/bio/member_search.html sg101/templates/downloads/add.html sg101/templates/forums/edit_post.html sg101/templates/forums/new_post.html sg101/templates/forums/new_topic.html sg101/templates/forums/topic.html sg101/templates/gcalendar/event.html sg101/templates/membermap/index.html sg101/templates/news/submit_news.html
diffstat 19 files changed, 50 insertions(+), 111 deletions(-) [+]
line wrap: on
line diff
--- a/bio/forms.py	Sun Dec 06 13:22:09 2015 -0600
+++ b/bio/forms.py	Sun Dec 06 14:48:30 2015 -0600
@@ -51,15 +51,6 @@
             'profile_text', 'hide_email', 'signature', 'time_zone',
             'use_24_time', 'auto_favorite', 'auto_subscribe')
 
-    class Media:
-        css = {
-            'all': (settings.GPP_THIRD_PARTY_CSS['markitup'] +
-                settings.GPP_THIRD_PARTY_CSS['jquery-ui'])
-        }
-        js = (settings.GPP_THIRD_PARTY_JS['markitup'] +
-            settings.GPP_THIRD_PARTY_JS['jquery-ui'] +
-            ['js/bio.js', 'js/timezone.js'])
-
     def clean_time_zone(self):
         """Ensure the timezone is valid and will work with pytz.
 
@@ -145,12 +136,6 @@
     """
     username = forms.CharField(max_length=30, widget=AutoCompleteUserInput())
 
-    class Media:
-        css = {
-          'all': settings.GPP_THIRD_PARTY_CSS['jquery-ui']
-        }
-        js = settings.GPP_THIRD_PARTY_JS['jquery-ui']
-
     def clean_username(self):
       username = self.cleaned_data['username'].strip()
       try:
--- a/comments/forms.py	Sun Dec 06 13:22:09 2015 -0600
+++ b/comments/forms.py	Sun Dec 06 14:48:30 2015 -0600
@@ -79,12 +79,3 @@
                 raise forms.ValidationError(str(ex))
 
         return comment
-
-    class Media:
-        css = {
-            'all': (settings.GPP_THIRD_PARTY_CSS['markitup'] +
-                settings.GPP_THIRD_PARTY_CSS['jquery-ui']),
-        }
-        js = (settings.GPP_THIRD_PARTY_JS['markitup'] +
-                settings.GPP_THIRD_PARTY_JS['jquery-ui'] +
-                ['js/comments.js'])
--- a/downloads/forms.py	Sun Dec 06 13:22:09 2015 -0600
+++ b/downloads/forms.py	Sun Dec 06 14:48:30 2015 -0600
@@ -4,7 +4,6 @@
 import os
 
 from django import forms
-from django.conf import settings
 
 from downloads.models import PendingDownload
 from downloads.models import AllowedExtension
@@ -28,11 +27,3 @@
     class Meta:
         model = PendingDownload
         fields = ('title', 'category', 'description', 'file')
-
-    class Media:
-        css = {
-            'all': (settings.GPP_THIRD_PARTY_CSS['markitup'] +
-                    settings.GPP_THIRD_PARTY_CSS['jquery-ui'])
-        }
-        js = (settings.GPP_THIRD_PARTY_JS['markitup'] +
-              settings.GPP_THIRD_PARTY_JS['jquery-ui'])
--- a/forums/forms.py	Sun Dec 06 13:22:09 2015 -0600
+++ b/forums/forms.py	Sun Dec 06 14:48:30 2015 -0600
@@ -5,7 +5,6 @@
 from collections import OrderedDict
 
 from django import forms
-from django.conf import settings
 
 from forums.models import Forum
 from forums.models import Topic
@@ -18,17 +17,6 @@
 from core.markup import site_markup
 
 
-FORUMS_FORM_CSS = {
-    'all': (settings.GPP_THIRD_PARTY_CSS['markitup'] +
-            settings.GPP_THIRD_PARTY_CSS['jquery-ui'])
-}
-FORUMS_FORM_JS = (
-    settings.GPP_THIRD_PARTY_JS['markitup'] +
-    settings.GPP_THIRD_PARTY_JS['jquery-ui'] +
-    ['js/jquery.form.min.js', 'js/forums.js']
-)
-
-
 class NewPostForm(forms.Form):
     """Form for creating a new post."""
     body = forms.CharField(label='',
@@ -37,10 +25,6 @@
     topic_id = forms.IntegerField(widget=forms.HiddenInput)
     topic = None
 
-    class Media:
-        css = FORUMS_FORM_CSS
-        js = FORUMS_FORM_JS
-
     def __init__(self, *args, **kwargs):
         super(NewPostForm, self).__init__(*args, **kwargs)
         attachments = args[0].getlist('attachment') if len(args) else []
@@ -95,10 +79,6 @@
     forum = None
     has_mod_fields = False
 
-    class Media:
-        css = FORUMS_FORM_CSS
-        js = FORUMS_FORM_JS
-
     def __init__(self, user, forum, *args, **kwargs):
         super(NewTopicForm, self).__init__(*args, **kwargs)
         self.user = user
@@ -176,10 +156,6 @@
         model = Post
         fields = ('body', )
 
-    class Media:
-        css = FORUMS_FORM_CSS
-        js = FORUMS_FORM_JS
-
     def __init__(self, *args, **kwargs):
         topic_name = kwargs.pop('topic_name', None)
         super(PostForm, self).__init__(*args, **kwargs)
--- a/gcalendar/forms.py	Sun Dec 06 13:22:09 2015 -0600
+++ b/gcalendar/forms.py	Sun Dec 06 14:48:30 2015 -0600
@@ -4,7 +4,6 @@
 import datetime
 import pytz
 from django import forms
-from django.conf import settings
 
 from gcalendar.models import Event
 
@@ -82,16 +81,6 @@
         fields = ('what', 'start_date', 'start_time', 'end_date', 'end_time',
             'all_day', 'time_zone', 'where', 'description', 'create_forum_thread')
 
-    class Media:
-        css = {
-            'all': (settings.GPP_THIRD_PARTY_CSS['markitup'] +
-                    settings.GPP_THIRD_PARTY_CSS['jquery-ui'] +
-                    ['css/gcalendar.css'])
-        }
-        js = (settings.GPP_THIRD_PARTY_JS['markitup'] +
-              settings.GPP_THIRD_PARTY_JS['jquery-ui'] +
-              ['js/timezone.js', 'js/gcalendar.js'])
-
     def __init__(self, *args, **kwargs):
         initial = kwargs.get('initial', {})
         instance = kwargs.get('instance', None)
--- a/membermap/forms.py	Sun Dec 06 13:22:09 2015 -0600
+++ b/membermap/forms.py	Sun Dec 06 14:48:30 2015 -0600
@@ -2,7 +2,6 @@
 Forms for the member map application.
 """
 from django import forms
-from django.conf import settings
 
 from membermap.models import MapEntry
 
@@ -16,12 +15,3 @@
     class Meta:
         model = MapEntry
         fields = ('location', 'message')
-
-    class Media:
-        css = {
-            'all': (settings.GPP_THIRD_PARTY_CSS['markitup'] +
-                    settings.GPP_THIRD_PARTY_CSS['jquery-ui'])
-        }
-        js = (settings.GPP_THIRD_PARTY_JS['markitup'] +
-              settings.GPP_THIRD_PARTY_JS['jquery-ui'])
-
--- a/membermap/views.py	Sun Dec 06 13:22:09 2015 -0600
+++ b/membermap/views.py	Sun Dec 06 14:48:30 2015 -0600
@@ -15,7 +15,6 @@
 
 from membermap.models import MapEntry
 from membermap.forms import MapEntryForm
-from bio.models import UserProfile
 
 CACHE_KEY = 'membermap_json'
 CACHE_TIMEOUT = 5 * 60
--- a/messages/forms.py	Sun Dec 06 13:22:09 2015 -0600
+++ b/messages/forms.py	Sun Dec 06 14:48:30 2015 -0600
@@ -108,14 +108,6 @@
         if receiver_opts.notify_email:
             notify_receiver(new_msg)
 
-    class Media:
-        css = {
-             'all': (settings.GPP_THIRD_PARTY_CSS['markitup'] +
-                        settings.GPP_THIRD_PARTY_CSS['jquery-ui'])
-        }
-        js = (settings.GPP_THIRD_PARTY_JS['markitup'] +
-                settings.GPP_THIRD_PARTY_JS['jquery-ui'])
-
 
 class OptionsForm(forms.ModelForm):
     class Meta:
--- a/news/forms.py	Sun Dec 06 13:22:09 2015 -0600
+++ b/news/forms.py	Sun Dec 06 14:48:30 2015 -0600
@@ -3,7 +3,6 @@
 
 """
 from django import forms
-from django.conf import settings
 
 from core.html import ImageCheckError
 from core.html import image_check
@@ -28,17 +27,6 @@
         model = PendingStory
         fields = ['title', 'category', 'short_markup']
 
-    class Media:
-        css = {
-            'all': (settings.GPP_THIRD_PARTY_CSS['markitup'] +
-                    settings.GPP_THIRD_PARTY_CSS['jquery-ui'])
-        }
-        js = (
-            settings.GPP_THIRD_PARTY_JS['markitup'] +
-            settings.GPP_THIRD_PARTY_JS['jquery-ui'] +
-            ['js/jquery.form.min.js']
-        )
-
     def clean_short_markup(self):
         md = self.cleaned_data['short_markup']
         self.html = None
--- a/sg101/templates/bio/edit_profile.html	Sun Dec 06 13:22:09 2015 -0600
+++ b/sg101/templates/bio/edit_profile.html	Sun Dec 06 14:48:30 2015 -0600
@@ -1,9 +1,13 @@
 {% extends 'bio/base.html' %}
 {% load bio_tags %}
 {% load elsewhere_tags %}
+{% load script_tags %}
+{% load static from staticfiles %}
 {% block title %}Edit Profile{% endblock %}
 {% block custom_js %}
-   {{ profile_form.media }}
+{% script_tags 'jquery-ui markitup' %}
+<script src="{% static "js/bio.js" %}"></script>
+<script src="{% static "js/timezone.js" %}"></script>
 {% endblock %}
 {% block content %}
 <div class="user_profile">
--- a/sg101/templates/bio/member_search.html	Sun Dec 06 13:22:09 2015 -0600
+++ b/sg101/templates/bio/member_search.html	Sun Dec 06 14:48:30 2015 -0600
@@ -1,7 +1,8 @@
 {% extends "base.html" %}
+{% load script_tags %}
 {% block title %}Member Search{% endblock %}
 {% block custom_js %}
-   {{ form.media }}
+{% script_tags 'jquery-ui' %}
 {% endblock %}
 {% block content %}
 <h2>Member Search</h2>
--- a/sg101/templates/downloads/add.html	Sun Dec 06 13:22:09 2015 -0600
+++ b/sg101/templates/downloads/add.html	Sun Dec 06 14:48:30 2015 -0600
@@ -1,11 +1,14 @@
 {% extends 'base.html' %}
 {% load downloads_tags %}
 {% load core_tags %}
+{% load script_tags %}
 {% block title %}Add Download{% endblock %}
 {% block custom_css %}
-{{ add_form.media }}
 <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/downloads.css" />
 {% endblock %}
+{% block custom_js %}
+{% script_tags 'jquery-ui markitup' %}
+{% endblock %}
 {% block content %}
 <h2>Downloads</h2>
 {% include 'downloads/navigation.html' %}
--- a/sg101/templates/forums/edit_post.html	Sun Dec 06 13:22:09 2015 -0600
+++ b/sg101/templates/forums/edit_post.html	Sun Dec 06 14:48:30 2015 -0600
@@ -1,7 +1,13 @@
 {% extends 'base.html' %}
 {% load forum_tags %}
+{% load script_tags %}
+{% load static from staticfiles %}
 {% block title %}Forums: Edit Post{% endblock %}
-{% block custom_js %}{{ form.media }}{% endblock %}
+{% block custom_js %}
+   {% script_tags 'jquery-ui markitup' %}
+   <script src="{% static "js/jquery.form.min.js" %}"></script>
+   <script src="{% static "js/forums.js" %}"></script>
+{% endblock %}
 {% block content %}
 {% forum_navigation topic "Edit Post" %}
 
--- a/sg101/templates/forums/new_post.html	Sun Dec 06 13:22:09 2015 -0600
+++ b/sg101/templates/forums/new_post.html	Sun Dec 06 14:48:30 2015 -0600
@@ -1,7 +1,13 @@
 {% extends 'base.html' %}
 {% load forum_tags %}
+{% load script_tags %}
+{% load static from staticfiles %}
 {% block title %}Forums: New Post{% endblock %}
-{% block custom_js %}{{ form.media }}{% endblock %}
+{% block custom_js %}
+   {% script_tags 'jquery-ui markitup' %}
+   <script src="{% static "js/jquery.form.min.js" %}"></script>
+   <script src="{% static "js/forums.js" %}"></script>
+{% endblock %}
 {% block content %}
 {% forum_navigation topic "New Post" %}
 
--- a/sg101/templates/forums/new_topic.html	Sun Dec 06 13:22:09 2015 -0600
+++ b/sg101/templates/forums/new_topic.html	Sun Dec 06 14:48:30 2015 -0600
@@ -1,7 +1,10 @@
 {% extends 'base.html' %}
 {% load forum_tags %}
+{% load script_tags %}
 {% block title %}Forums: New Topic{% endblock %}
-{% block custom_js %}{{ form.media }}{% endblock %}
+{% block custom_js %}
+   {% script_tags 'jquery-ui markitup' %}
+{% endblock %}
 {% block content %}
 {% forum_navigation forum "New Topic" %}
 
--- a/sg101/templates/forums/topic.html	Sun Dec 06 13:22:09 2015 -0600
+++ b/sg101/templates/forums/topic.html	Sun Dec 06 14:48:30 2015 -0600
@@ -3,13 +3,15 @@
 {% load forum_tags %}
 {% load core_tags %}
 {% load script_tags %}
+{% load static from staticfiles %}
 {% block title %}Forums: {{ topic.name }}{% endblock %}
 {% block custom_meta %}
    {% open_graph_meta_tags topic %}
 {% endblock %}
 {% block custom_js %}
-   {% script_tags 'imagesloaded' %}
-   {{ form.media }}
+   {% script_tags 'jquery-ui markitup imagesloaded' %}
+   <script src="{% static "js/jquery.form.min.js" %}"></script>
+   <script src="{% static "js/forums.js" %}"></script>
    {% include "forums/jump_box.js" %}
 <script type="text/javascript">
 //<![CDATA[
--- a/sg101/templates/gcalendar/event.html	Sun Dec 06 13:22:09 2015 -0600
+++ b/sg101/templates/gcalendar/event.html	Sun Dec 06 14:48:30 2015 -0600
@@ -1,8 +1,15 @@
 {% extends 'base.html' %}
 {% load core_tags %}
+{% load script_tags %}
+{% load static from staticfiles %}
 {% block title %}{{ title }}{% endblock %}
+{% block custom_css %}
+<link rel="stylesheet" href="{% static "css/gcalendar.css" %}" />
+{% endblock %}
 {% block custom_js %}
-{{ form.media }}
+{% script_tags 'jquery-ui markitup' %}
+<script src="{% static "js/timezone.js" %}"></script>
+<script src="{% static "js/gcalendar.js" %}"></script>
 {% endblock %}
 {% block content %}
 <div class="breadcrumbs"><a href="{% url 'gcalendar-index' %}">Calendar</a> &raquo; {{ title }}</div>
--- a/sg101/templates/membermap/index.html	Sun Dec 06 13:22:09 2015 -0600
+++ b/sg101/templates/membermap/index.html	Sun Dec 06 14:48:30 2015 -0600
@@ -1,11 +1,14 @@
 {% extends 'base.html' %}
 {% load core_tags %}
+{% load script_tags %}
 {% block title %}Member Map{% endblock %}
+{% block custom_css %}
+<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/membermap.css" />
+{% endblock %}
 {% block custom_js %}
 <script type="text/javascript" src="{{ STATIC_URL }}js/membermap.js"></script>
 <script src="https://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAql_1Xw9MGW3mOxzo8gLb3hSrh5-ALlu4lmYDsscYaAokjyRNqBRaVcqVr3jaDgMRVSK_3HydK9tYWw" type="text/javascript"></script>
-{{ form.media }}
-<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/membermap.css" />
+{% script_tags 'jquery-ui markitup' %}
 <script type="text/javascript">
 //<![CDATA[
 var mmapUser = {
--- a/sg101/templates/news/submit_news.html	Sun Dec 06 13:22:09 2015 -0600
+++ b/sg101/templates/news/submit_news.html	Sun Dec 06 14:48:30 2015 -0600
@@ -1,8 +1,11 @@
 {% extends 'news/base.html' %}
+{% load script_tags %}
+{% load static from staticfiles %}
 {% block title %}News: Submit News{% endblock %}
 {% if add_form %}
    {% block custom_js %}
-      {{ add_form.media }}
+      {% script_tags 'jquery-ui markitup' %}
+      <script src="{% static "js/jquery.form.min.js" %}"></script>
    {% endblock %}
 {% endif %}
 {% block submit-class %}class="active"{% endblock %}