You have access control on views, but you also want to apply the same checks in templates in a maintainable way.
This kicked off my solution: https://stackoverflow.com/questions/43904784/reuse-the-decorator-of-a-view-from-a-template
| """ | |
| Check out STEAM Powered (https://steampoweredshow.com/) where I have conversations | |
| with women in STEAM to learn a bit about what they do and who they are. | |
| https://steampoweredshow.com/learn-more/ | |
| """ | |
| """ | |
| Requirements | |
| ************ |
You have access control on views, but you also want to apply the same checks in templates in a maintainable way.
This kicked off my solution: https://stackoverflow.com/questions/43904784/reuse-the-decorator-of-a-view-from-a-template
| # YMMV | |
| from django.conf import settings | |
| from django.contrib.auth.models import Group, Permission | |
| from django.core.management.sql import emit_post_migrate_signal | |
| from django.db import migrations, models | |
| import django.db.models.deletion | |
| import logging |
| // If you have multiple rules in your workflow that need to update token data. | |
| function (user, context, callback) { | |
| user.app_metadata = user.app_metadata || {}; | |
| const token_namespace = 'https://your-domain.com/app_metadata'; | |
| // assumes your metadata object is shallow | |
| const addCustomerId = stripe_customer_id => ({ | |
| ...context.idToken[token_namespace], |
| """ | |
| Check out STEAM Powered (https://steampoweredshow.com/) where I have conversations | |
| with women in STEAM to learn a bit about what they do and who they are. | |
| https://www.steampoweredshow.com/learn-more | |
| """ | |
| from pprint import pprint | |
| from collections import OrderedDict | |
| import sys | |
| import re |
| # From https://trac.cyberduck.io/ticket/7317 | |
| # | |
| # Should do it automatically, if it doesn't, check if ~/.config/filezilla/sitemanager.xml exists. | |
| # If it doesn't, create the directory, and | |
| cp ~/.filezilla/sitemanager.xml ~/.config/filezilla/sitemanager.xml | |
| defaults delete ch.sudo.cyberduck bookmark.import.de.filezilla | |
| # Relaunch Cyberduck |
| /* | |
| * Migrate Fontawesome 4 to Fontawesome 5 | |
| * @website https://www.litecart.net/ | |
| */ | |
| (function($){ | |
| var icons = { | |
| "fa-500px": "fab fa-500px", | |
| "fa-address-book-o": "far fa-address-book", | |
| "fa-address-card-o": "far fa-address-card", |
| type Dict = { [key: string]: number }; | |
| const hashtags: Dict = {}; | |
| Wordpress.anyNewPostWp.TagsAndCategories.split(',').map( | |
| s => hashtags['#' + s.toLowerCase().replace(/[\s-]+/g, '')] = 1 | |
| ); | |
| Buffer.addToBuffer.setMessage( | |
| Wordpress.anyNewPostWp.PostTitle + "\n" + | |
| Object.keys(hashtags).join(' ') + "\n" + |
| # Update the support arrays to include 5.5. | |
| brew_array=("5.5","5.6","7.0","7.1","7.2") | |
| php_array=("[email protected]" "[email protected]" "[email protected]" "[email protected]" "[email protected]") | |
| valet_support_php_version_array=("[email protected]" "[email protected]" "[email protected]" "[email protected]" "[email protected]") | |
| # Search for the `brew link --force "$php_version"` line, and replace it with this. | |
| if [[ $(echo "$php_version" | sed 's/^php@//' | sed 's/\.//') -lt 56 ]] | |
| then | |
| brew link --force --overwrite "$php_version" | |
| else |