Skip to content

Instantly share code, notes, and snippets.

View wangonya's full-sized avatar
🎧
Wired in

Kelvin Wangonya wangonya

🎧
Wired in
View GitHub Profile
@wangonya
wangonya / README.md
Created January 20, 2022 12:27 — forked from jaredculp/README.md
Void Linux

Void Linux Macbook Air 2013

Flash installer:

$ dd if=void-live-x86_64-musl-20181111.iso of=/dev/X bs=1m

login as root:voidlinux

Base Install:

@wangonya
wangonya / conftest.py
Created June 26, 2021 05:10 — forked from jeroenbrouwer/conftest.py
Setting up django-tenant-schemas with a "fake" pytest tenant
from django.core.management import call_command
from django.db import connection
from tenant_schemas.utils import get_public_schema_name, get_tenant_model
import pytest
TenantModel = get_tenant_model()
def get_or_create_tenant(*, schema_name, migrate=True):
try:
@wangonya
wangonya / PrimaryKeyInObjectOutRelatedField.py
Created March 22, 2021 08:51 — forked from jmichalicek/PrimaryKeyInObjectOutRelatedField.py
Django Rest Framework RelatedField allows a PK for input but returns a fully serialized model in response
class PrimaryKeyInObjectOutRelatedField(relations.PrimaryKeyRelatedField):
"""
Django Rest Framework RelatedField which takes the primary key as input to allow setting relations,
but takes an optional `output_serializer_class` parameter, which if specified, will be used to
serialize the data in responses.
Usage:
class MyModelSerializer(serializers.ModelSerializer):
related_model = PrimaryKeyInObjectOutRelatedField(
queryset=MyOtherModel.objects.all(), output_serializer_class=MyOtherModelSerializer)
@wangonya
wangonya / README-Template.md
Created November 28, 2019 11:09 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites