Commit graph

24 commits

Author SHA1 Message Date
15ce31eedb
Further switch to relative imports 2023-10-20 09:54:35 +11:00
47a30a750a
Sort Python imports with isort 2023-10-20 09:52:39 +11:00
9e39d7eadc
Apply pyupgrade --py36-plus (but skip f-strings as we're on Python 3.5) 2023-09-07 23:15:48 +10:00
6b1ed75d7a
Handle UnicodeEncodeErrors from junk URLs. 2022-03-15 10:59:47 +11:00
2d078b0004
Apply futurize --stage-2 Python 2/3 compatibility transformations.
These changes specifically require the use of the "future" library.
2021-11-30 07:55:45 +11:00
69725698ae
Fix a encoding issues for future Python 3 support. 2021-11-26 12:41:27 +11:00
26ff31bb78
progress bar: Drop JS, make mobile friendly, match design to new site.
The existing jQuery UI-based fundraising progress bar used a float layout,
making it hard to adapt for mobile use. Given that there is not interactivity,
I've dropped all the JS and switched to a flexbox layout. This works well
because the bar will stretch to fit the text rather than always maintaining its scale.
2021-11-16 13:25:39 +11:00
Brett Smith
a00195c8f6 static.views: Deduplicate code.
The primary goal here is to get templates rendered more like our "regular"
templates, by using more of the standard tools to do so rather than roll our
own.

* Use TemplateResponse. This requires less boilerplate and ensures the
  rendering runs through our local context processors.
* Use the existing definition of fundgoal_lookup.
2018-11-20 11:58:34 -05:00
Brett Smith
4ca9ac1463 static: Update sitefundgoal for these pages too. 2018-11-20 10:38:46 -05:00
Brett Smith
cf5b073d44 urls: Route /error/NNN/ to static.views.handler.
Since our Apache configuration uses `ErrorDocument NNN /error/NNN/`,
this is necessary to return the correct status code in those cases.
2016-12-05 21:43:51 -05:00
Brett Smith
58e22337b0 static: Errors return proper HTTP response code. 2016-12-05 21:15:01 -05:00
Brett Smith
3fe5f09d18 static: Remove hardcoded path. 2016-12-05 21:14:45 -05:00
Brett Smith
3705a2ba1d static: Re-fix path manipulation in index.
* Strip any leading / to treat it as a relative path.
* Append `index.html` before converting to bytes.
2016-11-03 10:58:23 -04:00
Brett Smith
93787dc820 static: Don't try to render non-template files as templates. 2016-11-03 10:34:01 -04:00
Brett Smith
6b1b3b8f2e static: Encode paths as UTF-8 before translating to the filesystem. 2016-11-03 10:34:01 -04:00
Brett Smith
39314c254e static: Use built-in methods for path manipulation. 2016-11-02 16:45:34 -04:00
Bradley M. Kuhn
b48b1ab1e5 Avoid query string passed along in rendering.
This middleware is a bit of a mess anyway, since it's basically using
static files as templates.  However, we definitely don't want to add any
GET query parameters rendered into the path name.
2015-12-07 12:24:58 -08:00
Bradley M. Kuhn
5c4cc1e2e1 Add sitefundgoal to top level view context.
The base template now has access to the fund-raising goal that will be
displayed site-wide.  The view here must provide it in the context for
access everywhere.

Furthermore, we need a local context processor to make sure it's in
context everywhere, and we have to make sure that context is properly
passed along.

This code is a bit cargo-culted in, based on what I read in various
places about adding the Request context.
2015-11-30 19:19:46 -08:00
Bradley M. Kuhn
ab2239009a Rework again to see if I can get this corrected. 2015-03-08 23:40:47 -07:00
Bradley M. Kuhn
f64ff43450 Rework to simply call with new kwargs.
Redo call so that I just get my own at call time.
2015-03-08 23:36:38 -07:00
Bradley M. Kuhn
f8f37dd39c Must move import as well. 2015-03-08 23:31:44 -07:00
Bradley M. Kuhn
b3f019265b Rework fundgoal lookup urls data.
The urls.py is of course only evaluated once: at Apache load time, which
means the data in the template became stale and is not dynamic.

This change should cause the lookup to happen at each page view.
2015-03-08 23:28:42 -07:00
Bradley M. Kuhn
09654a5eac Fundraising goal lookup for template: 1st attempt
This seems to be the best approach to pass a fundraising goal record to
a template.  While the static hack that tmarble implemented probably
needs work anyway, this is probably the best way currently to interface
certain general data that we seek to place on many different pages
through the templates.

I looked into a templatetags solution, but this seemed more
straightforward and more fitting with Django principles (I think :).
2015-03-08 20:46:37 -07:00
Tom Marble
2bf594b86c First pass at migration to Django 1.7 2015-03-03 18:40:18 +00:00