✨ - New feature
👾 - Bugfix
🎨 - UI and style
🔨 - Code refactoring, dependency upgrade, improving code quality
🚧 - Work in progress
| from tqdm import tqdm | |
| from myapp.models import MyModel | |
| progress_bar = tqdm(desc="Processing", total=MyModel.objects.count()) | |
| for obj in MyModel.objects.all(): | |
| obj.process() # do something time consuming | |
| progress_bar.update(1) | |
| progress_bar.close() |
| # -*- coding: UTF-8 -*- | |
| from __future__ import unicode_literals | |
| from ._base import * | |
| # ... | |
| class DisabledMigrations(object): | |
| def __contains__(self, item): | |
| return True | |
| def __getitem__(self, item): |
| {% blocktrans with username=request.user.username link=request.user.get_url_path css_class="btn btn-link" %} | |
| Hello <a href="{{ link }}" class="{{ css_class }}">{{ username }}</a>! | |
| {% endblocktrans %} |
✨ - New feature
👾 - Bugfix
🎨 - UI and style
🔨 - Code refactoring, dependency upgrade, improving code quality
🚧 - Work in progress
| SetEnvIf User-Agent ^VipAgent1 vip_agent | |
| SetEnvIf User-Agent ^VipAgent2 vip_agent | |
| Order Allow,Deny | |
| Allow from env=vip_agent | |
| AuthType Basic | |
| AuthName "Protected Login" | |
| AuthUserFile /path/to/htpasswd | |
| Require valid-user |
| # -*- coding: utf-8 -*- | |
| def emojis_to_html_entities(html): | |
| import re | |
| def replace_with_html_entity(match): | |
| # from something like "u'\U0001f60e'" get only "0001f60" | |
| codepoint = repr(match.group(0))[4:-1] | |
| return u'&#x{};'.format(codepoint) |
| {% load i18n %} | |
| <h1> | |
| {{ article.title }} | |
| {% if article.publishing_status == article.PUBLISHING_STATUS_DRAFT %}({% trans "draft" %}){% endif %} | |
| </h1> |
| # -*- coding: utf-8 -*- | |
| from PIL import Image | |
| def cleanup_exif(input_file_path, output_file_path): | |
| """ | |
| Remove EXIF information from an image | |
| """ | |
| image_file = open(input_file_path) |
| # -*- coding: utf-8 -*- | |
| from __future__ import unicode_literals | |
| from django.db import models | |
| class MyModelQuerySet(models.QuerySet): | |
| def published(self): | |
| return self.filter(is_published=True) |
| # -*- coding: UTF-8 -*- | |
| """ | |
| ANSI escape codes | |
| http://en.wikipedia.org/wiki/ANSI_escape_code | |
| """ | |
| EFFECTS = { | |
| 'reset': "\x1b[0m", |