- Remove migrations for each app
- Run
makemigrationsfor each app - Remove each migration >
0001 - Edit each
0001_initialmigration - Remove operations distinct of
migrations.CreateModel - Remove fields of type
ForeignKeyFieldorManyToManyField - Clear dependencies = []
- Run
makemigrationsagain for each app - Edit each
0002migration and change each dependency for0001_initial
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
| # any_app/admin.py | |
| from django.contrib import admin | |
| from core.admin_mixins import ModelAdminMixin | |
| @admin.register(AnyModel) | |
| class AnyModelAdmin(ModelAdminMixin, admin.ModelAdminMixin): | |
| list_display = ['id', 'especial_display_with_request'] |
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
| // Reference: https://developers.google.com/apps-script/reference/calendar/calendar-app | |
| function sync(sources, target) { | |
| var start = new Date((new Date()).getTime() - 10 * 3600000 * 24); | |
| var end = new Date((new Date()).getTime() + 120 * 3600000 * 24); | |
| var targetCalendar = CalendarApp.getCalendarById(target); | |
| if (!targetCalendar) { | |
| return; | |
| } | |
| var targetEvents = targetCalendar.getEvents(start, end); |
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 IgnoreAllMigrations(dict): | |
| def __getitem__(self, key): | |
| return 'django.migrations_not_used' | |
| def __contains__(self, key): | |
| return True | |
| MIGRATION_MODULES = IgnoreAllMigrations() |
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
| """ | |
| Wrapper for loading templates from "templates" directories in the specified | |
| apps. | |
| >>> {% extends 'grappelli,admin:admin/change_list.html' %} | |
| """ | |
| import os | |
| import sys |
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
| exec 2> /dev/null | |
| original=`pwd` | |
| function history { | |
| d=$1 | |
| author=$2 | |
| for i in $(find . -type d -print -maxdepth 3); do | |
| cd "${i}" | |
| if [ -d ".git" ]; then | |
| h=`git rev-list --after "${d}T00:00:00" --before "${d}T23:59:59" --tags --branches --remotes --author=${author} --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' | sed '/^commit/ d'` |
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 os.path import splitext | |
| from django.core.exceptions import ValidationError | |
| from django.utils.translation import ugettext_lazy as _ | |
| from django.template.defaultfilters import filesizeformat | |
| class FileValidator(object): | |
| """ | |
| Validator for files, checking the size, extension and mimetype. |
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 unicodedata | |
| from django import template | |
| register = template.Library() | |
| @register.filter | |
| def remove_accents(value): | |
| nkfd_form = unicodedata.normalize('NFKD', unicode(value)) | |
| return u"".join([c for c in nkfd_form if not unicodedata.combining(c)]) |
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
| """qurl is a tag to append, remove or replace query string parameters from an url (preserve order)""" | |
| import re | |
| from django.template import Library, Node, TemplateSyntaxError | |
| from urlparse import urlparse, parse_qsl, urlunparse | |
| from django.utils.encoding import smart_str | |
| from urllib import urlencode | |
| register = Library() |
Author: Casey Duncan @iamnotcasey
This Javascript constructor with inheritance pattern is designed as a lightweight alternative to other methods I've seen while still providing a nice abstraction as a 13 line function that can be easily inlined into your code.
NewerOlder