Instantly share code, notes, and snippets.

from rest_framework import serializers
from core.models import (AddressCountry, AddressState, AddressCity, AddressDistrict,
AddressZipCode, AddressUser)
class AddressCountrySerializer(serializers.ModelSerializer):
states = serializers.SerializerMethodField()
def get_states(self, obj):
class ProductTree(MPTTModel, TreeForeignKey):
name = models.CharField('nome', max_length=250)
description = models.TextField('descrição')
valid_from = models.DateField('inicio Validade')
valid_to = models.DateField('fim validade')
brand_id = models.IntegerField('brand')
created_by = models.IntegerField('criado por')
created_date = models.DateField('criado em')
modified_by = models.IntegerField('modificado por')

i3 Window Manager Cheat Sheet

$mod refers to the modifier key (alt by default)


  • startx i3 start i3 from command line
  • $mod+<Enter> open a terminal
  • $mod+d open dmenu (text based program launcher)
  • $mod+r resize mode ( or to leave resize mode)
  • $mod+shift+e exit i3
def generate_batch(generator, batch_size=10):
batch = []
for e in generator:
if len(batch) == batch_size:
yield batch
batch = []
if batch:
yield batch
View postdeactivate
# This hook is sourced after every virtualenv is deactivated.
# Put this file into ~/.envs/ directory
unalias manage
unalias test
unalias startapp
unalias runserver
unalias testm
unalias makemigrations
unalias migrate
View postactivate
# This hook is sourced after every virtualenv is activated.
# Put this file in the ~/.envs/ directory
alias manage="$VIRTUAL_ENV/bin/python $(pwd)/"
alias test="$VIRTUAL_ENV/bin/python $(pwd)/ test"
alias startapp="$VIRTUAL_ENV/bin/python $(pwd)/ startapp"
alias runserver="$VIRTUAL_ENV/bin/python $(pwd)/ runserver"
alias testm="$VIRTUAL_ENV/bin/python $(pwd)/ test --nomigrations"
alias makemigrations="$VIRTUAL_ENV/bin/python $(pwd)/ makemigrations"
alias migrate="$VIRTUAL_ENV/bin/python $(pwd)/ migrate"
View .zshenv
# Set Up of pyen and virtualenvwrapper
# export WORKON_HOME=~/.envs
# export PROJECT_HOME=~/Documentos/pythonprojects
# eval "$(pyenv init -)"
# pyenv virtualenvwrapper_lazy
# Alias
View .zshrc
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=/home/riverfount/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See
View .gitignore_global
# PyCharm Configurations
View .gitconfig
name = Vicente Marçal
email =
editor = vim
excludesfile = /home/riverfount/.gitignore_global
tool = vimdiff
status = auto