Feature flags admin #2435

Merged
merged 3 commits into from Aug 7, 2015

Projects

None yet

3 participants

@nickstenning
Member

Currently, the only way to change the values of feature flags is through the database. This is non-ideal.

This PR adds a very basic web interface for modifying feature flag configuration.

nickstenning added some commits Aug 7, 2015
@nickstenning nickstenning Support all flash types in the admin flashbar c0de002
@nickstenning nickstenning Link to the admin index from the page heading 229f224
@nickstenning nickstenning Add admin interface for feature flags
Currently, the only way to change the values of feature flags is through
the database. This is non-ideal.

This commit adds a very basic web interface for modifying feature flag
configuration.
e112bb0
@tilgovi tilgovi commented on the diff Aug 7, 2015
h/admin.py
@@ -16,6 +17,31 @@ def index(_):
return {}
+@view.view_config(route_name='admin_features',
+ request_method='GET',
+ renderer='h:templates/admin/features.html.jinja2',
+ permission='admin')
+def features_index(_):
+ return {"features": models.Feature.all()}
+
+
+@view.view_config(route_name='admin_features',
+ request_method='POST',
+ permission='admin')
+def features_save(request):
+ session.check_csrf_token(request)
@tilgovi
tilgovi Aug 7, 2015 Contributor

You can just use the check_csrf=True predicate on the view config. Not sure you need to test it at that point.

@nickstenning
nickstenning Aug 7, 2015 Member

You can, but that results in a 404 for the POST, which is a bit weird.

@tilgovi
tilgovi Aug 7, 2015 Contributor

Ah, fair enough. That's unfortunate.

@nickstenning
Member

screen shot 2015-08-07 at 18 23 26

@lenazun
Contributor
lenazun commented Aug 7, 2015

nice 🎌

@tilgovi tilgovi merged commit bbced7b into master Aug 7, 2015

3 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
coverage/coveralls Coverage decreased (-0.06%) to 64.081%
Details
@tilgovi tilgovi deleted the feature-flags-admin branch Aug 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment