Browse Source

Etiquetas ajustadas.

0.2
Guilherme Gondim 15 years ago
parent
commit
09767ecfe1
  1. 40
      sigi/apps/casas/reports.py
  2. 4
      sigi/apps/casas/templates/casas/change_list.html

40
sigi/apps/casas/reports.py

@ -1,8 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import reporting from reportlab.lib.pagesizes import A4
from reportlab.lib.units import cm from reportlab.lib.units import cm
from geraldo import Report, ReportBand, Label, ObjectValue from geraldo import Report, DetailBand, Label, ObjectValue, ManyElements
from sigi.apps.casas.models import CasaLegislativa
class CasasLegislativasLabels(Report): class CasasLegislativasLabels(Report):
""" """
@ -15,24 +14,33 @@ class CasasLegislativasLabels(Report):
""" """
class band_detail(ReportBand): page_size = A4
width = 9.40*cm margin_top = 0.8*cm
height = 4.60*cm margin_bottom = 0.8*cm
margin_left = 0.4*cm
margin_right = 0.4*cm
class band_detail(DetailBand):
width = 9.9*cm
height = 5.6*cm
margin_bottom = 0.0*cm
margin_right = 0.3*cm
# With this attribute as True, the band will try to align in # With this attribute as True, the band will try to align in
# the same line. # the same line.
display_inline = True display_inline = True
default_style = {'fontName': 'Helvetica', 'fontSize': 11}
elements = [ elements = [
Label(text='A Sua Excelência o(a) Senhor(a)', top=0, left=0), Label(
ObjectValue( text='A Sua Excelência o(a) Senhor(a)',
attribute_name='get_presidente_nome', top=1*cm, left=1*cm, width=9.4*cm,
top=0.5*cm, left=0, width=9.00*cm, ),
get_value=lambda obj: obj.get_presidente_nome(), ManyElements(
ObjectValue,
count=6,
attribute_name=('get_presidente_nome','nome','logradouro','bairro','municipio','cep'),
start_top=1.5*cm, height=0.5*cm, left=1*cm, width=9.4*cm,
), ),
ObjectValue(attribute_name='nome', top=1.0*cm, left=0, width=9.00*cm),
ObjectValue(attribute_name='logradouro', top=1.5*cm, left=0, width=9.00*cm),
ObjectValue(attribute_name='bairro', top=2*cm, left=0, width=9.00*cm),
ObjectValue(attribute_name='municipio', top=2.5*cm, left=0, width=9.00*cm),
ObjectValue(attribute_name='cep', top=3*cm, left=0, width=9.00*cm),
] ]

4
sigi/apps/casas/templates/casas/change_list.html

@ -1,10 +1,10 @@
{% extends "admin/change_list.html" %} {% extends "admin/change_list.html" %}
{% load i18n reporting_tags %} {% load adminmedia admin_list i18n reporting_tags %}
{% block object-tools %} {% block object-tools %}
{% if has_add_permission %} {% if has_add_permission %}
<ul class="object-tools"> <ul class="object-tools">
<li><a href="labels/{{ query_str }}">Etiquetas</a></li> <li><a href="labels/{{ query_str }}">Gerar etiquetas</a></li>
<li> <li>
<a href="add/{% if is_popup %}?_popup=1{% endif %}" class="addlink"> <a href="add/{% if is_popup %}?_popup=1{% endif %}" class="addlink">
{% blocktrans with cl.opts.verbose_name as name %}Add {{ name }}{% endblocktrans %} {% blocktrans with cl.opts.verbose_name as name %}Add {{ name }}{% endblocktrans %}

Loading…
Cancel
Save