Skip to content

Instantly share code, notes, and snippets.

View gustavi's full-sized avatar

Augustin LAVILLE gustavi

View GitHub Profile
@gustavi
gustavi / example.txt
Created August 17, 2018 10:59
explore dict
Python 2.7.13 (default, Nov 24 2017, 17:33:09)
[GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> def foo(path, struct):
... value = struct
... for x in path.split('.'):
... value = value[x]
... return value
...
>>> d = {'a': {'b': {'c': 42}, 'd': list()}}
@gustavi
gustavi / admin.py
Created September 3, 2018 07:19
Django - Use email as "username" field
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.utils.translation import gettext_lazy as _
from yourprojectname.member.models import User
@admin.register(User)
class EmailUserAdmin(UserAdmin):
"""