Re: Saving browser output as pdf

2013-02-23 Thread Evan Brumley
Have a look at wkhtmltopdf for easy server side generation of PDFs. It's 
not perfect, but it seems to be the best option out there at the moment. 
I'm also hearing good things about PhantomJS, though I haven't tried it out 
myself. Both options are essentially headless versions of Webkit - they 
produce results that look more or less exactly the same as a web browser, 
though it usually requires a fair bit of tweaking to get the proportions 
and pagebreaks right. Support for javascript and SVG is very good, though 
support for Flash isn't really there. They're not integrated into Django in 
any way - you need to generate local html files in a temporary location and 
run them using popen or similar.

wkhtmltopdf: http://code.google.com/p/wkhtmltopdf/
PhantomJS: http://phantomjs.org/

Probably best to ignore the Django docs on this subject, incidentally. 
Reportlab is great but massively time consuming, and the other options 
listed in there are either dead projects or don't really do a good enough 
job.

On Sunday, February 24, 2013 4:04:07 AM UTC+11, Satinderpal Singh wrote:
>
> How do i save the output from the browser as pdf. Is there any tool 
> availabel with the django which can save the browser output to as pdf 
> file. 
>
> -- 
> Satinderpal Singh 
> http://satindergoraya.blogspot.in/ 
> http://satindergoraya91.blogspot.in/ 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django testing strategy

2012-10-04 Thread Evan Brumley
django-dynamic-fixture can also help a lot in this situation:
http://paulocheque.github.com/django-dynamic-fixture/

Certainly beats having to futz around with fixtures.


On Friday, October 5, 2012 3:49:19 AM UTC+10, Daniele Procida wrote:
>
> I have started writing my first tests, for a project that has become 
> pretty large (several thousand lines of source code). 
>
> What needs the most testing - where most of the bugs or incorrect appear 
> emerge - are the very complex interactions between objects in the system. 
>
> To me, the intuitive way of testing would be this: 
>
> * to set up all the objects, in effect creating a complete working 
> database 
> * run all the tests on this database 
>
> That's pretty much the way I test things without automated tests: is the 
> output of the system, running a huge database of objects, correct? 
>
> However, I keep reading that I should isolate all my tests. So I have had 
> a go at creating tests that do that, but it can mean setting up a dozen 
> objects sometimes for a single tiny test, then doing exactly the same thing 
> with one small difference for another test. 
>
> Often I have to run save() on these objects, because otherwise tests that 
> depend on many-to-many and other database relations won't work. 
>
> That seems very inefficient, to create a succession of complex and 
> nearly-identical test conditions for dozens if not hundreds of tests. 
>
> I'd appreciate any advice. 
>
> Daniele 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/JGC6UxYp1qYJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



django-report-tools - feedback wanted!

2012-08-25 Thread Evan Brumley
Hi Everyone!

A bit of backstory - I work in the environmental sector, mostly designing 
data-driven reporting apps in Django. Think along the lines of CO2 
reporting, environmental audits, that sort of thing. Most projects tend to 
consist of a whole lot of CRUD, accompanied by a bunch of reporting pages 
with graphs, tables etc.

After designing a few such apps, it started to become apparent that we 
needed a way to better organise the large number of related charts and 
tables we had to deal with every day. We also needed something that 
abstracted away all the painful details of working with particular charting 
packages, which all tend to have their own uniquely hideous APIs.

After talking to some of the lovely people at Djangocon EU this year, it 
seemed as though this was something that other might find useful, so I had 
a talk to the higher-ups at work and they've allowed me to release it under 
a BSD license.

So, announcing.. django-report-tools!

https://github.com/evanbrumley/django-report-tools
http://django-report-tools.readthedocs.org

In a nutshell, it lets you create things like this:


class MyReport(Report):
> renderer = GoogleChartsRenderer
>
> pie_chart = charts.PieChart(
> title="A nice, simple pie chart",
> width=400,
> height=300
> )
>
> def get_data_for_pie_chart(self):
> data = ChartData()
>
> data.add_column("Pony Type")
> data.add_column("Population")
>
> data.add_row(["Blue", 20])
> data.add_row(["Pink", 20])
> data.add_row(["Magical", 1])
>
> return data
>
>

That's a more or less fully-functional example. As you can see, it 
basically allows you to write your report using the same declarative syntax 
as you'd use to write Django forms or models. You could include the Google 
jsapi in your page header, stick that in a template with {{ 
report.pie_chart }} and a pony pie chart would appear on your page.

This is my first time releasing a django/python package, so I'm sure I've 
screwed things up in lots of interesting ways. I'd love any feedback anyone 
can offer!

Kind regards,

Evan

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/8__CW4Gq3p0J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.