Skip to content

Instantly share code, notes, and snippets.

View gilsondev's full-sized avatar
💼
Work

Gilson Filho gilsondev

💼
Work
View GitHub Profile

How to migrate using south.

Lets say we got two apps: common and specific:

myproject/
|-- common
|   |-- migrations
|   |   |-- 0001_initial.py
|   |   `-- 0002_create_cat.py
# install Pillow on Mac
CFLAGS=-I/usr/X11/include/freetype2/ pip install Pillow
@gilsondev
gilsondev / views_delete.py
Created March 13, 2014 02:10
Class based view created to ignore confirm delete page
class CourseDelete(DeleteView):
model = Course
success_url = reverse_lazy('app:success_url')
def get(self, *args, **kwargs):
"""Override to ignore confirm delete page"""
return self.post(*args, **kwargs)
@gilsondev
gilsondev / laravel_project.sh
Last active January 1, 2016 06:39
Script created to facilitate the creation of a project laravel using composer.
#!/bin/bash
# File: laravel_project.sh
# Description: Script created to facilitate the creation of a project laravel using composer.
#
# Use: ./laravel_project <project name>
#
green='\e[0;32m' # '\e[1;32m' is too bright for white bg.
endColor='\e[0m'
@gilsondev
gilsondev / README.md
Last active December 31, 2015 01:29 — forked from myaser/README.md

Testing abstract models

a TestCase subclass to help you test your abstract django models

usage:

1- subclass your django abstract models

@gilsondev
gilsondev / gist:7379549
Created November 8, 2013 23:57 — forked from jacobh/gist:2842966
Template used for form fields with twitter bootstrap
{% for field in form %}
<div class="control-group {% if field.errors %}error{% endif %}">
<label class="control-label" for="{{ field.html_name }}">{{ field.label }}</label>
<div class="controls">
{{ field }}
{% if field.errors %}
<span class="help-inline">{{ field.errors|first }}</span>
{% endif %}
{% if field.help_text %}
<p class="help-block">{{ field.help_text }}</p>
@gilsondev
gilsondev / settings.py
Created October 21, 2013 23:01
Configurações de projetos django que usa variáveis de ambiente para armazenar os valores. Recomendável para Heroku principalmente.
# -*- coding: utf-8 -*-
import os
import dj_database_url
from unipath import Path
PROJECT_PATH = Path(__file__).parent
@gilsondev
gilsondev / command_cat.rst
Created October 15, 2013 19:31
Inserir conteúdo em arquivo usando comando cat e comando de redirecionamento

Usando cat e redirecionamento para inserir texto

Use da seguinte forma:

$ echo cat <<EOF > .env
> DEBUG=True
> PORT=8000
> EOF
@gilsondev
gilsondev / settings_storages_s3.py
Last active December 25, 2015 15:19
Configuração para projetos Django com uso da Amazon S3 usando django-storages
INSTALLED_APPS = (
# Django apps
# Third-party apps
'storages',
# Project apps
)
@gilsondev
gilsondev / aula01.html
Created February 28, 2013 18:14
Exercicio do curso de HTML da faculdade
<html>
<head>
<title>EAD-HTML Aula nro 1</title>
</head>
<body>
<p>Sejam bem vindos ao Curso EAD de Análise e Desenvolvimento de Software.</p>
</body>
</html>