From 5b5cf7424c027e2d6f7ba429203da944e3a7e95a Mon Sep 17 00:00:00 2001 From: Marcio Mazza Date: Thu, 16 Mar 2017 16:42:43 -0300 Subject: [PATCH] Simplifica upload_to da logo da CasaLegislativa --- sapl/base/migrations/0001_initial.py | 2 +- sapl/base/models.py | 10 +--------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/sapl/base/migrations/0001_initial.py b/sapl/base/migrations/0001_initial.py index bcd9ae29d..dd61fdcf5 100644 --- a/sapl/base/migrations/0001_initial.py +++ b/sapl/base/migrations/0001_initial.py @@ -66,7 +66,7 @@ class Migration(migrations.Migration): ('uf', models.CharField(choices=[('AC', 'Acre'), ('AL', 'Alagoas'), ('AP', 'Amapá'), ('AM', 'Amazonas'), ('BA', 'Bahia'), ('CE', 'Ceará'), ('DF', 'Distrito Federal'), ('ES', 'Espírito Santo'), ('GO', 'Goiás'), ('MA', 'Maranhão'), ('MT', 'Mato Grosso'), ('MS', 'Mato Grosso do Sul'), ('MG', 'Minas Gerais'), ('PR', 'Paraná'), ('PB', 'Paraíba'), ('PA', 'Pará'), ('PE', 'Pernambuco'), ('PI', 'Piauí'), ('RJ', 'Rio de Janeiro'), ('RN', 'Rio Grande do Norte'), ('RS', 'Rio Grande do Sul'), ('RO', 'Rondônia'), ('RR', 'Roraima'), ('SC', 'Santa Catarina'), ('SE', 'Sergipe'), ('SP', 'São Paulo'), ('TO', 'Tocantins'), ('EX', 'Exterior')], max_length=100, verbose_name='UF')), ('telefone', models.CharField(blank=True, max_length=100, verbose_name='Telefone')), ('fax', models.CharField(blank=True, max_length=100, verbose_name='Fax')), - ('logotipo', models.ImageField(blank=True, upload_to=sapl.base.models.get_casa_media_path, verbose_name='Logotipo')), + ('logotipo', models.ImageField(blank=True, upload_to='sapl/casa/logotipo/', verbose_name='Logotipo')), ('endereco_web', models.URLField(blank=True, max_length=100, verbose_name='HomePage')), ('email', models.EmailField(blank=True, max_length=100, verbose_name='E-mail')), ('informacao_geral', models.TextField(blank=True, max_length=100, verbose_name='Informação Geral')), diff --git a/sapl/base/models.py b/sapl/base/models.py index 640bb7d52..8825ea2a4 100644 --- a/sapl/base/models.py +++ b/sapl/base/models.py @@ -13,14 +13,6 @@ SEQUENCIA_NUMERACAO = (('A', _('Sequencial por ano')), ('U', _('Sequencial único'))) -def get_sessao_media_path(instance, subpath, filename): - return './sapl/casa/%s/%s' % (subpath, filename) - - -def get_casa_media_path(instance, filename): - return get_sessao_media_path(instance, 'Logotipo', filename) - - @reversion.register() class CasaLegislativa(models.Model): # TODO ajustar todos os max_length !!!! @@ -41,7 +33,7 @@ class CasaLegislativa(models.Model): max_length=100, blank=True, verbose_name=_('Fax')) logotipo = models.ImageField( blank=True, - upload_to=get_casa_media_path, + upload_to='sapl/casa/logotipo/', verbose_name=_('Logotipo')) endereco_web = models.URLField( max_length=100, blank=True, verbose_name=_('HomePage'))