Skip to content

Instantly share code, notes, and snippets.

@sxslex
sxslex / assert_rotation_image.py
Last active November 9, 2017 15:32
assert_rotation_image
# -*- coding: latin1 -*-
"""
Codigo para colocar uma imagem na orientacao correta.
"""
from PIL import Image
from PIL.ExifTags import TAGS
def get_exif(img):
info_exif = {}
@haxoza
haxoza / admin.py
Created April 17, 2015 09:03
Django custom user model & custom admin
from django.contrib import admin
from django.contrib.auth import admin as auth_admin
from .models import *
from forms import UserChangeForm, UserCreationForm
class UserAdmin(auth_admin.UserAdmin):
fieldsets = (
(None, {'fields': ('email', 'password')}),
('Personal info', {'fields': ('first_name', 'last_name', 'twitter', 'photo', 'event')}),
@riklomas
riklomas / adding-to-user-admin-form.py
Created August 6, 2010 15:01
How to add a field to the Django Admin Add User form using UserCreationForm. Add this to a admin.py and alter to whatever fields you'd like
# How to add a field to the Django Admin Add User form
# using UserCreationForm. Add this to a admin.py and alter
# to whatever fields you'd like
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
from django.contrib.auth.admin import UserAdmin
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.contrib import admin