This function takes a pattern with groups and replaces them with the given args and/or kwargs. Example:
IMPORTANT: this code is NOT to use replacing Django's reverse function. The example below is just to illustrate how it works.
For a given pattern '/docs/(\d+)/rev/(\w+)/', args=(123,'abc') and kwargs={}, returns '/docs/123/rev/abc/'.
For '/docs/(?P<id>\d+)/rev/(?P<rev>\w+)/', args=() and kwargs={'rev':'abc', 'id':123}, returns '/docs/123/rev/abc/' as well.
When both args and kwargs are given, raises a ValueError.
This is a widget for decimal/money/currency fields on **Geraldo Reports**.
When you use Geraldo to write reports, decimal fields must be formatted using **get_value** lambda attribute, because ObjectValue doesn't know what mask you want to use.
With this widget, you just copy it into a common use Python file, import into your reports file and use it replacing ObjectValue on elements for fields you must be formatted as money format.
**Example:**
from geraldo import Report, ReportBand, ObjectValue
from utils.reports import DecimalObjectValue
class ReportCustomers(Report):
title = u'Customers List'
page_size = A4
class band_detail(ReportBand):
height = 0.5*cm
elements = [
ObjectValue(attribute_name='id', top=0.1*cm),
DecimalObjectValue(attribute_name='salary',
left=26.2*cm, top=0.1*cm, format='%0.03f'),
]
This is a widget for date/time fields on **Geraldo Reports**.
When you use Geraldo to write reports, date/time fields must be formatted using **get_value** lambda attribute, because ObjectValue doesn't know what mask you want to use.
With this widget, you just copy it into a common use Python file, import into your reports file and use it replacing ObjectValue on elements for fields you must be formatted as date/time format.
**Example:**
from geraldo import Report, ReportBand, ObjectValue, landscape
from utils.reports import DateTimeObjectValue
class ReportPhoneList(Report):
title = u'Phone List'
page_size = landscape(A4)
class band_detail(ReportBand):
height = 0.5*cm
elements = [
ObjectValue(attribute_name='id', top=0.1*cm),
DateTimeObjectValue(attribute_name='birth_date',
left=26.2*cm, top=0.1*cm, format='%m/%d/%Y'),
]