-
Install and register the FreeTDS driver for unixODBC.
apt-get install tdsodbc odbcinst -i -d -f /usr/share/tdsodbc/odbcinst.ini -
(Optional) Test the DSN-less connection with pyodbc.
apt-get install python-pyodbc
>>> import pyodbc
| <html> | |
| <head> | |
| <style type="text/css"> | |
| table table { | |
| width: 600px !important; | |
| } | |
| table div + div { /* main content */ | |
| width: 65%; | |
| float: left; | |
| } |
Install and register the FreeTDS driver for unixODBC.
apt-get install tdsodbc
odbcinst -i -d -f /usr/share/tdsodbc/odbcinst.ini
(Optional) Test the DSN-less connection with pyodbc.
apt-get install python-pyodbc
>>> import pyodbc
| """Copyright (c) 2013-2014 Stephan Groß, under MIT license.""" | |
| from __future__ import unicode_literals | |
| import re | |
| from django import template | |
| from django.template import Node | |
| from django.utils import six | |
| from django.utils.encoding import force_text | |
| from django.utils.functional import allow_lazy |
| from contextlib import contextmanager | |
| from django.conf import settings | |
| from django.db import connection | |
| @contextmanager | |
| def no_queries_allowed(): | |
| """This is a helper method that makes it easier during development, by | |
| throwing an exception when any queries are made within its block. Using |
| #!/bin/sh | |
| # | |
| # Usage: ./redis-movekeys.sh [-h host] [-p port] [-n src] [-m dest] pattern | |
| # | |
| # Move keys matching pattern from the src Redis database to the | |
| # dest Redis database. | |
| set -e | |
| HOST="localhost" |
| #!/bin/sh | |
| # | |
| # Usage: ./redis-delkeys.sh [-h host] [-p port] [-n db] pattern | |
| # | |
| # Matches keys with the KEYS command matching pattern | |
| # and deletes them from the specified Redis DB. | |
| set -e | |
| HOST="localhost" |
Prerequisites:
Software components used:
| class GenericViewTest(TestCase): | |
| def setUp(self): | |
| self.client = Client() | |
| def assertGet(self, num_queries): | |
| with self.assertNumQueries(num_queries): | |
| response = self.client.get(self.url) | |
| self.assertEqual(response.status_code, 200) | |
| self.context = response.context |
| import re | |
| # List of format available on Youtube | |
| YOUTUBE_CHOICES = ("default", "hqdefault", "0", "1", "2") | |
| # Default image if no thumbnail is found | |
| NO_PREVIEW = "/static/img/no_preview.png" | |
| def get_video_thumbnail(url, version="hqdefault"): |
| class ViewManager(models.Manager): | |
| def bulk_create(self, *args, **kwargs): | |
| raise NotImplementedError | |
| def create(self, *args, **kwargs): | |
| raise NotImplementedError | |
| def get_or_create(self, *args, **kwargs): | |
| raise NotImplementedError |