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
jQuery(document).ready(function($) { | |
// Code using $ as usual goes here. | |
}); |
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
DATABASES = { | |
'default': { | |
'ENGINE': 'django.db.backends.sqlite3', | |
'NAME': os.path.join(PROJECT_ROOT, 'db.sqlite3'), | |
} | |
} |
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
# -*- coding: utf-8 -*- | |
from __future__ import unicode_literals, absolute_import, print_function |
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
DATABASES = { | |
'default': { | |
'ENGINE': 'django.db.backends.postgresql_psycopg2', | |
'NAME': 'myproject', | |
'USER': 'myprojectuser', | |
'PASSWORD': 'password', | |
'HOST': 'localhost', | |
'PORT': '', | |
} | |
} |
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 logging | |
logger = logging.getLogger(__name__) |
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.apps import apps | |
app_config = apps.get_app_config('mainApp') | |
LogLine = app_config.get_model('ModelName') |
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 os | |
from os.path import join, getsize | |
for root, dirs, files in os.walk('python/Lib/email'): | |
print root, "consumes", | |
print sum(getsize(join(root, name)) for name in files), | |
print "bytes in", len(files), "non-directory files" | |
if 'CVS' in dirs: | |
dirs.remove('CVS') # don't visit CVS directories |
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 jinja2 import Template | |
>>> template = Template('Hello {{ name }}!') | |
>>> template.render(name='John Doe') |
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
# -*- coding: utf-8 -*- | |
from __future__ import unicode_literals | |
import os | |
import datetime | |
import xlsxwriter | |
class XlsReport(object): | |
def __init__(self, file_name, base_path=""): | |
now = datetime.datetime.now() |
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 LinearMeterAdmin(admin.ModelAdmin): | |
list_display = ( | |
'section', | |
'spot_left_name', | |
'spot_left_bookable', | |
'spot_right_name', | |
'spot_right_bookable', | |
) | |
list_editable = ( |
NewerOlder