Add is_featured boolean property to the Work model, so that Works can be
designated as "featured" items in various places in the UI. This will be
used to allow Sponsors, Programs, and Organizations to select Documents that
should be included in their sidebar menus.
Perhaps featured "site" Documents, such as site-wide Terms of Service,
should probably be listed below the "User (sign-out)" menu, since the User
will have to read and agree to these before being allowed to use the site.
A collapsable Javascript sidebar is probably going to be needed soon...
Patch by: Todd Larsen
Review by: to-be-reviewed
"""Pages in Django can are served up with custom HTTP headers containing usefulinformation about those pages -- namely, the content type and object ID.This module contains utility functions for retrieving and doing interestingthings with these special "X-Headers" (so called because the HTTP spec demandsthat custom headers are prefixed with "X-").Next time you're at slashdot.org, watch out for X-Fry and X-Bender. :)"""def populate_xheaders(request, response, model, object_id): """ Adds the "X-Object-Type" and "X-Object-Id" headers to the given HttpResponse according to the given model and object_id -- but only if the given HttpRequest object has an IP address within the INTERNAL_IPS setting or if the request is from a logged in staff member. """ from django.conf import settings if (request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS or (hasattr(request, 'user') and request.user.is_authenticated() and request.user.is_staff)): response['X-Object-Type'] = "%s.%s" % (model._meta.app_label, model._meta.object_name.lower()) response['X-Object-Id'] = str(object_id)