Sunlight Foundation mini-app wrapper
Templates and helpers for Django and Flask. Built on Bootstrap 3.
A demo application that displays default styles can be run with
python demo_flask.py for Flask or
python demo_django.py for Django.
INSTALLED_APPS = ( ... 'sfapp', ... )
urlpatterns = patterns('', ... url(r'', include('sfapp.urls')), ... )
In your app:
from sfapp.blueprint import sfapp app.register_blueprint(sfapp)
To use the provided mini-app templates, extend
<framework> must be one of
If the full and sidebar templates do not meet your needs, you can implement your own
sfapp/<framework>/base-sidebar.html within your project. Make sure that your custom versions both extend
The following blocks are provided by the base templates:
container : A generic container that holds the content block and, if using the sidebar template, the sidebar block.
: The block that contains your main content. Uses full page width when extending
: A right-aligned sidebar block is available when extending
sfapp/<framework>/base-sidebar.html. To customize the placement or width of this block, implement a custom
title : Title of the page
og : Open Graph meta elements
css : link and style elements for CSS
head : Miscellaneous meta and other elements that belong in head
bodyclass : The content of the class attribute on the body element.
Mailing List Signup Form
Subscriptions for both frameworks are handled by the sfapp.mailinglist module. subscribe(email, zipcode, source=None) is the method that will invoke the subscription endpoint and return the response.
sfapp.urls contains a URL config that will handle form submissions to
/subscribe/. You can use a different URL by overriding the URL config in your own
urls.py. You can also customize the view by inheriting
from sfapp.views import SubscribeView class MySubscribeView(SubscribeView): pass # do something here urlpatterns = patterns('', ... url(r'^subscribe/$', MySubscribeView.as_view()), ... )
No customizations yet.