This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| help: | |
| @echo "Please use 'make <target> [<target>...]' where <target> is one of" | |
| @echo | |
| @echo " Cleaning" | |
| @echo " ========" | |
| @echo | |
| @echo " clean -- to clean EVERYTHING" | |
| @echo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| A test suite use for research&development and that demonstrate an issue with | |
| 'dict_to_tree' | |
| It has been started with custom Node object sample: | |
| https://bigtree.readthedocs.io/en/latest/others/tips.html#population-node-add-functionality-method-property | |
| Opposed to original sample the percentage attribute have been disabled else it causes | |
| "division by zero" and prevent to make demonstration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <form action="/sample/" method="post"> | |
| {% csrf_token %} | |
| {% if form.non_field_errors %}{% spaceless %} | |
| <div class="non_field_errors">{{ form.non_field_errors }}</div> | |
| {% endspaceless %}{% endif %} | |
| {% for field in form %} | |
| <div class="{{ field.html_name }}__container"> | |
| {% for error in field.errors %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.contrib import admin | |
| from django.utils.translation import gettext_lazy as _ | |
| from ..choices import get_language_choices, get_language_default | |
| class DeprecatedLanguageListFilter(admin.SimpleListFilter): | |
| """ | |
| Add Human-readable language title as defined in LANGUAGES setting. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import datetime | |
| import json | |
| from pathlib import Path | |
| class ExtendedJsonEncoder(json.JSONEncoder): | |
| """ | |
| Additional opiniated support for more basic object types. | |
| Usage sample: :: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python2 | |
| # -*- coding: utf-8 -*- | |
| """ | |
| A script to extract installed packages versions from a Buildout project. | |
| Install | |
| ******* | |
| This is a "one man army" script without specific requirements. Just drop the file in | |
| your project and use it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Command line script to rename media files. | |
| Prerequisite: | |
| * Python >= 3.6; | |
| * Unicode and Emoji fonts enabled in your terminal console; | |
| """ | |
| import json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class SmartFormatMixin(object): | |
| """ | |
| A mixin to inherit from a model so it will have a common helper | |
| methods to manage image formats. | |
| """ | |
| def media_format(self, mediafile): | |
| """ | |
| Common method to perform a naive check about image format using file | |
| extension. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Attempt to parse breakpoints to compare them in pixels | |
| """ | |
| from collections import OrderedDict | |
| base_font_size = 16 | |
| base_font_unit = "px" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| i18n utilities for our search app | |
| """ | |
| from django.conf import settings | |
| def get_best_field_language(multilingual_field, best_language): | |
| """ | |
| Pick the best available language from a multilingual field. |