goinnn / django-tables2-reports Goto Github PK
View Code? Open in Web Editor NEWWith django-tables2-reports you can get a report (CSV, XLS) of any table with minimal changes to your project
With django-tables2-reports you can get a report (CSV, XLS) of any table with minimal changes to your project
Django Staticfiles removes the content type from the response object when returning a 304. This causes the middleware to throw a KeyError over response['Content-Type'].
I have a fix for this already. Will send the pull request in a few minutes.
Guys, thanks for your project !
But there is a question, how to specify (narrow down) the range of columns for csv/xsl report? It is a pretty difficult as I understand now. Do you think to add support for this?
This is helpful if some of columns are not data (i.e. buttons)
Hello creator :)
I founded a bug at the table.html template.
It don't work anymore with
"{{ STATIC_URL }}img/{{ format }}_icon.png" title="{{ label }}"
i fixed it bye using this
{% load static %}
"{% get_static_prefix %}img/{{ format }}_icon.png" title="{{ label }}"
Now it works again
Current user in django-tables2 is accessible through:
self.context["request"].user
This might be useful for data display depending on permissions.
It still works when extending TableReport, but it's lost when generating CSV/XLS and breaks.
Hello! Search engine bot find problem in generate XLS reports with some names:
Exception at /table/
invalid worksheet name u'report-realtytablewocontracttype'
Request Method: GET
Request URL: http://srv/table/?report-realtytablewocontracttype=xls&next=
Django Version: 1.5.4
Exception Type: Exception
Exception Value:
invalid worksheet name u'report-realtytablewocontracttype'
Exception Location: /devel/venv/local/lib/python2.7/site-packages/xlwt/Workbook.py in add_sheet, line 345
Recently, jieter/django-tables2#320 changed the API for get_table_pagination
to include a parameter for the table (to reflect changes to support the multi table implementation)
Line 34 of django_tables2_reports/views.py
needs to trivially change in response
I can submit a pull request, but would obviously break when trying to use an older version of django-tables2
The Excel generator doesn't respect the session variables, even though it is respected by the HTML table.
A sample is attached.
I see the XLS generation is dependant on pyExcelerator, which was last updated in 2009 (http://sourceforge.net/projects/pyexcelerator/files/?source=navbar). Would you consider switching to xlwt (https://pypi.python.org/pypi/xlwt), which is a project that is "live" and has good and ongoing support? Thanks!
This module have a mix of the logic to pyexcelerator, xlwt, and openpyxl. I want to do a package.
In this release this will be a package within django-tables2-reports, but the idea is to do a new python egg, this can use a lot of people. Even this will not depend of django.
Hello!
Please add support for JSON output also.
This is a suggestion for an improvement. I'd like the xls format output to set the cell background color when using xlwt.
I forked the project and made a solution that works for my needs. I'm not going to post a PR since I don't think it's a good enough solution for widespread use and I only changed the code related to xlwt so it will break with the other xls libraries.
Here's my branch with my solution :
https://github.com/samaust/django-tables2-reports/tree/xlwt_background-color
When creating my table, I pass additional columns that contain hex color codes. Those column are set to not show up on the table. If I have a column called "columnname", I also add another column called "columnname_color". My branch searches for those color columns and adds the colors to the custom Excel palette.
Hi,
just reporting this. Will let you know if I figure out what is up.
Here are the csv and xls files www.opensourcesci.com/temp/report.zip
cheers,
Andy.
When trying to install the latest version of this package through pip, I get the following error:
(netell) ubuntu@ubuntu-xenial:~/netell$ pip install django-tables2-reports
Collecting django-tables2-reports
Using cached django-tables2-reports-0.1.0.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-5ia7w4_r/django-tables2-reports/setup.py", line 42, in <module>
install_requires=[x.strip() for x in open("requirements.txt").readlines()],
FileNotFoundError: [Errno 2] No such file or directory: 'requirements.txt'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-5ia7w4_r/django-tables2-reports/
I took a look at the package uploaded to PyPI and requirements.txt
is indeed missing, and it's also missing from MANIFEST.in
.
The test is still using django-tables2==0.14.0
, is there plan to update to a more recent version?
Template columns doesn't respect the request.session, django-tables2 respects them so the template working under django-tables2 doesn't work under django-tables2-reports
When creating a xls report and the the text inside one of the cell in the table is too long, you get a ValueError because column width (602112) not an int in range(65536).
The function get_xls_col_width in the xlwt_converter must not return a value higher than 65535. The set_width method of the Column class of xlwt will raise the ValueError.
A possible fix to this would be to return the min value between the current approximation, and the max value allowed by xlwt.
A good idea would be to have a ReportTableMixin
which would inherit from SingleTableMixin
this would allow more flexibility to add django-tables2-reports into our CBV.
ValueError at /index_function_view_middleware/
Invalid column index 0
Request Method: GET
Request URL: http://127.0.0.1:8000/index_function_view_middleware/?my-prefix-report-testtable=xls
Django Version: 1.7
Exception Type: ValueError
Exception Value:
Invalid column index 0
Exception Location: D:\Program Files\Python33\lib\site-packages\openpyxl\cell\cell.py in get_column_letter, line 109
Python Executable: D:\Program Files\Python33\python.exe
Python Version: 3.3.4
Python Path:
['D:\Users\Hui\PycharmProjects\test_project',
'D:\Program Files\Python33\lib\site-packages\setuptools-1.1.5-py3.3.egg',
'D:\Program Files\Python33\lib\site-packages\pip-1.4.1-py3.3.egg',
'D:\Program Files\Python33\lib\site-packages\django_tables2_reports-0.0.10-py3.3.egg',
'D:\Users\Hui\PycharmProjects\test_project',
'C:\Windows\SYSTEM32\python33.zip',
'D:\Program Files\Python33\DLLs',
'D:\Program Files\Python33\lib',
'D:\Program Files\Python33',
'D:\Program Files\Python33\lib\site-packages']
Server time: Fri, 19 Sep 2014 10:22:33 +0800
when I test the test_project,i get the error.
this is my opion:
openpyxl==2.0.5
django-tables2-reports==0.0.10
excel 2013
Hello,
could you please modify tables.py as follow:
88,89c88,89
< if not 'template' in kwargs:
< kwargs['template'] = 'django_tables2_reports/table.html'
---
> if not 'template_name' in kwargs:
> kwargs['template_name'] = 'django_tables2_reports/table.html'
It is needed to have compatibility with django-tables2 >2.0
Thank you
Simone
When exporting to csv or xls text fields with commas are split into multiple columns. While the csv spec isn't the best and has trouble dealing with this sort of ambiguity the xls version should not be affected. However, as in the code the xls export is a post-processing of the csv this carries over to the xls.
After doing the changes for work with django-tables2-reports, I try to export to excel but i got a ValueError: Invalid column index 0, Otherwise If export to CVS it works fine
i'm using openpyxl
Here is my traceback
https://gist.github.com/anonymous/47efa2aa3751f92b26d8
I have a model based table, DeploymentsTable, with some manual added Columns.
using version 0.07, trying to render it I get the following exception,
could you please help.
Thanks,
Shay
File "/home/shayh/.virtualenvs/cec/lib/python2.7/site-packages/django_tables2/views.py" in get_context_data
table = self.get_table()
self.table_to_report = RequestConfigReport(self.request, **options).configure(table)
param_report = table.param_report
Exception Type: AttributeError at /deployments/
Exception Value: 'DeploymentsTable' object has no attribute 'param_report'
โผ Local vars
Variable Value
table
reports.views.DeploymentsTable object at 0x7f5c0825ea50
self
django_tables2_reports.config.RequestConfigReport object at 0x7f5c0825e9d0
extra_context
None
Python 2.7.10
Django 1.8.16
Code below gives issue:
return ".".join(VERSION)
TypeError: sequence item 0: expected string, int found
Code: init.py:
VERSION = (0, 1, 0)
def get_version():
return ".".join(VERSION)
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.