kinderp / 3183 Goto Github PK
View Code? Open in Web Editor NEWmvc to pdf in a django style
mvc to pdf in a django style
Same or similar code is present in table_view.TableView
create a function to avoid repetitions.
render_header()
class_name = getattr(self.model, elem).__class__.__name__
if elem in self.style_header and class_name == 'TextField':
# atm header style con be applied only to TextField
# type. ( and class_name == 'TextField )
style_name = self.style_header[elem]['style']
commands = self.style_header[elem]['commands']
my_style = Styles.style(style=style_name,
commands=commands)
new_row.append(getattr(self.model,
elem).render(style=my_style))
else:
new_row.append(getattr(self.model, elem).render())
render_inner_table()
class_name = getattr(self.model, elem).__class__.__name__
if elem in self.style_header and class_name == 'TextField':
# atm header style con be applied only to TextField
# type. ( and class_name == 'TextField )
style_name = self.style_header[elem]['style']
commands = self.style_header[elem]['commands']
my_style = Styles.style(style=style_name,
commands=commands)
compliant_data[sr][sc] = getattr(self.model, elem).render(style=my_style)
else:
compliant_data[sr][sc] = getattr(self.model, elem).render()
So far it's no possible to set cols' width in TableView but those ones are automatically calculated in render().
Note: A _get_cols_widht func does exist in TableView, add there a fix.
PAGASIZE is wrong. Change to PAGESIZE.
This fix will affect all .py in examples/
When a lot of items in self.styles share the same style commands (e.g. locations
, start_and_end_date_parts
, available_languages
) it could be useful a __default item
to apply the same style in only one command.
self.styles = {
'event_name_and_session_id': {
'style': 'Normal',
'space': 4.5,
'commands': [
('alignment', TA_CENTER),
('fontName', 'Helvetica'),
('fontSize', 18),
]
},
'vendor': {
'style': 'Normal',
'commands': [
('alignment', TA_CENTER),
('fontSize', 12),
],
'space': 4.5,
},
'start_and_end_date_parts': {
'style': 'Normal',
'commands': [
('alignment', TA_LEFT),
('fontSize', 8),
]
},
'locations': {
'style': 'Normal',
'commands': [
('alignment', TA_LEFT),
('fontSize', 8),
]
},
'available_languages':{
'style': 'Normal',
'commands': [
('alignment', TA_LEFT),
('fontSize', 8),
]
}
}
Take a look at render() function in form_view.FormView
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.