Permalink
Browse files

Formatting and consistency change

  • Loading branch information...
Osmose committed Jun 17, 2011
1 parent c2c8cb4 commit b76fbd0c9628eae5d3cb8e28011b2d849973e690
@@ -2,6 +2,7 @@
from django import forms
from django.contrib import admin, messages
+from django.core.urlresolvers import reverse
from django.db import models
from django.http import HttpResponse, HttpResponseRedirect
from django.template.loader import render_to_string
@@ -76,8 +77,8 @@ def enable_selected_snippets(modeladmin, request, queryset):
def bulk_edit_dates(modeladmin, request, queryset):
selected = request.POST.getlist(admin.ACTION_CHECKBOX_NAME)
- return HttpResponseRedirect('/admin/bulkDateChange?ids=%s' %
- ','.join(selected))
+ url = '%s?ids=%s' % (reverse('admin_bulk_date_change'), ','.join(selected))
+ return HttpResponseRedirect(url)
bulk_edit_dates.short_description = "Edit start and end dates of selected " \
"snippets"
@@ -1,7 +1,3 @@
-"""
-Form classes
-"""
-
from django.forms import Form, DateTimeField, DateInput, CharField, widgets
@@ -14,5 +10,4 @@ class BulkDateForm(Form):
end_date = DateTimeField(label='End Date',
widget=DateInput(attrs={'class': 'datetime'}),
required=False)
- ids = CharField(required=True,
- widget=widgets.HiddenInput())
+ ids = CharField(required=True, widget=widgets.HiddenInput())
@@ -4,10 +4,10 @@
<link rel="stylesheet" type="text/css" href="/media/css/forms.css" />
<link rel="stylesheet" type="text/css" href="/site_media/jquery-ui-1.8.13.custom.css" />
<link rel="stylesheet" type="text/css" href="/site_media/jquery-ui-timepicker-addon.css" />
-<script type="text/javascript" src="/site_media/jquery-1.6.1.min.js"></script>
-<script type="text/javascript" src="/site_media/jquery-ui-1.8.13.custom.min.js"></script>
-<script type="text/javascript" src="/site_media/jquery-ui-timepicker-addon.js"></script>
-<script type="text/javascript" src="/site_media/adminBulkDateChange.js"></script>
+<script src="/site_media/jquery-1.6.1.min.js"></script>
+<script src="/site_media/jquery-ui-1.8.13.custom.min.js"></script>
+<script src="/site_media/jquery-ui-timepicker-addon.js"></script>
+<script src="/site_media/adminBulkDateChange.js"></script>
{% endblock %}
{% block content %}
View
@@ -4,17 +4,20 @@
from django.conf.urls.defaults import patterns, url
urlpatterns = patterns("homesnippets.views",
-
- # browser/components/nsBrowserContentHandler.js:911: const SNIPPETS_URL = "http://snippets.mozilla.com/" + STARTPAGE_VERSION + "/%NAME%/%VERSION%/%APPBUILDID%/%BUILD_TARGET%/%LOCALE%/%CHANNEL%/%OS_VERSION%/%DISTRIBUTION%/%DISTRIBUTION_VERSION%/";
- url(r'^(?P<startpage_version>[^/]+)/(?P<name>[^/]+)/(?P<version>[^/]+)/(?P<appbuildid>[^/]+)/(?P<build_target>[^/]+)/(?P<locale>[^/]+)/(?P<channel>[^/]+)/(?P<os_version>[^/]+)/(?P<distribution>[^/]+)/(?P<distribution_version>[^/]+)/$',
+ url(r'^(?P<startpage_version>[^/]+)/(?P<name>[^/]+)/(?P<version>[^/]+)/'
+ '(?P<appbuildid>[^/]+)/(?P<build_target>[^/]+)/(?P<locale>[^/]+)/'
+ '(?P<channel>[^/]+)/(?P<os_version>[^/]+)/(?P<distribution>[^/]+)/'
+ '(?P<distribution_version>[^/]+)/$',
'view_snippets', name='view_snippets', kwargs={'preview': False}),
- url(r'^preview/(?P<startpage_version>[^/]+)/(?P<name>[^/]+)/(?P<version>[^/]+)/(?P<appbuildid>[^/]+)/(?P<build_target>[^/]+)/(?P<locale>[^/]+)/(?P<channel>[^/]+)/(?P<os_version>[^/]+)/(?P<distribution>[^/]+)/(?P<distribution_version>[^/]+)/$',
+ url(r'^preview/(?P<startpage_version>[^/]+)/(?P<name>[^/]+)/'
+ '(?P<version>[^/]+)/(?P<appbuildid>[^/]+)/(?P<build_target>[^/]+)/'
+ '(?P<locale>[^/]+)/(?P<channel>[^/]+)/(?P<os_version>[^/]+)/'
+ '(?P<distribution>[^/]+)/(?P<distribution_version>[^/]+)/$',
'view_snippets', name='preview_snippets', kwargs={'preview': True}),
- url(r"^base64encode/(?P<url>.+)$", "base64_encode", name="base64_encode"),
- url(r"^admin/bulkDateChange$",
- "admin_bulk_date_change",
- name="admin_bulk_date_change"),
- url(r"^$", "index", name="index"),
+ url(r'^base64encode/(?P<url>.+)$', 'base64_encode', name='base64_encode'),
+ url(r'^admin/bulk_date_change$', 'admin_bulk_date_change',
+ name='admin_bulk_date_change'),
+ url(r'^$', 'index', name='index'),
)
View
@@ -13,8 +13,8 @@
from django.template import RequestContext
from django.views.decorators.cache import cache_control
-from homesnippets.models import Snippet
from homesnippets.forms import BulkDateForm
+from homesnippets.models import Snippet
HTTP_MAX_AGE = getattr(settings, 'SNIPPET_HTTP_MAX_AGE', 1)
@@ -23,7 +23,7 @@
@cache_control(public=True, max_age=HTTP_MAX_AGE)
def index(request):
- """Render the index page, simulating about:home"""
+ """Render the index page, simulating about:home."""
return render_to_response('index.html', {},
context_instance=RequestContext(request))
@@ -43,7 +43,7 @@ def handler404(request):
def view_snippets(request, **kwargs):
- """Fetch and render snippets matching URL segment args"""
+ """Fetch and render snippets matching URL segment args."""
preview = kwargs['preview']
snippets = Snippet.objects.find_snippets_with_match_rules(kwargs)
@@ -80,7 +80,7 @@ def view_snippets(request, **kwargs):
@staff_member_required
def base64_encode(request, **kwargs):
- """Encode a remote image to base64, and output as JSON"""
+ """Encode a remote image to base64, and output as JSON."""
url = kwargs['url']
try:
@@ -95,7 +95,7 @@ def base64_encode(request, **kwargs):
@staff_member_required
def admin_bulk_date_change(request, **kwargs):
- """Show a custom form to bulk-change snippet start and end dates"""
+ """Show a custom form to bulk-change snippet start and end dates."""
if request.method == 'POST':
form = BulkDateForm(request.POST)

0 comments on commit b76fbd0

Please sign in to comment.