This file contains 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
1c1 | |
< r""" | |
--- | |
> """ | |
3a4,5 | |
> form http://pydoc.net/Python/sympy/0.7.1/sympy.physics.wigner/ | |
> | |
12,13c14 | |
< References | |
< ~~~~~~~~~~ |
This file contains 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
''' We are facing a problem. | |
tl;dr: We want to add a new table to the database, without losing previous data. | |
On adding a new model to models.py, syncdb doesn't create the table. However, if we create a new db, it works. | |
This is surprising, because we didn't think that adding a new table is a 'schema migration' that syncdb cannot handle. | |
Hence, we don't think South will help here. | |
Is there something I'm missing/getting wrong? | |
This file contains 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 lettuce import before, after, world | |
from splinter.browser import Browser | |
from django.test.utils import setup_test_environment, teardown_test_environment | |
from django.core.management import call_command | |
from django.db import connection | |
from django.conf import settings | |
from django.test.simple import DjangoTestSuiteRunner | |
from django.contrib.auth.models import User | |
import logging |
This file contains 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 __future__ import unicode_literals | |
''' | |
About __future__ from the docs: | |
------------------------------- | |
1. A future statement is a directive to the compiler that a particular module should be compiled using | |
syntax or semantics that will be available in a specified future release of Python. | |
2. The future statement is intended to ease migration to future versions of Python that introduce | |
incompatible changes to the language. | |
3. It allows use of the new features on a per-module basis before the release in |
This file contains 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
########################## LICENCE ############################### | |
# Copyright (c) 2005-2012, Michele Simionato | |
# All rights reserved. | |
# Redistribution and use in source and binary forms, with or without | |
# modification, are permitted provided that the following conditions are | |
# met: | |
# Redistributions of source code must retain the above copyright |
This file contains 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
Demo |
This file contains 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
<div ng-controller="ExampleCtrl1"> | |
<div ng-repeat="book in books"> | |
{{ $index+1 }} {{ book }} | |
</div> | |
</div> |
This file contains 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 fabric.api import env, local, run, require, cd, sudo | |
import os | |
from fabric.context_managers import cd | |
env.project_name = 'weight' | |
def prod(): | |
"Use the actual webserver" |
This file contains 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 Template(object): | |
def __init__(self, template_string, origin=None, name=None): | |
try: | |
template_string = force_text(template_string) | |
except UnicodeDecodeError: | |
raise TemplateEncodingError("Templates can only be constructed " | |
"from unicode or UTF-8 strings.") | |
if settings.TEMPLATE_DEBUG and origin is None: | |
origin = StringOrigin(template_string) | |
self.nodelist = compile_string(template_string, origin) |
This file contains 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
def compile_string(template_string, origin): | |
"Compiles template_string into NodeList ready for rendering" | |
if settings.TEMPLATE_DEBUG: | |
from django.template.debug import DebugLexer, DebugParser | |
lexer_class, parser_class = DebugLexer, DebugParser | |
else: | |
lexer_class, parser_class = Lexer, Parser | |
lexer = lexer_class(template_string, origin) | |
parser = parser_class(lexer.tokenize()) | |
return parser.parse() |
OlderNewer