- admin_scripts
- views
- admin_changelist
- admin_inlines
- admin_views
- admin_widgets
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Document</title> | |
<link rel="stylesheet" href="style.css"> | |
<script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.5.min.js" type="text/javascript"></script> | |
</head> | |
<body> | |
<h1>Document</h1> |
from collections import defaultdict | |
data_file = '/Users/preston/Dropbox/data/A8306701_ta.txt' | |
emp_data = defaultdict(lambda: defaultdict(float)) | |
for line in open(data_file, 'r'): | |
data = line.split() | |
if len(data) != 3: | |
# print line |
This proposal presents a "middle ground" approach to improving and refactoring auth.User
, based around a new concept of "profiles". These profiles provide the main customization hook for the user model, but the user model itself stays concrete and cannot be replaced.
I call it a middle ground because it doesn't go as far as refactoring the whole auth app -- a laudable goal, but one that I believe will ultimately take far too long -- but goes a bit further than just fixing the most egregious errors (username length, for example).
This proposal vastly pare down the User model to the absolute bare minimum and defers all "user field additions" to a new profile system.
def softwrap(desc): | |
noprint = '​' | |
return ' '.join( | |
[noprint.join(list(x)) if (len(x) > 20) else x for x in desc.split()]) |
function softwrap(desc){ | |
var words = desc.split(" "); | |
var newText = ""; | |
for (var i = 0; i < words.length; i++) { | |
var aWord = words[i]; | |
console.log(aWord); | |
if (aWord.length > 20) { | |
aWord = aWord.replace(/(\S{2})/g,"$1​"); | |
} |
#!/usr/bin/env python | |
import sys | |
import os | |
import re | |
sys.path[0] = os.path.normpath(os.path.join(sys.path[0], '.')) | |
os.environ['DJANGO_SETTINGS_MODULE'] = "dummyproj.settings" | |
import inspect | |
from pprint import pprint | |
# https://github.com/django/django/commit/4f306a4c27c8537ca9cd966cea1c0de84aafda9e#django/db/__init__.py | |
# from django.conf import settings; settings.configure() |
class X(object): | |
if not self.foo | |
self.foo = self.some_func | |
property(self.foo) |
myfirstproject/ | |
django -> ./django-dist/django (symlink) | |
django-dist (full clone/dist) | |
manage.py | |
myfirstproject/ | |
settings.py etc | |
from __future__ import print_function | |
from lxml.html.soupparser import fromstring | |
import requests | |
from datetime import datetime, timedelta | |
start_date = datetime(2012, 8, 6) | |
end_date = start_date + timedelta(days=45) | |
url = 'http://www.reserveamerica.com/campsiteCalendar.do?page=calendar&contractCode=CA&parkId=120030&calarvdate={caldate}&sitepage=true&startIdx={page_index}&sitefilter=STANDARD' |