Let's say I have a simple Content model.py that looks like this:
# Content model
class Content(models.Model):
TYPE_CHOICES = (
('text', 'Text'),
('html', 'HTML'),
('image', 'Image'),
Yahoo! provides its GeoPlanet data as three separate TSV files, available for download here.
That's a database with some 17 million records:
Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
https://www.djangoproject.com/
So lets use Django to build a simple website - shall we.
This guide is based on the very informative discussion in this article: Using node_sqlite3 with Electron
Install sqlite3
npm install sqlite3 --save
| # coding: utf-8 | |
| '''Django command for getting info about template tags and filters within your project | |
| It suports two output formats: human readable (with extra doc) and vim quickfix format | |
| Usage: ./manage.py tag_info tag_or_filter_name | |
| ''' | |
| import os | |
| import sys |
| from django.db import models | |
| from wagtail.wagtailsnippets.models import register_snippet | |
| from wagtail.wagtailcore.models import Page | |
| from wagtail.wagtailadmin.edit_handlers import InlinePanel | |
| @register_snippet | |
| class Category(models.Model): | |
| """ |
| class LanguageMiddleware(object): | |
| """ | |
| Detect the user's browser language settings and activate the language. | |
| If the default language is not supported, try secondary options. If none of the | |
| user's languages are supported, then do nothing. | |
| """ | |
| def is_supported_language(self, language_code): | |
| supported_languages = dict(settings.LANGUAGES).keys() | |
| return language_code in supported_languages |
| function nestCollection(model, attributeName, nestedCollection) { | |
| //setup nested references | |
| for (var i = 0; i < nestedCollection.length; i++) { | |
| model.attributes[attributeName][i] = nestedCollection.at(i).attributes; | |
| } | |
| //create empty arrays if none | |
| nestedCollection.bind('add', function (initiative) { | |
| if (!model.get(attributeName)) { | |
| model.attributes[attributeName] = []; |