Skip to content

Instantly share code, notes, and snippets.

View melvyn-sopacua's full-sized avatar

Melvyn Sopacua melvyn-sopacua

View GitHub Profile
@melvyn-sopacua
melvyn-sopacua / fields.py
Created June 23, 2017 10:42
Inline form for a foreign key
from django.contrib.gis.db import models
from django.db.models.fields.related import (ForeignObject,
ForwardManyToOneDescriptor)
from .models import Address
def get_address(value: (Address, int, dict, None)) -> (Address, int, None):
if value is None:
return None
@melvyn-sopacua
melvyn-sopacua / getwoonplaatsen.py
Last active September 26, 2017 12:31
Get all cities in The Netherlands using official dataset and merge them into a single GML file.
import argparse
import os
import sys
import warnings
import requests
from lxml import etree
MAX_COUNT = 1000
MAX_RESULTS = 2501 # hardcoded to save us doing parsing of numberMatched