This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import json | |
cars = json.loads(open('./fixtures/fipe_carro.json').read()) | |
tree = {} | |
for v in cars: | |
for name in v['translated_names']: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from django.forms import ModelForm | |
from django import forms | |
from django.contrib.auth.models import Group, User | |
class GroupAdminForm(ModelForm): | |
class Meta: | |
model = Group | |
group_users = forms.ModelMultipleChoiceField(label=u'Usuários deste Grupo', queryset=User.objects.all()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, uuid | |
from django.conf import settings | |
from django.db import models | |
from django.utils.encoding import smart_unicode, smart_str | |
class BannerFileField(models.FileField): | |
def pre_save(self, model_instance, add): | |
file = super(BannerFileField, self).pre_save(model_instance, add) | |
if not add: |