pip install django-reversion
Add reversion to INSTALLED_APPS
INSTALLED_APPS = [
...
...
...
| # Here's your list of choices that would be displayed in a drop-down | |
| # element on the web. It needs to be a tuple, and we define this | |
| # as a variable just for readability/convenience. | |
| # | |
| # This example has 3 choices, each of which consists of two parts: | |
| # 1. the thing that get strored in your database | |
| # 2. the thing that you see in a dropdown list | |
| LABEL_CHOICES = ( | |
| ('this gets stored in your database', 'This item is what you see in the drop-down'), | |
| ('django', 'Django'), |
pip install django-reversion
Add reversion to INSTALLED_APPS
INSTALLED_APPS = [
...
...
...
| # The command finds the most recent tag that is reachable from a commit. | |
| # If the tag points to the commit, then only the tag is shown. | |
| # Otherwise, it suffixes the tag name with the number of additional commits on top of the tagged object | |
| # and the abbreviated object name of the most recent commit. | |
| git describe | |
| # With --abbrev set to 0, the command can be used to find the closest tagname without any suffix: | |
| git describe --abbrev=0 | |
| # other examples |
Warning This is SEVERELY outdated, the current jupyter version is > 6.X, please refer to your current jupyter notebook installation!
Disclaimer : I just copied those shortcuts from Jupyter Menú > Help > Keyboard Shortcuts, I didn't wrote them myself.
Check your current shortcuts in your Help, shortcuts coule have been modified by extensions or your past self.
| cordova plugin add https://github.com/brodysoft/Cordova-SQLitePlugin.git |
| from itertools import chain | |
| from operator import attrgetter | |
| # ascending oreder | |
| result_list = sorted( | |
| chain(queryset1, queryset2), | |
| key=attrgetter('date_created')) | |
| # descending order |
| # YOU MAY WANT TO CHECK THIS OUT: https://github.com/douglasmiranda/ddpt/blob/master/{{cookiecutter.django_project_name}}/{{cookiecutter.django_project_name}}/config/local.py | |
| # If you don't do this you will have to add the host IP in INTERNAL_IPS = ('127.0.0.1',) | |
| # And it will change, then you will have to change INTERNAL_IPS again. | |
| def show_toolbar(request): | |
| if request.is_ajax(): | |
| return False | |
| return True |
| ############################################################################## | |
| # | |
| # Simple Python program to benchmark several Python Excel writing modules. | |
| # | |
| # python bench_excel_writers.py [num_rows] [num_cols] | |
| # | |
| # | |
| import sys | |
| from time import clock |
| # -*- coding: utf-8 -*- | |
| """Add permissions for proxy model. | |
| This is needed because of the bug https://code.djangoproject.com/ticket/11154 | |
| in Django (as of 1.6, it's not fixed). | |
| When a permission is created for a proxy model, it actually creates if for it's | |
| base model app_label (eg: for "article" instead of "about", for the About proxy | |
| model). |
| from django import forms | |
| from django.core import validators | |
| from django.core.exceptions import ValidationError | |
| class MinLengthValidator(validators.MinLengthValidator): | |
| message = 'Ensure this value has at least %(limit_value)d elements (it has %(show_value)d).' | |
| class MaxLengthValidator(validators.MaxLengthValidator): | |
| message = 'Ensure this value has at most %(limit_value)d elements (it has %(show_value)d).' |