pip install django-reversion
Add reversion to INSTALLED_APPS
INSTALLED_APPS = [
...
...
...
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).' |
# admin.py: admin action definition | |
def make_copy(self, request, queryset): | |
form = None | |
if 'apply' in request.POST: | |
form = CopyPageForm(request.POST) | |
if form.is_valid(): | |
issue = form.cleaned_data['issue'] |