Browse Source

Simplifica upload_to da logo da CasaLegislativa

pull/978/head
Marcio Mazza 8 years ago
parent
commit
5b5cf7424c
  1. 2
      sapl/base/migrations/0001_initial.py
  2. 10
      sapl/base/models.py

2
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')),

10
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'))

Loading…
Cancel
Save