This file contains hidden or 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
# -*- coding: utf-8 -*- | |
import math | |
def center_geolocation(geolocations): | |
""" | |
Provide a relatively accurate center lat, lon returned as a list pair, given | |
a list of list pairs. | |
ex: in: geolocations = ((lat1,lon1), (lat2,lon2),) | |
out: (center_lat, center_lon) |
This file contains hidden or 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 django.conf import settings | |
from django.core.urlresolvers import is_valid_path | |
from django.http import HttpResponseRedirect | |
from django.middleware.locale import LocaleMiddleware | |
from django.utils.translation import ( | |
activate as activate_language, | |
deactivate as deactivate_language, | |
get_language, | |
get_language_from_path | |
) |
This file contains hidden or 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 django.core import serializers | |
from django.db.models import get_app, get_models | |
from django.db.models.query import QuerySet | |
def export_filer_models(output_file=None): | |
""" | |
Exports filer models to output_file. | |
""" | |
app = get_app('filer') |
This file contains hidden or 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
lsof +L1 | grep 'deleted' | awk '{print $2}' | xargs kill -9 |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
from django_select2.widgets import Select2MultipleWidget | |
class ReadonlySelect2MultipleWidget(Select2MultipleWidget): | |
def render_inner_js_code(self, id_, *args): | |
""" | |
Renders all the JS code required for this widget. | |
:return: The rendered JS code which will be later enclosed inside ``<script>`` block. |
This file contains hidden or 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 django.contrib.admin.util import label_for_field | |
from hvad.admin import TranslatableAdmin as BaseTranslatableAdmin | |
class TranslatableAdmin(BaseTranslatableAdmin): | |
""" | |
Translation friendly admin base class. | |
Allows user to display translated fields in the admin changelist. | |
""" |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
from re import match, findall, DOTALL | |
from os import listdir | |
from os.path import dirname, abspath | |
from unipath import Path | |
import yaml |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
""" | |
Sample script for mws api. | |
""" | |
import csv | |
from collections import OrderedDict | |
from mws import mws | |
# A module containing the API credentials |
NewerOlder