Django manages media based on the following definitions:
BASE_DIR = /var/praekelt/telkom-spliceworks/
MEDIA_ROOT = "%s/media/" % BASE_DIR
sudo apt-get install putty-tools | |
#private keys | |
puttygen your_private_key.ppk -O private-openssh -o your_new_key | |
chmod 600 your_new_key | |
#public keys | |
puttygen your_public_key.ppk -O public-openssh | |
#based on answer at superuser |
from django.db.models import Sum | |
class AbsoluteSum(Sum): | |
name = 'AbsoluteSum' | |
template = '%(function)s(%(absolute)s(%(expressions)s))' | |
def __init__(self, expression, **extra): | |
super(AbsoluteSum, self).__init__( | |
expression, absolute='ABS ', output_field=IntegerField(), **extra) |
# views.py | |
from rest_framework import exceptions | |
from rest_framework import generics | |
from myapp import models | |
from myapp import serializers as ser | |
class MethodSerializerView(object): | |
''' |
from django.utils.functional import curry | |
class DetailsInline(admin.TabularInline): | |
model = Details | |
# formset = DetailsFormset | |
extra = 3 | |
def get_formset(self, request, obj=None, **kwargs): | |
initial = [] | |
if request.method == "GET": |
""" | |
https://gist.github.com/Azadehkhojandi/50eaae4cf20b21faef186f2c8ee97873 | |
""" | |
import hmac | |
import hashlib | |
import binascii | |
def create_sha256_signature(key, message): |
For earlier version whos suffering from versionlock syndrome. Please follow the instructions to rollback to older SSL interface. Do not alarm by the fallback ssl interface, they received security patches for vulnerability discovered.
Current version of apt-get wkhtmltopdf does not come with Qt patch. There are some issue going with both Qt patched and non-patched. Most common use case is compatible with the patched Qt.
# https://gist.github.com/althonos/6914b896789d3f2078d1e6237642c35c | |
[metadata] | |
name = {name} | |
version = file: {name}/_version.txt | |
author = Martin Larralde | |
author_email = martin.larralde@embl.de | |
url = https://github.com/althonos/{name} | |
description = {description} | |
long_description = file: README.md |
""" | |
Custom django checks. | |
H001: Field has no verbose name. | |
H002: Verbose name should use gettext. | |
H003: Words in verbose name must be all upper case or all lower case. | |
H004: Help text should use gettext. | |
H005: Model must define class Meta. | |
H006: Model has no verbose name. | |
H007: Model has no verbose name plural. |
import logging | |
from django.contrib.gis.db.backends.postgis.base import \ | |
DatabaseWrapper as PostgisDBWrapper | |
from django.db import ProgrammingError | |
from .schema import TimescaleSchemaEditor | |
logger = logging.getLogger(__name__) |