Browse Source

Add crop funtionality to parliament pictures

Conflicts:
	requirements/producao.txt
	sigi/settings/base.py
producao
Marcio Mazza 10 years ago
parent
commit
c212c61663
  1. 2
      requirements/producao.txt
  2. 13
      sigi/apps/casas/admin.py
  3. 8
      sigi/apps/casas/models.py
  4. 11
      sigi/settings/base.py

2
requirements/producao.txt

@ -16,6 +16,8 @@ six==1.8.0
# retornar para ultima release assim que incluir nosso pull request (que ja foi aceito)
git+https://github.com/django-admin-bootstrapped/django-admin-bootstrapped.git
django-image-cropping==0.9
easy-thumbnails==2.2
# eh importante usar -e pois precisamos do modulo reporting do fonte que nao eh instalado
-e git://github.com/marinho/geraldo.git@868ebdce67176d9b6205cddc92476f642c783fff#egg=geraldo

13
sigi/apps/casas/admin.py

@ -2,22 +2,22 @@
from django.contrib import admin
from django.contrib.contenttypes import generic
from django.http import HttpResponseRedirect
from image_cropping import ImageCroppingMixin
from sigi.apps.casas.forms import CasaLegislativaForm
from sigi.apps.casas.models import CasaLegislativa, Presidente, Funcionario, TipoCasaLegislativa
from sigi.apps.casas.views import report_complete, labels_report, export_csv, \
labels_report_sem_presidente, report, \
adicionar_casas_carrinho
from sigi.apps.utils import queryset_ascii
from sigi.apps.contatos.models import Telefone
from sigi.apps.convenios.models import Convenio
from sigi.apps.mesas.models import Legislatura
from sigi.apps.diagnosticos.models import Diagnostico
from sigi.apps.inventario.models import Bem
from sigi.apps.servicos.models import Servico
from sigi.apps.mesas.models import Legislatura
from sigi.apps.metas.models import PlanoDiretor
from sigi.apps.ocorrencias.models import Ocorrencia
from sigi.apps.servicos.models import Servico
from sigi.apps.utils import queryset_ascii
class TelefonesInline(generic.GenericTabularInline):
@ -159,7 +159,7 @@ class OcorrenciaInline(admin.TabularInline):
can_delete = False
class CasaLegislativaAdmin(admin.ModelAdmin):
class CasaLegislativaAdmin(ImageCroppingMixin, admin.ModelAdmin):
form = CasaLegislativaForm
actions = ['adicionar_casas', ]
inlines = (TelefonesInline, PresidenteInline, FuncionariosInline, ConveniosInline, LegislaturaInline,
@ -178,8 +178,7 @@ class CasaLegislativaAdmin(admin.ModelAdmin):
'municipio', 'cep', 'pagina_web', 'email', 'ult_alt_endereco'),
}),
('Outras informações', {
'classes': ('collapse',),
'fields': ('observacoes', 'foto'),
'fields': ('observacoes', 'foto', 'recorte'),
}),
)
raw_id_fields = ('municipio',)

8
sigi/apps/casas/models.py

@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
import random
from unicodedata import normalize
from datetime import datetime
from django.db import models
from datetime import datetime
from django.contrib.contenttypes import generic
from django.db import models
from image_cropping import ImageRatioField
from sigi.apps.utils import SearchField
from sigi.apps.servidores.models import Servidor
from sigi.apps.utils import SearchField
class TipoCasaLegislativa(models.Model):
@ -79,6 +80,7 @@ class CasaLegislativa(models.Model):
height_field='foto_altura',
blank=True
)
recorte = ImageRatioField('foto', '400x300', verbose_name="Recorte", )
foto_largura = models.SmallIntegerField(editable=False, null=True)
foto_altura = models.SmallIntegerField(editable=False, null=True)
data_instalacao = models.DateField(u'Data de instalação da Casa Legislativa', null=True, blank=True)

11
sigi/settings/base.py

@ -71,6 +71,9 @@ INSTALLED_APPS = (
'django_extensions',
'googlecharts',
'treemenus',
'easy_thumbnails',
'image_cropping',
)
MIDDLEWARE_CLASSES = (
@ -118,3 +121,11 @@ TEST_RUNNER = None
# Validate arguments in django-dynamic-fixture
# http://django-dynamic-fixture.readthedocs.org/en/latest/more.html?highlight=ddf_validate_args#validate-arguments-new-in-1-5-0
DDF_VALIDATE_ARGS = True
from easy_thumbnails.conf import Settings as thumbnail_settings
THUMBNAIL_PROCESSORS = (
'image_cropping.thumbnail_processors.crop_corners',
) + thumbnail_settings.THUMBNAIL_PROCESSORS
IMAGE_CROPPING_SIZE_WARNING = True
IMAGE_CROPPING_THUMB_SIZE = (800, 600)

Loading…
Cancel
Save