├── .gitignore ├── .travis.yml ├── AUTHORS ├── LICENSE ├── MANIFEST.in ├── Procfile ├── README.md ├── docs ├── Makefile ├── conf.py ├── configuration.rst ├── contributing.rst ├── example_app.rst ├── highcharts_module.rst ├── index.rst ├── installation.rst ├── make.bat └── modules.rst ├── example ├── manage.py └── test_project │ ├── __init__.py │ ├── app │ ├── __init__.py │ ├── admin.py │ ├── fixtures │ │ └── initial_data.json │ ├── locale │ │ └── es │ │ │ └── LC_MESSAGES │ │ │ ├── django.mo │ │ │ └── django.po │ ├── models.py │ ├── reports.py │ └── tests.py │ ├── example.db │ ├── fixture.json │ ├── model_report.db │ ├── settings.py │ ├── settings_postgresql.py │ ├── settings_sqlite.py │ ├── static │ ├── admin │ │ ├── css │ │ │ ├── base.css │ │ │ ├── changelists.css │ │ │ ├── dashboard.css │ │ │ ├── forms.css │ │ │ ├── ie.css │ │ │ ├── login.css │ │ │ ├── rtl.css │ │ │ └── widgets.css │ │ ├── img │ │ │ ├── changelist-bg.gif │ │ │ ├── changelist-bg_rtl.gif │ │ │ ├── chooser-bg.gif │ │ │ ├── chooser_stacked-bg.gif │ │ │ ├── default-bg-reverse.gif │ │ │ ├── default-bg.gif │ │ │ ├── deleted-overlay.gif │ │ │ ├── gis │ │ │ │ ├── move_vertex_off.png │ │ │ │ └── move_vertex_on.png │ │ │ ├── icon-no.gif │ │ │ ├── icon-unknown.gif │ │ │ ├── icon-yes.gif │ │ │ ├── icon_addlink.gif │ │ │ ├── icon_alert.gif │ │ │ ├── icon_calendar.gif │ │ │ ├── icon_changelink.gif │ │ │ ├── icon_clock.gif │ │ │ ├── icon_deletelink.gif │ │ │ ├── icon_error.gif │ │ │ ├── icon_searchbox.png │ │ │ ├── icon_success.gif │ │ │ ├── inline-delete-8bit.png │ │ │ ├── inline-delete.png │ │ │ ├── inline-restore-8bit.png │ │ │ ├── inline-restore.png │ │ │ ├── inline-splitter-bg.gif │ │ │ ├── nav-bg-grabber.gif │ │ │ ├── nav-bg-reverse.gif │ │ │ ├── nav-bg-selected.gif │ │ │ ├── nav-bg.gif │ │ │ ├── selector-icons.gif │ │ │ ├── selector-search.gif │ │ │ ├── sorting-icons.gif │ │ │ ├── tool-left.gif │ │ │ ├── tool-left_over.gif │ │ │ ├── tool-right.gif │ │ │ ├── tool-right_over.gif │ │ │ ├── tooltag-add.gif │ │ │ ├── tooltag-add_over.gif │ │ │ ├── tooltag-arrowright.gif │ │ │ └── tooltag-arrowright_over.gif │ │ └── js │ │ │ ├── LICENSE-JQUERY.txt │ │ │ ├── SelectBox.js │ │ │ ├── SelectFilter2.js │ │ │ ├── actions.js │ │ │ ├── actions.min.js │ │ │ ├── admin │ │ │ ├── DateTimeShortcuts.js │ │ │ ├── RelatedObjectLookups.js │ │ │ └── ordering.js │ │ │ ├── calendar.js │ │ │ ├── collapse.js │ │ │ ├── collapse.min.js │ │ │ ├── compress.py │ │ │ ├── core.js │ │ │ ├── getElementsBySelector.js │ │ │ ├── inlines.js │ │ │ ├── inlines.min.js │ │ │ ├── jquery.init.js │ │ │ ├── jquery.js │ │ │ ├── jquery.min.js │ │ │ ├── prepopulate.js │ │ │ ├── prepopulate.min.js │ │ │ ├── timeparse.js │ │ │ └── urlify.js │ └── model_report │ │ ├── css │ │ └── datepicker.css │ │ └── js │ │ ├── highcharts │ │ ├── examples │ │ │ ├── analytics.tsv │ │ │ ├── area-basic.htm │ │ │ ├── area-inverted.htm │ │ │ ├── area-missing.htm │ │ │ ├── area-negative.htm │ │ │ ├── area-stacked-percent.htm │ │ │ ├── area-stacked.htm │ │ │ ├── areaspline.htm │ │ │ ├── bar-basic.htm │ │ │ ├── bar-negative-stack.htm │ │ │ ├── bar-stacked.htm │ │ │ ├── column-basic.htm │ │ │ ├── column-drilldown.htm │ │ │ ├── column-negative.htm │ │ │ ├── column-parsed.htm │ │ │ ├── column-rotated-labels.htm │ │ │ ├── column-stacked-and-grouped.htm │ │ │ ├── column-stacked-percent.htm │ │ │ ├── column-stacked.htm │ │ │ ├── combo-dual-axes.htm │ │ │ ├── combo-multi-axes.htm │ │ │ ├── combo-regression.htm │ │ │ ├── combo.htm │ │ │ ├── dynamic-click-to-add.htm │ │ │ ├── dynamic-master-detail.htm │ │ │ ├── dynamic-update.htm │ │ │ ├── line-ajax.htm │ │ │ ├── line-basic.htm │ │ │ ├── line-labels.htm │ │ │ ├── line-time-series.htm │ │ │ ├── pie-basic.htm │ │ │ ├── pie-donut.htm │ │ │ ├── pie-legend.htm │ │ │ ├── scatter.htm │ │ │ ├── spline-inverted.htm │ │ │ ├── spline-irregular-time.htm │ │ │ ├── spline-plot-bands.htm │ │ │ └── spline-symbols.htm │ │ ├── exporting-server │ │ │ └── index.php │ │ ├── graphics │ │ │ ├── skies.jpg │ │ │ ├── snow.png │ │ │ └── sun.png │ │ ├── index.htm │ │ └── js │ │ │ ├── adapters │ │ │ ├── mootools-adapter.js │ │ │ ├── mootools-adapter.src.js │ │ │ ├── prototype-adapter.js │ │ │ └── prototype-adapter.src.js │ │ │ ├── highcharts.js │ │ │ ├── highcharts.src.js │ │ │ ├── modules │ │ │ ├── exporting.js │ │ │ └── exporting.src.js │ │ │ └── themes │ │ │ ├── dark-blue.js │ │ │ ├── dark-green.js │ │ │ ├── gray.js │ │ │ └── grid.js │ │ ├── jquery-1.6.2.min.js │ │ └── jquery-ui-1.8.16.custom.min.js │ ├── templates │ ├── base.html │ └── model_report │ │ ├── includes │ │ ├── report_nav_item.html │ │ └── report_title.html │ │ ├── report.html │ │ └── report_list.html │ ├── urls.py │ └── wsgi.py ├── model_report ├── __init__.py ├── arial10.py ├── exporters │ ├── __init__.py │ ├── base.py │ ├── excel.py │ └── pdf.py ├── forms.py ├── highcharts │ ├── __init__.py │ ├── base.py │ └── options.py ├── locale │ ├── es │ │ └── LC_MESSAGES │ │ │ ├── django.mo │ │ │ └── django.po │ └── lt │ │ └── LC_MESSAGES │ │ ├── django.mo │ │ └── django.po ├── report.py ├── static │ └── model_report │ │ ├── css │ │ ├── datepicker.css │ │ └── images │ │ │ ├── ui-bg_flat_0_aaaaaa_40x100.png │ │ │ ├── ui-bg_flat_0_eeeeee_40x100.png │ │ │ ├── ui-bg_flat_55_ffffff_40x100.png │ │ │ ├── ui-bg_flat_75_ffffff_40x100.png │ │ │ ├── ui-bg_glass_65_ffffff_1x400.png │ │ │ ├── ui-bg_highlight-soft_100_f6f6f6_1x100.png │ │ │ ├── ui-bg_highlight-soft_25_0073ea_1x100.png │ │ │ ├── ui-bg_highlight-soft_50_dddddd_1x100.png │ │ │ ├── ui-icons_0073ea_256x240.png │ │ │ ├── ui-icons_454545_256x240.png │ │ │ ├── ui-icons_666666_256x240.png │ │ │ ├── ui-icons_ff0084_256x240.png │ │ │ └── ui-icons_ffffff_256x240.png │ │ └── js │ │ ├── highcharts │ │ ├── examples │ │ │ ├── analytics.tsv │ │ │ ├── area-basic.htm │ │ │ ├── area-inverted.htm │ │ │ ├── area-missing.htm │ │ │ ├── area-negative.htm │ │ │ ├── area-stacked-percent.htm │ │ │ ├── area-stacked.htm │ │ │ ├── areaspline.htm │ │ │ ├── bar-basic.htm │ │ │ ├── bar-negative-stack.htm │ │ │ ├── bar-stacked.htm │ │ │ ├── column-basic.htm │ │ │ ├── column-drilldown.htm │ │ │ ├── column-negative.htm │ │ │ ├── column-parsed.htm │ │ │ ├── column-rotated-labels.htm │ │ │ ├── column-stacked-and-grouped.htm │ │ │ ├── column-stacked-percent.htm │ │ │ ├── column-stacked.htm │ │ │ ├── combo-dual-axes.htm │ │ │ ├── combo-multi-axes.htm │ │ │ ├── combo-regression.htm │ │ │ ├── combo.htm │ │ │ ├── dynamic-click-to-add.htm │ │ │ ├── dynamic-master-detail.htm │ │ │ ├── dynamic-update.htm │ │ │ ├── line-ajax.htm │ │ │ ├── line-basic.htm │ │ │ ├── line-labels.htm │ │ │ ├── line-time-series.htm │ │ │ ├── pie-basic.htm │ │ │ ├── pie-donut.htm │ │ │ ├── pie-legend.htm │ │ │ ├── scatter.htm │ │ │ ├── spline-inverted.htm │ │ │ ├── spline-irregular-time.htm │ │ │ ├── spline-plot-bands.htm │ │ │ └── spline-symbols.htm │ │ ├── exporting-server │ │ │ └── index.php │ │ ├── graphics │ │ │ ├── skies.jpg │ │ │ ├── snow.png │ │ │ └── sun.png │ │ ├── index.htm │ │ └── js │ │ │ ├── adapters │ │ │ ├── mootools-adapter.js │ │ │ ├── mootools-adapter.src.js │ │ │ ├── prototype-adapter.js │ │ │ └── prototype-adapter.src.js │ │ │ ├── highcharts.js │ │ │ ├── highcharts.src.js │ │ │ ├── modules │ │ │ ├── exporting.js │ │ │ └── exporting.src.js │ │ │ └── themes │ │ │ ├── dark-blue.js │ │ │ ├── dark-green.js │ │ │ ├── gray.js │ │ │ └── grid.js │ │ ├── jquery-1.6.2.min.js │ │ └── jquery-ui-1.8.16.custom.min.js ├── templates │ └── model_report │ │ ├── export_pdf.html │ │ ├── includes │ │ ├── datepicker_options.html │ │ ├── form_buttons.html │ │ ├── form_config.html │ │ ├── form_fields.html │ │ ├── form_filter.html │ │ ├── form_groupby.html │ │ ├── form_report.html │ │ ├── report_chart.html │ │ ├── report_inline.html │ │ ├── report_nav.html │ │ ├── report_nav_item.html │ │ ├── report_table.html │ │ └── report_title.html │ │ ├── report.html │ │ ├── report_list.html │ │ └── widgets │ │ └── range_widget.html ├── templatetags │ ├── __init__.py │ └── model_report.py ├── urls.py ├── utils.py ├── views.py └── widgets.py ├── requirements.txt └── setup.py /.gitignore: -------------------------------------------------------------------------------- 1 | *.log 2 | *.pot 3 | *.pyc 4 | local_settings.py 5 | .venv 6 | *.egg* 7 | docs/_build 8 | build/ 9 | dist/ 10 | 11 | # IDE files 12 | .project 13 | .pydevproject 14 | .settings/* 15 | resetdb.sh -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | 3 | python: 4 | - "2.7" 5 | env: 6 | - DB=sqlite DJANGO=1.3.7 7 | - DB=sqlite DJANGO=1.4.5 8 | - DB=sqlite DJANGO=1.5.1 9 | - DB=postgresql DJANGO=1.3.7 10 | - DB=postgresql DJANGO=1.4.5 11 | - DB=postgresql DJANGO=1.5.1 12 | 13 | install: 14 | - pip install -q Django==$DJANGO pisa reportlab html5lib BeautifulSoup psycopg2==2.4.1 xlwt==0.7.4 xhtml2pdf --use-mirrors 15 | 16 | 17 | before_script: 18 | - psql -c 'create database model_report;' -U postgres 19 | 20 | script: 21 | - cd example 22 | - python manage.py test app --settings=test_project.settings_$DB --noinput 23 | 24 | notifications: 25 | email: 26 | recipients: 27 | - jpma55@gmail.com 28 | on_success: always 29 | on_failure: always 30 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Primary authors: 2 | 3 | * juanpex 4 | * jelenak 5 | 6 | Contributors 7 | 8 | * cristi23 - Cristi Scoarta 9 | * suvit - Victor Safronovich 10 | * josedeweb - Jose Alvarez 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012, Juan Pablo Martínez 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, 5 | are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | 14 | 3. Neither the name of this project nor the names of its contributors may be 15 | used to endorse or promote products derived from this software without 16 | specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 22 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 25 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | recursive-include model_report/templates * 2 | recursive-include model_report/static * 3 | recursive-include model_report/locale * 4 | include README.md 5 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: python ./example/manage.py runserver 0.0.0.0:$PORT 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Django Model Report 5 | =================== 6 | 7 | django-model-report is a Django application and library for reports integrated with highcharts. 8 | 9 | 10 | [![Build Status](https://travis-ci.org/juanpex/django-model-report.png)](https://travis-ci.org/juanpex/django-model-report) 11 | 12 | now maintained by [@jelenak](https://github.com/jelenak "@jelenak") 13 | -------------------------------------------------------------------- 14 | 15 | Demo 16 | ==== 17 | 18 | http://django-model-report.herokuapp.com 19 | 20 | 21 | Documentation 22 | ============= 23 | 24 | https://django-model-report.readthedocs.org/en/latest/ 25 | 26 | ForeignKey queryset in main report.py file: 27 | 28 | list_filter_queryset = { 29 | 'user': {'groups__in': [13, 34]}, 30 | } 31 | 32 | Custom widget: 33 | 34 | list_filter_widget = { 35 | 'state': SelectMultiple(), 36 | } 37 | 38 | Contribute 39 | ========== 40 | 41 | Clone the repo and help to be better this app :) 42 | 43 | 44 | [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/juanpex/django-model-report/trend.png)](https://bitdeli.com/free "Bitdeli Badge") 45 | 46 | -------------------------------------------------------------------------------- /docs/configuration.rst: -------------------------------------------------------------------------------- 1 | Configuration 2 | ============= 3 | 4 | 5 | Extend your reports from :func:`model_report.report.ReportAdmin`:: 6 | 7 | from model_report.report import ReportAdmin 8 | 9 | class ReportExample(ReportAdmin): 10 | pass 11 | 12 | To configure the report see the :func:`model_report.report.ReportAdmin` documentation -------------------------------------------------------------------------------- /docs/contributing.rst: -------------------------------------------------------------------------------- 1 | Contributing 2 | ============ 3 | 4 | Clone the repo and help to be better this app :) 5 | 6 | 7 | -------------------------------------------------------------------------------- /docs/example_app.rst: -------------------------------------------------------------------------------- 1 | =========== 2 | Example app 3 | =========== 4 | 5 | :: 6 | 7 | cd example && ./manage.py runserver 8 | 9 | Username and password for admin are 'admin', 'admin'. -------------------------------------------------------------------------------- /docs/highcharts_module.rst: -------------------------------------------------------------------------------- 1 | Highchart Module 2 | ================ 3 | 4 | 5 | __init__ 6 | -------- 7 | 8 | .. automodule:: model_report.highcharts.__init__ 9 | :members: 10 | 11 | 12 | base 13 | ---- 14 | 15 | .. automodule:: model_report.highcharts.base 16 | :members: 17 | 18 | 19 | options 20 | ------- 21 | 22 | .. automodule:: model_report.highcharts.options 23 | :members: -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | Welcome to django-model-report's documentation! 2 | =============================================== 3 | 4 | django-model-report is a Django application and library for reports integrated with highcharts. 5 | 6 | Demo 7 | ==== 8 | 9 | http://django-model-report.herokuapp.com 10 | 11 | User Guide 12 | ---------- 13 | 14 | .. toctree:: 15 | :maxdepth: 2 16 | 17 | installation 18 | example_app 19 | configuration 20 | contributing 21 | 22 | Modules 23 | ------- 24 | 25 | .. toctree:: 26 | :maxdepth: 3 27 | 28 | modules 29 | -------------------------------------------------------------------------------- /docs/installation.rst: -------------------------------------------------------------------------------- 1 | Installation 2 | ============ 3 | 4 | django-model-report is on the Python Package Index (PyPI), 5 | so it can be installed with standard Python tools like pip or easy_install.:: 6 | 7 | $ pip install django-model-report 8 | 9 | 10 | * Add the ``model_report`` directory to your Python path. 11 | 12 | * Add ``model_report`` to your ``INSTALLED_APPS`` setting. 13 | 14 | * Create file "reports.py" within any application directory (just like admin.py). 15 | 16 | * Edit the file "reports.py" and register your reports like this:: 17 | 18 | from anyapp.models import AnyModel 19 | from model_report.report import reports, ReportAdmin 20 | 21 | class AnyModelReport(ReportAdmin): 22 | title = _('AnyModel Report Name') 23 | model = AnyModel 24 | fields = [ 25 | 'anymodelfield', 26 | ] 27 | list_order_by = ('anymodelfield',) 28 | type = 'report' 29 | 30 | reports.register('anymodel-report', AnyModelReport) 31 | 32 | * Activate your reports calling the autodiscover in ``urls.py`` (just like admin.py).:: 33 | 34 | from model_report import report 35 | report.autodiscover() 36 | 37 | * Add reports urls.:: 38 | 39 | urlpatterns = patterns('', 40 | ... 41 | (r'', include('model_report.urls')), 42 | ... 43 | ) -------------------------------------------------------------------------------- /docs/modules.rst: -------------------------------------------------------------------------------- 1 | Modules 2 | ======= 3 | 4 | highcharts 5 | ---------- 6 | 7 | .. toctree:: 8 | :maxdepth: 2 9 | 10 | highcharts_module 11 | 12 | 13 | export_pdf 14 | ---------- 15 | 16 | .. automodule:: model_report.export_pdf 17 | :members: 18 | 19 | 20 | report 21 | ------ 22 | 23 | .. automodule:: model_report.report 24 | :members: 25 | 26 | 27 | utils 28 | ----- 29 | 30 | .. automodule:: model_report.utils 31 | :members: 32 | 33 | 34 | widgets 35 | ------- 36 | 37 | .. automodule:: model_report.widgets 38 | :members: -------------------------------------------------------------------------------- /example/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == "__main__": 6 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_project.settings") 7 | 8 | from django.core.management import execute_from_command_line 9 | 10 | execute_from_command_line(sys.argv) 11 | -------------------------------------------------------------------------------- /example/test_project/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/__init__.py -------------------------------------------------------------------------------- /example/test_project/app/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/app/__init__.py -------------------------------------------------------------------------------- /example/test_project/app/admin.py: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | from django.contrib import admin 3 | 4 | from app.models import Population, Browser, BrowserDownload, OS, Support, Company, ResolutionByYear 5 | 6 | 7 | admin.site.register(ResolutionByYear) 8 | admin.site.register(Company) 9 | admin.site.register(Population) 10 | admin.site.register(Browser) 11 | admin.site.register(OS) 12 | admin.site.register(Support) 13 | admin.site.register(BrowserDownload) 14 | -------------------------------------------------------------------------------- /example/test_project/app/locale/es/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/app/locale/es/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /example/test_project/app/tests.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import unittest 3 | from django.test.client import Client 4 | 5 | BASIC_GET_FOR_REPORT = { 6 | 'resolution-by-year-report': '/resolution-by-year-report/?groupby=None&resolution=', 7 | 'os-report': '/os-report/?company__name=', 8 | 'population-report': '/population-report/?groupby=None&age=', 9 | 'browser-download-report': '/browser-download-report/?groupby=None&browser__name=&os__name=&os__company__name=&download_date_0=&download_date_1=&chart_mode=&serie_field=&serie_op=', 10 | 'browser-report': '/browser-report/?__all__=1', 11 | 'browser-list-report': '/browser-list-report/?groupby=None&chart_mode=&serie_field=&serie_op=', 12 | } 13 | 14 | 15 | class ExampleCaseBasic(unittest.TestCase): 16 | fixtures = ['app', ] 17 | 18 | def test_basic_query(self): 19 | c = Client() 20 | response = c.post('/') 21 | self.assertEqual(response.status_code, 200) 22 | report_list = response.context['report_list'] 23 | for report in report_list: 24 | response = c.get("/%s/" % report.slug) 25 | self.assertEqual(response.status_code, 200) 26 | report_rows = response.context['report_rows'] 27 | if report_rows: 28 | raise ValueError('Not empty report_rows for "%s"' % report.slug) 29 | response = c.get(BASIC_GET_FOR_REPORT[report.slug]) 30 | self.assertEqual(response.status_code, 200) 31 | report_rows = response.context['report_rows'] 32 | if not report_rows: 33 | raise ValueError('Empty report_rows for "%s"' % report.slug) 34 | 35 | 36 | class ExampleCaseExcel(unittest.TestCase): 37 | fixtures = ['app', ] 38 | 39 | def test_basic_query(self): 40 | c = Client() 41 | response = c.post('/') 42 | self.assertEqual(response.status_code, 200) 43 | report_list = response.context['report_list'] 44 | for report in report_list: 45 | response = c.get("/%s/" % report.slug) 46 | self.assertEqual(response.status_code, 200) 47 | report_rows = response.context['report_rows'] 48 | if report_rows: 49 | raise ValueError('Not empty report_rows for "%s"' % report.slug) 50 | response = c.get(BASIC_GET_FOR_REPORT[report.slug] + '&export=excel') 51 | self.assertEqual(response.status_code, 200) 52 | self.assertTrue(response.has_header('content-type')) 53 | self.assertEqual(response['content-type'], 'application/ms-excel') 54 | -------------------------------------------------------------------------------- /example/test_project/example.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/example.db -------------------------------------------------------------------------------- /example/test_project/model_report.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/model_report.db -------------------------------------------------------------------------------- /example/test_project/settings_postgresql.py: -------------------------------------------------------------------------------- 1 | from settings import * 2 | 3 | DATABASES = { 4 | 'default': { 5 | 'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. 6 | 'NAME': 'model_report', # Or path to database file if using sqlite3. 7 | 'USER': 'postgres', # Not used with sqlite3. 8 | 'OPTIONS': { 9 | 'autocommit': True, 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /example/test_project/settings_sqlite.py: -------------------------------------------------------------------------------- 1 | from settings import * 2 | 3 | DATABASES = { 4 | 'default': { 5 | 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. 6 | 'NAME': PROJECT_ABSOLUTE_DIR + '/model_report.db', # Or path to database file if using sqlite3. 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /example/test_project/static/admin/css/dashboard.css: -------------------------------------------------------------------------------- 1 | /* DASHBOARD */ 2 | 3 | .dashboard .module table th { 4 | width: 100%; 5 | } 6 | 7 | .dashboard .module table td { 8 | white-space: nowrap; 9 | } 10 | 11 | .dashboard .module table td a { 12 | display: block; 13 | padding-right: .6em; 14 | } 15 | 16 | /* RECENT ACTIONS MODULE */ 17 | 18 | .module ul.actionlist { 19 | margin-left: 0; 20 | } 21 | 22 | ul.actionlist li { 23 | list-style-type: none; 24 | } 25 | 26 | ul.actionlist li.changelink { 27 | overflow: hidden; 28 | text-overflow: ellipsis; 29 | -o-text-overflow: ellipsis; 30 | } -------------------------------------------------------------------------------- /example/test_project/static/admin/css/ie.css: -------------------------------------------------------------------------------- 1 | /* IE 6 & 7 */ 2 | 3 | /* Proper fixed width for dashboard in IE6 */ 4 | 5 | .dashboard #content { 6 | *width: 768px; 7 | } 8 | 9 | .dashboard #content-main { 10 | *width: 535px; 11 | } 12 | 13 | /* IE 6 ONLY */ 14 | 15 | /* Keep header from flowing off the page */ 16 | 17 | #container { 18 | _position: static; 19 | } 20 | 21 | /* Put the right sidebars back on the page */ 22 | 23 | .colMS #content-related { 24 | _margin-right: 0; 25 | _margin-left: 10px; 26 | _position: static; 27 | } 28 | 29 | /* Put the left sidebars back on the page */ 30 | 31 | .colSM #content-related { 32 | _margin-right: 10px; 33 | _margin-left: -115px; 34 | _position: static; 35 | } 36 | 37 | .form-row { 38 | _height: 1%; 39 | } 40 | 41 | /* Fix right margin for changelist filters in IE6 */ 42 | 43 | #changelist-filter ul { 44 | _margin-right: -10px; 45 | } 46 | 47 | /* IE ignores min-height, but treats height as if it were min-height */ 48 | 49 | .change-list .filtered { 50 | _height: 400px; 51 | } 52 | 53 | /* IE doesn't know alpha transparency in PNGs */ 54 | 55 | .inline-deletelink { 56 | background: transparent url(../img/inline-delete-8bit.png) no-repeat; 57 | } 58 | 59 | /* IE7 doesn't support inline-block */ 60 | .change-list ul.toplinks li { 61 | zoom: 1; 62 | *display: inline; 63 | } -------------------------------------------------------------------------------- /example/test_project/static/admin/css/login.css: -------------------------------------------------------------------------------- 1 | /* LOGIN FORM */ 2 | 3 | body.login { 4 | background: #eee; 5 | } 6 | 7 | .login #container { 8 | background: white; 9 | border: 1px solid #ccc; 10 | width: 28em; 11 | min-width: 300px; 12 | margin-left: auto; 13 | margin-right: auto; 14 | margin-top: 100px; 15 | } 16 | 17 | .login #content-main { 18 | width: 100%; 19 | } 20 | 21 | .login form { 22 | margin-top: 1em; 23 | } 24 | 25 | .login .form-row { 26 | padding: 4px 0; 27 | float: left; 28 | width: 100%; 29 | } 30 | 31 | .login .form-row label { 32 | float: left; 33 | width: 9em; 34 | padding-right: 0.5em; 35 | line-height: 2em; 36 | text-align: right; 37 | font-size: 1em; 38 | color: #333; 39 | } 40 | 41 | .login .form-row #id_username, .login .form-row #id_password { 42 | width: 14em; 43 | } 44 | 45 | .login span.help { 46 | font-size: 10px; 47 | display: block; 48 | } 49 | 50 | .login .submit-row { 51 | clear: both; 52 | padding: 1em 0 0 9.4em; 53 | } 54 | 55 | .login .password-reset-link { 56 | text-align: center; 57 | } 58 | -------------------------------------------------------------------------------- /example/test_project/static/admin/img/changelist-bg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/static/admin/img/changelist-bg.gif -------------------------------------------------------------------------------- /example/test_project/static/admin/img/changelist-bg_rtl.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/static/admin/img/changelist-bg_rtl.gif -------------------------------------------------------------------------------- /example/test_project/static/admin/img/chooser-bg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/static/admin/img/chooser-bg.gif -------------------------------------------------------------------------------- /example/test_project/static/admin/img/chooser_stacked-bg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/static/admin/img/chooser_stacked-bg.gif -------------------------------------------------------------------------------- /example/test_project/static/admin/img/default-bg-reverse.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/static/admin/img/default-bg-reverse.gif -------------------------------------------------------------------------------- /example/test_project/static/admin/img/default-bg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/static/admin/img/default-bg.gif -------------------------------------------------------------------------------- /example/test_project/static/admin/img/deleted-overlay.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/static/admin/img/deleted-overlay.gif -------------------------------------------------------------------------------- /example/test_project/static/admin/img/gis/move_vertex_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/static/admin/img/gis/move_vertex_off.png -------------------------------------------------------------------------------- /example/test_project/static/admin/img/gis/move_vertex_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/static/admin/img/gis/move_vertex_on.png -------------------------------------------------------------------------------- /example/test_project/static/admin/img/icon-no.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/static/admin/img/icon-no.gif -------------------------------------------------------------------------------- /example/test_project/static/admin/img/icon-unknown.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/static/admin/img/icon-unknown.gif -------------------------------------------------------------------------------- /example/test_project/static/admin/img/icon-yes.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/static/admin/img/icon-yes.gif -------------------------------------------------------------------------------- /example/test_project/static/admin/img/icon_addlink.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/static/admin/img/icon_addlink.gif -------------------------------------------------------------------------------- /example/test_project/static/admin/img/icon_alert.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/static/admin/img/icon_alert.gif -------------------------------------------------------------------------------- /example/test_project/static/admin/img/icon_calendar.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/static/admin/img/icon_calendar.gif -------------------------------------------------------------------------------- /example/test_project/static/admin/img/icon_changelink.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/static/admin/img/icon_changelink.gif -------------------------------------------------------------------------------- /example/test_project/static/admin/img/icon_clock.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/static/admin/img/icon_clock.gif -------------------------------------------------------------------------------- /example/test_project/static/admin/img/icon_deletelink.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/static/admin/img/icon_deletelink.gif -------------------------------------------------------------------------------- /example/test_project/static/admin/img/icon_error.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/static/admin/img/icon_error.gif -------------------------------------------------------------------------------- /example/test_project/static/admin/img/icon_searchbox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/static/admin/img/icon_searchbox.png -------------------------------------------------------------------------------- /example/test_project/static/admin/img/icon_success.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/static/admin/img/icon_success.gif -------------------------------------------------------------------------------- /example/test_project/static/admin/img/inline-delete-8bit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/static/admin/img/inline-delete-8bit.png -------------------------------------------------------------------------------- /example/test_project/static/admin/img/inline-delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/static/admin/img/inline-delete.png -------------------------------------------------------------------------------- /example/test_project/static/admin/img/inline-restore-8bit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/static/admin/img/inline-restore-8bit.png -------------------------------------------------------------------------------- /example/test_project/static/admin/img/inline-restore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/static/admin/img/inline-restore.png -------------------------------------------------------------------------------- /example/test_project/static/admin/img/inline-splitter-bg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/static/admin/img/inline-splitter-bg.gif -------------------------------------------------------------------------------- /example/test_project/static/admin/img/nav-bg-grabber.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/static/admin/img/nav-bg-grabber.gif -------------------------------------------------------------------------------- /example/test_project/static/admin/img/nav-bg-reverse.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/static/admin/img/nav-bg-reverse.gif -------------------------------------------------------------------------------- /example/test_project/static/admin/img/nav-bg-selected.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/static/admin/img/nav-bg-selected.gif -------------------------------------------------------------------------------- /example/test_project/static/admin/img/nav-bg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/static/admin/img/nav-bg.gif -------------------------------------------------------------------------------- /example/test_project/static/admin/img/selector-icons.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/static/admin/img/selector-icons.gif -------------------------------------------------------------------------------- /example/test_project/static/admin/img/selector-search.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/static/admin/img/selector-search.gif -------------------------------------------------------------------------------- /example/test_project/static/admin/img/sorting-icons.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/static/admin/img/sorting-icons.gif -------------------------------------------------------------------------------- /example/test_project/static/admin/img/tool-left.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/static/admin/img/tool-left.gif -------------------------------------------------------------------------------- /example/test_project/static/admin/img/tool-left_over.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/static/admin/img/tool-left_over.gif -------------------------------------------------------------------------------- /example/test_project/static/admin/img/tool-right.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/static/admin/img/tool-right.gif -------------------------------------------------------------------------------- /example/test_project/static/admin/img/tool-right_over.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/static/admin/img/tool-right_over.gif -------------------------------------------------------------------------------- /example/test_project/static/admin/img/tooltag-add.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/static/admin/img/tooltag-add.gif -------------------------------------------------------------------------------- /example/test_project/static/admin/img/tooltag-add_over.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/static/admin/img/tooltag-add_over.gif -------------------------------------------------------------------------------- /example/test_project/static/admin/img/tooltag-arrowright.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/static/admin/img/tooltag-arrowright.gif -------------------------------------------------------------------------------- /example/test_project/static/admin/img/tooltag-arrowright_over.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/static/admin/img/tooltag-arrowright_over.gif -------------------------------------------------------------------------------- /example/test_project/static/admin/js/LICENSE-JQUERY.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010 John Resig, http://jquery.com/ 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /example/test_project/static/admin/js/collapse.js: -------------------------------------------------------------------------------- 1 | (function($) { 2 | $(document).ready(function() { 3 | // Add anchor tag for Show/Hide link 4 | $("fieldset.collapse").each(function(i, elem) { 5 | // Don't hide if fields in this fieldset have errors 6 | if ($(elem).find("div.errors").length == 0) { 7 | $(elem).addClass("collapsed").find("h2").first().append(' (' + gettext("Show") + 9 | ')'); 10 | } 11 | }); 12 | // Add toggle to anchor tag 13 | $("fieldset.collapse a.collapse-toggle").toggle( 14 | function() { // Show 15 | $(this).text(gettext("Hide")).closest("fieldset").removeClass("collapsed").trigger("show.fieldset", [$(this).attr("id")]); 16 | return false; 17 | }, 18 | function() { // Hide 19 | $(this).text(gettext("Show")).closest("fieldset").addClass("collapsed").trigger("hide.fieldset", [$(this).attr("id")]); 20 | return false; 21 | } 22 | ); 23 | }); 24 | })(django.jQuery); 25 | -------------------------------------------------------------------------------- /example/test_project/static/admin/js/collapse.min.js: -------------------------------------------------------------------------------- 1 | (function(a){a(document).ready(function(){a("fieldset.collapse").each(function(c,b){0==a(b).find("div.errors").length&&a(b).addClass("collapsed").find("h2").first().append(' ('+gettext("Show")+")")});a("fieldset.collapse a.collapse-toggle").toggle(function(){a(this).text(gettext("Hide")).closest("fieldset").removeClass("collapsed").trigger("show.fieldset",[a(this).attr("id")]);return!1},function(){a(this).text(gettext("Show")).closest("fieldset").addClass("collapsed").trigger("hide.fieldset", 2 | [a(this).attr("id")]);return!1})})})(django.jQuery); 3 | -------------------------------------------------------------------------------- /example/test_project/static/admin/js/compress.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import optparse 4 | import subprocess 5 | import sys 6 | 7 | here = os.path.dirname(__file__) 8 | 9 | def main(): 10 | usage = "usage: %prog [file1..fileN]" 11 | description = """With no file paths given this script will automatically 12 | compress all jQuery-based files of the admin app. Requires the Google Closure 13 | Compiler library and Java version 6 or later.""" 14 | parser = optparse.OptionParser(usage, description=description) 15 | parser.add_option("-c", dest="compiler", default="~/bin/compiler.jar", 16 | help="path to Closure Compiler jar file") 17 | parser.add_option("-v", "--verbose", 18 | action="store_true", dest="verbose") 19 | parser.add_option("-q", "--quiet", 20 | action="store_false", dest="verbose") 21 | (options, args) = parser.parse_args() 22 | 23 | compiler = os.path.expanduser(options.compiler) 24 | if not os.path.exists(compiler): 25 | sys.exit("Google Closure compiler jar file %s not found. Please use the -c option to specify the path." % compiler) 26 | 27 | if not args: 28 | if options.verbose: 29 | sys.stdout.write("No filenames given; defaulting to admin scripts\n") 30 | args = [os.path.join(here, f) for f in [ 31 | "actions.js", "collapse.js", "inlines.js", "prepopulate.js"]] 32 | 33 | for arg in args: 34 | if not arg.endswith(".js"): 35 | arg = arg + ".js" 36 | to_compress = os.path.expanduser(arg) 37 | if os.path.exists(to_compress): 38 | to_compress_min = "%s.min.js" % "".join(arg.rsplit(".js")) 39 | cmd = "java -jar %s --js %s --js_output_file %s" % (compiler, to_compress, to_compress_min) 40 | if options.verbose: 41 | sys.stdout.write("Running: %s\n" % cmd) 42 | subprocess.call(cmd.split()) 43 | else: 44 | sys.stdout.write("File %s not found. Sure it exists?\n" % to_compress) 45 | 46 | if __name__ == '__main__': 47 | main() 48 | -------------------------------------------------------------------------------- /example/test_project/static/admin/js/inlines.min.js: -------------------------------------------------------------------------------- 1 | (function(b){b.fn.formset=function(c){var a=b.extend({},b.fn.formset.defaults,c),j=function(a,e,d){var i=RegExp("("+e+"-(\\d+|__prefix__))"),e=e+"-"+d;b(a).attr("for")&&b(a).attr("for",b(a).attr("for").replace(i,e));if(a.id)a.id=a.id.replace(i,e);if(a.name)a.name=a.name.replace(i,e)},c=b("#id_"+a.prefix+"-TOTAL_FORMS").attr("autocomplete","off"),g=parseInt(c.val()),f=b("#id_"+a.prefix+"-MAX_NUM_FORMS").attr("autocomplete","off"),c=""==f.val()||0'+a.addText+""),h=b(this).parent().find("tr:last a")):(b(this).filter(":last").after('
'+a.addText+"
"),h=b(this).filter(":last").next().find("a"));h.click(function(){var c=b("#id_"+a.prefix+ 3 | "-TOTAL_FORMS"),e=b("#"+a.prefix+"-empty"),d=e.clone(!0);d.removeClass(a.emptyCssClass).addClass(a.formCssClass).attr("id",a.prefix+"-"+g);d.is("tr")?d.children(":last").append('
'+a.deleteText+"
"):d.is("ul")||d.is("ol")?d.append('
  • '+a.deleteText+"
  • "):d.children(":first").append(''+a.deleteText+ 4 | "");d.find("*").each(function(){j(this,a.prefix,c.val())});d.insertBefore(b(e));b(c).val(parseInt(c.val())+1);g+=1;""!=f.val()&&0>=f.val()-c.val()&&h.parent().hide();d.find("a."+a.deleteCssClass).click(function(){var c=b(this).parents("."+a.formCssClass);c.remove();g-=1;a.removed&&a.removed(c);c=b("."+a.formCssClass);b("#id_"+a.prefix+"-TOTAL_FORMS").val(c.length);(""==f.val()||0 0) { 25 | values.push($(field).val()); 26 | } 27 | }) 28 | field.val(URLify(values.join(' '), maxLength)); 29 | }; 30 | 31 | $(dependencies.join(',')).keyup(populate).change(populate).focus(populate); 32 | }); 33 | }; 34 | })(django.jQuery); 35 | -------------------------------------------------------------------------------- /example/test_project/static/admin/js/prepopulate.min.js: -------------------------------------------------------------------------------- 1 | (function(a){a.fn.prepopulate=function(d,e){return this.each(function(){var b=a(this);b.data("_changed",!1);b.change(function(){b.data("_changed",!0)});var c=function(){if(!0!=b.data("_changed")){var c=[];a.each(d,function(b,d){0 2 | 3 | 4 | 5 | Highcharts Example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 98 | 99 | 100 | 101 | 102 | 103 |
    104 | 105 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /example/test_project/static/model_report/js/highcharts/examples/area-missing.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Highcharts Example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 92 | 93 | 94 | 95 | 96 | 97 |
    98 | 99 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /example/test_project/static/model_report/js/highcharts/examples/area-negative.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Highcharts Example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 62 | 63 | 64 | 65 | 66 | 67 |
    68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /example/test_project/static/model_report/js/highcharts/examples/area-stacked-percent.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Highcharts Example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 89 | 90 | 91 | 92 | 93 | 94 |
    95 | 96 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /example/test_project/static/model_report/js/highcharts/examples/area-stacked.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Highcharts Example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 93 | 94 | 95 | 96 | 97 | 98 |
    99 | 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /example/test_project/static/model_report/js/highcharts/examples/areaspline.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Highcharts Example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 92 | 93 | 94 | 95 | 96 | 97 |
    98 | 99 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /example/test_project/static/model_report/js/highcharts/examples/bar-basic.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Highcharts Example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 93 | 94 | 95 | 96 | 97 | 98 |
    99 | 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /example/test_project/static/model_report/js/highcharts/examples/bar-stacked.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Highcharts Example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 74 | 75 | 76 | 77 | 78 | 79 |
    80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /example/test_project/static/model_report/js/highcharts/examples/column-basic.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Highcharts Example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 104 | 105 | 106 | 107 | 108 | 109 |
    110 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /example/test_project/static/model_report/js/highcharts/examples/column-negative.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Highcharts Example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 62 | 63 | 64 | 65 | 66 | 67 |
    68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /example/test_project/static/model_report/js/highcharts/examples/column-stacked-and-grouped.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Highcharts Example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 86 | 87 | 88 | 89 | 90 | 91 |
    92 | 93 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /example/test_project/static/model_report/js/highcharts/examples/column-stacked-percent.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Highcharts Example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 70 | 71 | 72 | 73 | 74 | 75 |
    76 | 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /example/test_project/static/model_report/js/highcharts/examples/column-stacked.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Highcharts Example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 93 | 94 | 95 | 96 | 97 | 98 |
    99 | 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /example/test_project/static/model_report/js/highcharts/examples/combo-regression.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Highcharts Example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 66 | 67 | 68 | 69 | 70 | 71 |
    72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /example/test_project/static/model_report/js/highcharts/examples/combo.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Highcharts Example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 104 | 105 | 106 | 107 | 108 | 109 |
    110 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /example/test_project/static/model_report/js/highcharts/examples/dynamic-click-to-add.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Highcharts Example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 95 | 96 | 97 | 98 | 99 | 100 |
    101 | 102 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /example/test_project/static/model_report/js/highcharts/examples/line-basic.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Highcharts Example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 88 | 89 | 90 | 91 | 92 | 93 |
    94 | 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /example/test_project/static/model_report/js/highcharts/examples/line-labels.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Highcharts Example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 73 | 74 | 75 | 76 | 77 | 78 |
    79 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /example/test_project/static/model_report/js/highcharts/examples/pie-basic.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Highcharts Example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 76 | 77 | 78 | 79 | 80 | 81 |
    82 | 83 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /example/test_project/static/model_report/js/highcharts/examples/pie-legend.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Highcharts Example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 72 | 73 | 74 | 75 | 76 | 77 |
    78 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /example/test_project/static/model_report/js/highcharts/examples/spline-inverted.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Highcharts Example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 94 | 95 | 96 | 97 | 98 | 99 |
    100 | 101 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /example/test_project/static/model_report/js/highcharts/examples/spline-symbols.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Highcharts Example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 94 | 95 | 96 | 97 | 98 | 99 |
    100 | 101 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /example/test_project/static/model_report/js/highcharts/exporting-server/index.php: -------------------------------------------------------------------------------- 1 | $output"; 74 | echo "Error while converting SVG"; 75 | } 76 | 77 | // stream it 78 | else { 79 | header("Content-Disposition: attachment; filename=$filename.$ext"); 80 | header("Content-Type: $type"); 81 | echo file_get_contents($outfile); 82 | } 83 | 84 | // delete it 85 | unlink("temp/$tempName.svg"); 86 | unlink($outfile); 87 | 88 | // SVG can be streamed directly back 89 | } else if ($ext == 'svg') { 90 | header("Content-Disposition: attachment; filename=$filename.$ext"); 91 | header("Content-Type: $type"); 92 | echo $svg; 93 | 94 | } else { 95 | echo "Invalid type"; 96 | } 97 | ?> 98 | -------------------------------------------------------------------------------- /example/test_project/static/model_report/js/highcharts/graphics/skies.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/static/model_report/js/highcharts/graphics/skies.jpg -------------------------------------------------------------------------------- /example/test_project/static/model_report/js/highcharts/graphics/snow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/static/model_report/js/highcharts/graphics/snow.png -------------------------------------------------------------------------------- /example/test_project/static/model_report/js/highcharts/graphics/sun.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/example/test_project/static/model_report/js/highcharts/graphics/sun.png -------------------------------------------------------------------------------- /example/test_project/static/model_report/js/highcharts/js/adapters/mootools-adapter.js: -------------------------------------------------------------------------------- 1 | /* 2 | Highcharts JS v2.1.9 (2011-11-11) 3 | MooTools adapter 4 | 5 | (c) 2010-2011 Torstein H?nsi 6 | 7 | License: www.highcharts.com/license 8 | */ 9 | (function(){var e=window,h=e.MooTools.version.substring(0,3),i=h==="1.2"||h==="1.1",m=i||h==="1.3",j=e.$extend||function(){return Object.append.apply(Object,arguments)};e.HighchartsAdapter={init:function(a){var b=Fx.prototype,c=b.start,d=Fx.Morph.prototype,g=d.compute;b.start=function(f){var k=this.element;if(f.d)this.paths=a.init(k,k.d,this.toD);c.apply(this,arguments);return this};d.compute=function(f,k,n){var l=this.paths;if(l)this.element.attr("d",a.step(l[0],l[1],n,this.toD));else return g.apply(this, 10 | arguments)}},animate:function(a,b,c){var d=a.attr,g=c&&c.complete;if(d&&!a.setStyle){a.getStyle=a.attr;a.setStyle=function(){var f=arguments;a.attr.call(a,f[0],f[1][0])};a.$family=a.uid=true}e.HighchartsAdapter.stop(a);c=new Fx.Morph(d?a:$(a),j({transition:Fx.Transitions.Quad.easeInOut},c));if(b.d)c.toD=b.d;g&&c.addEvent("complete",g);c.start(b);a.fx=c},each:function(a,b){return i?$each(a,b):a.each(b)},map:function(a,b){return a.map(b)},grep:function(a,b){return a.filter(b)},merge:function(){var a= 11 | arguments,b=[{}],c=a.length;if(i)a=$merge.apply(null,a);else{for(;c--;)if(typeof a[c]!=="boolean")b[c+1]=a[c];a=Object.merge.apply(Object,b)}return a},extendWithEvents:function(a){a.addEvent||(a.nodeName?$(a):j(a,new Events))},addEvent:function(a,b,c){if(typeof b==="string"){if(b==="unload")b="beforeunload";e.HighchartsAdapter.extendWithEvents(a);a.addEvent(b,c)}},removeEvent:function(a,b,c){if(typeof a!=="string"){e.HighchartsAdapter.extendWithEvents(a);if(b){if(b==="unload")b="beforeunload";c?a.removeEvent(b, 12 | c):a.removeEvents(b)}else a.removeEvents()}},fireEvent:function(a,b,c,d){b={type:b,target:a};b=m?new Event(b):new DOMEvent(b);b=j(b,c);b.preventDefault=function(){d=null};a.fireEvent&&a.fireEvent(b.type,b);d&&d(b)},stop:function(a){a.fx&&a.fx.cancel()}}})(); 13 | -------------------------------------------------------------------------------- /example/test_project/static/model_report/js/highcharts/js/adapters/prototype-adapter.js: -------------------------------------------------------------------------------- 1 | /* 2 | Highcharts JS v2.1.9 (2011-11-11) 3 | Prototype adapter 4 | 5 | @author Michael Nelson, Torstein H?nsi. 6 | 7 | Feel free to use and modify this script. 8 | Highcharts license: www.highcharts.com/license. 9 | */ 10 | var HighchartsAdapter=function(){var g=typeof Effect!=="undefined";return{init:function(c){if(g)Effect.HighchartsTransition=Class.create(Effect.Base,{initialize:function(a,b,d,e){var f;this.element=a;this.key=b;f=a.attr(b);if(b==="d"){this.paths=c.init(a,a.d,d);this.toD=d;f=0;d=1}this.start(Object.extend(e||{},{from:f,to:d,attribute:b}))},setup:function(){HighchartsAdapter._extend(this.element);if(!this.element._highchart_animation)this.element._highchart_animation={};this.element._highchart_animation[this.key]= 11 | this},update:function(a){var b=this.paths;if(b)a=c.step(b[0],b[1],a,this.toD);this.element.attr(this.options.attribute,a)},finish:function(){delete this.element._highchart_animation[this.key]}})},addNS:function(c){var a=/^(?:click|mouse(?:down|up|over|move|out))$/;return/^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/.test(c)||a.test(c)?c:"h:"+c},addEvent:function(c,a,b){if(c.addEventListener||c.attachEvent)Event.observe($(c),HighchartsAdapter.addNS(a),b);else{HighchartsAdapter._extend(c); 12 | c._highcharts_observe(a,b)}},animate:function(c,a,b){var d;b=b||{};b.delay=0;b.duration=(b.duration||500)/1E3;if(g)for(d in a)new Effect.HighchartsTransition($(c),d,a[d],b);else for(d in a)c.attr(d,a[d]);if(!c.attr)throw"Todo: implement animate DOM objects";},stop:function(c){var a;if(c._highcharts_extended&&c._highchart_animation)for(a in c._highchart_animation)c._highchart_animation[a].cancel()},each:function(c,a){$A(c).each(a)},fireEvent:function(c,a,b,d){if(c.fire)c.fire(HighchartsAdapter.addNS(a), 13 | b);else if(c._highcharts_extended){b=b||{};c._highcharts_fire(a,b)}if(b&&b.defaultPrevented)d=null;d&&d(b)},removeEvent:function(c,a,b){if($(c).stopObserving){if(a)a=HighchartsAdapter.addNS(a);$(c).stopObserving(a,b)}if(window===c)Event.stopObserving(c,a,b);else{HighchartsAdapter._extend(c);c._highcharts_stop_observing(a,b)}},grep:function(c,a){return c.findAll(a)},map:function(c,a){return c.map(a)},merge:function(){function c(a,b){var d,e;for(e in b){d=b[e];a[e]=d&&typeof d==="object"&&d.constructor!== 14 | Array&&typeof d.nodeType!=="number"?c(a[e]||{},d):b[e]}return a}return function(){var a=arguments,b,d={};for(b=0;b{{ report.get_title }} 3 | -------------------------------------------------------------------------------- /example/test_project/templates/model_report/includes/report_title.html: -------------------------------------------------------------------------------- 1 |

    {{ report.get_title }}

    2 | -------------------------------------------------------------------------------- /example/test_project/templates/model_report/report_list.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% load i18n %} 3 | 4 | {% block title %}{% trans "Report list" %}{% endblock %} 5 | 6 | {% block body_class %}reports{% endblock %} 7 | 8 | {% block sidebar %} 9 | {% include "model_report/includes/report_nav.html" %} 10 | {% endblock %} 11 | -------------------------------------------------------------------------------- /example/test_project/urls.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | try: 3 | from django.conf.urls.defaults import * 4 | except ImportError: 5 | from django.conf.urls import patterns, url, include 6 | 7 | from django.contrib import admin 8 | admin.autodiscover() 9 | 10 | from model_report import report 11 | report.autodiscover() 12 | 13 | 14 | urlpatterns = patterns('', 15 | url(r'^admin/', include(admin.site.urls)), 16 | url(r'', include('model_report.urls')), 17 | ) 18 | -------------------------------------------------------------------------------- /example/test_project/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for test_project project. 3 | 4 | This module contains the WSGI application used by Django's development server 5 | and any production WSGI deployments. It should expose a module-level variable 6 | named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover 7 | this application via the ``WSGI_APPLICATION`` setting. 8 | 9 | Usually you will have the standard Django WSGI application here, but it also 10 | might make sense to replace the whole Django WSGI application with a custom one 11 | that later delegates to the Django one. For example, you could introduce WSGI 12 | middleware here, or combine a Django application with an application of another 13 | framework. 14 | 15 | """ 16 | import os 17 | 18 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_project.settings") 19 | 20 | # This application object is used by any WSGI server configured to use this 21 | # file. This includes Django's development server, if the WSGI_APPLICATION 22 | # setting points here. 23 | from django.core.wsgi import get_wsgi_application 24 | application = get_wsgi_application() 25 | 26 | # Apply WSGI middleware here. 27 | # from helloworld.wsgi import HelloWorldApplication 28 | # application = HelloWorldApplication(application) 29 | -------------------------------------------------------------------------------- /model_report/__init__.py: -------------------------------------------------------------------------------- 1 | VERSION = (0, 2, 1, 'alpha') 2 | 3 | # Dynamically calculate the version based on VERSION tuple 4 | if len(VERSION) > 2 and VERSION[2] is not None: 5 | if isinstance(VERSION[2], int): 6 | str_version = "%s.%s.%s" % VERSION[:3] 7 | else: 8 | str_version = "%s.%s_%s" % VERSION[:3] 9 | else: 10 | str_version = "%s.%s" % VERSION[:2] 11 | 12 | __version__ = str_version 13 | -------------------------------------------------------------------------------- /model_report/exporters/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/model_report/exporters/__init__.py -------------------------------------------------------------------------------- /model_report/exporters/base.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | class Exporter(object): 3 | 4 | @classmethod 5 | def render(cls, report, column_labels, report_rows, report_inlines): 6 | raise NotImplementedError() 7 | -------------------------------------------------------------------------------- /model_report/exporters/pdf.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import cStringIO as StringIO 3 | from cgi import escape 4 | from xhtml2pdf import pisa 5 | 6 | from django.template.loader import get_template 7 | from django.template import Context 8 | from django.http import HttpResponse 9 | 10 | from .base import Exporter 11 | 12 | 13 | class PdfExporter(Exporter): 14 | 15 | @classmethod 16 | def render(cls, report, column_labels, report_rows, report_inlines): 17 | # where is_export is being used? 18 | setattr(report, 'is_export', True) 19 | context_dict = { 20 | 'report': report, 21 | 'column_labels': column_labels, 22 | 'report_rows': report_rows, 23 | 'report_inlines': report_inlines, 24 | 'pagesize': 'legal landscape' 25 | } 26 | template = get_template('model_report/export_pdf.html') 27 | context = Context(context_dict) 28 | html = template.render(context) 29 | result = StringIO.StringIO() 30 | pdf_encoding='UTF-8' 31 | 32 | pdf = pisa.CreatePDF(StringIO.StringIO(html.encode(pdf_encoding)), result, encoding=pdf_encoding) 33 | 34 | if not pdf.err: 35 | response = HttpResponse(result.getvalue(), content_type='application/pdf') 36 | response['Content-Disposition'] = 'attachment; filename=%s.pdf' % report.slug 37 | else: 38 | response = HttpResponse('We had some errors
    %s
    ' % escape(html)) 39 | 40 | result.close() 41 | return response 42 | -------------------------------------------------------------------------------- /model_report/highcharts/base.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from django.utils.translation import ugettext_lazy 3 | from django.utils.encoding import force_unicode 4 | 5 | 6 | true = 'true' 7 | false = 'false' 8 | null = 'null' 9 | undefined = 'undefined' 10 | Solid = 'Solid' 11 | outside = 'outside' 12 | 13 | 14 | _ = lambda s: force_unicode(ugettext_lazy(s)) 15 | 16 | 17 | class CollectionObject(object): 18 | """ 19 | Class to represent collection of dict values 20 | """ 21 | _dicts = null 22 | 23 | def __init__(self): 24 | self._dicts = [] 25 | 26 | def add(self, obj): 27 | self._dicts.append(obj) 28 | 29 | def __repr__(self): 30 | return unicode(self._dicts) 31 | 32 | 33 | class DictObject: 34 | """ 35 | Class to represent dict values 36 | """ 37 | 38 | def __init__(self, **default): 39 | x = dict([(k, v if isinstance(v, (DictObject, CollectionObject)) else null) for k, v in default.items()]) 40 | self.__dict__.update(x) 41 | 42 | def update(self, **kwargs): 43 | self.__dict__.update(kwargs) 44 | 45 | def __repr__(self): 46 | data = {} 47 | for k, v in self.__dict__.items(): 48 | if v != 'null': 49 | if isinstance(v, (type(ugettext_lazy(' ')))): 50 | v = _(v) 51 | if isinstance(v, (bool)): 52 | v = str(v).lower() 53 | if v == ('null',): 54 | v = 'null' 55 | if unicode(v): 56 | data[k] = v 57 | if not data: 58 | data = "" 59 | return unicode(data) 60 | 61 | def create(self, **defaults): 62 | obj = DictObject(**self.__dict__) 63 | obj.update(**defaults) 64 | return obj 65 | -------------------------------------------------------------------------------- /model_report/locale/es/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/model_report/locale/es/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /model_report/locale/lt/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/model_report/locale/lt/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /model_report/static/model_report/css/images/ui-bg_flat_0_aaaaaa_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/model_report/static/model_report/css/images/ui-bg_flat_0_aaaaaa_40x100.png -------------------------------------------------------------------------------- /model_report/static/model_report/css/images/ui-bg_flat_0_eeeeee_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/model_report/static/model_report/css/images/ui-bg_flat_0_eeeeee_40x100.png -------------------------------------------------------------------------------- /model_report/static/model_report/css/images/ui-bg_flat_55_ffffff_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/model_report/static/model_report/css/images/ui-bg_flat_55_ffffff_40x100.png -------------------------------------------------------------------------------- /model_report/static/model_report/css/images/ui-bg_flat_75_ffffff_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/model_report/static/model_report/css/images/ui-bg_flat_75_ffffff_40x100.png -------------------------------------------------------------------------------- /model_report/static/model_report/css/images/ui-bg_glass_65_ffffff_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/model_report/static/model_report/css/images/ui-bg_glass_65_ffffff_1x400.png -------------------------------------------------------------------------------- /model_report/static/model_report/css/images/ui-bg_highlight-soft_100_f6f6f6_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/model_report/static/model_report/css/images/ui-bg_highlight-soft_100_f6f6f6_1x100.png -------------------------------------------------------------------------------- /model_report/static/model_report/css/images/ui-bg_highlight-soft_25_0073ea_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/model_report/static/model_report/css/images/ui-bg_highlight-soft_25_0073ea_1x100.png -------------------------------------------------------------------------------- /model_report/static/model_report/css/images/ui-bg_highlight-soft_50_dddddd_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/model_report/static/model_report/css/images/ui-bg_highlight-soft_50_dddddd_1x100.png -------------------------------------------------------------------------------- /model_report/static/model_report/css/images/ui-icons_0073ea_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/model_report/static/model_report/css/images/ui-icons_0073ea_256x240.png -------------------------------------------------------------------------------- /model_report/static/model_report/css/images/ui-icons_454545_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/model_report/static/model_report/css/images/ui-icons_454545_256x240.png -------------------------------------------------------------------------------- /model_report/static/model_report/css/images/ui-icons_666666_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/model_report/static/model_report/css/images/ui-icons_666666_256x240.png -------------------------------------------------------------------------------- /model_report/static/model_report/css/images/ui-icons_ff0084_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/model_report/static/model_report/css/images/ui-icons_ff0084_256x240.png -------------------------------------------------------------------------------- /model_report/static/model_report/css/images/ui-icons_ffffff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/model_report/static/model_report/css/images/ui-icons_ffffff_256x240.png -------------------------------------------------------------------------------- /model_report/static/model_report/js/highcharts/examples/analytics.tsv: -------------------------------------------------------------------------------- 1 | # ---------------------------------------- 2 | highcharts.com 3 | Daily visits 4 | September 5, 2010 October 5, 2010 5 | # ---------------------------------------- 6 | 7 | # ---------------------------------------- 8 | # Graph 9 | # ---------------------------------------- 10 | Day All Visits (Segment) New Visitors (Segment) 11 | Sunday, September 5, 2010 966 433 12 | Monday, September 6, 2010 2,475 983 13 | Tuesday, September 7, 2010 3,336 1,463 14 | Wednesday, September 8, 2010 3,211 1,316 15 | Thursday, September 9, 2010 3,229 1,351 16 | Friday, September 10, 2010 2,802 1,270 17 | Saturday, September 11, 2010 1,168 604 18 | Sunday, September 12, 2010 1,110 498 19 | Monday, September 13, 2010 3,112 1,352 20 | Tuesday, September 14, 2010 3,590 1,626 21 | Wednesday, September 15, 2010 3,529 1,549 22 | Thursday, September 16, 2010 3,519 1,574 23 | Friday, September 17, 2010 3,696 1,680 24 | Saturday, September 18, 2010 1,400 677 25 | Sunday, September 19, 2010 1,302 603 26 | Monday, September 20, 2010 3,348 1,472 27 | Tuesday, September 21, 2010 3,606 1,570 28 | Wednesday, September 22, 2010 3,320 1,438 29 | Thursday, September 23, 2010 2,677 1,140 30 | Friday, September 24, 2010 2,795 1,256 31 | Saturday, September 25, 2010 1,299 589 32 | Sunday, September 26, 2010 1,189 533 33 | Monday, September 27, 2010 3,189 1,253 34 | Tuesday, September 28, 2010 3,223 1,266 35 | Wednesday, September 29, 2010 3,231 1,249 36 | Thursday, September 30, 2010 3,608 1,684 37 | Friday, October 1, 2010 2,945 1,185 38 | Saturday, October 2, 2010 1,058 460 39 | Sunday, October 3, 2010 1,114 499 40 | Monday, October 4, 2010 2,774 1,131 41 | Tuesday, October 5, 2010 2,679 1,047 42 | 43 | # ---------------------------------------- 44 | # Table 45 | # ---------------------------------------- 46 | Day Visits New Visits 47 | Friday, September 17, 2010 48 | All Visits 3696 1680 49 | New Visitors 1680 1680 50 | % of Total 0.45454545454545453 1.0 51 | Thursday, September 30, 2010 52 | All Visits 3608 1684 53 | New Visitors 1684 1684 54 | % of Total 0.46674057649667405 1.0 55 | Tuesday, September 21, 2010 56 | All Visits 3606 1570 57 | New Visitors 1570 1570 58 | % of Total 0.4353854686633389 1.0 59 | Tuesday, September 14, 2010 60 | All Visits 3590 1626 61 | New Visitors 1626 1626 62 | % of Total 0.452924791086351 1.0 63 | Wednesday, September 15, 2010 64 | All Visits 3529 1549 65 | New Visitors 1549 1549 66 | % of Total 0.4389345423632757 1.0 67 | Thursday, September 16, 2010 68 | All Visits 3519 1574 69 | New Visitors 1574 1574 70 | % of Total 0.44728616084114803 1.0 71 | Monday, September 20, 2010 72 | All Visits 3348 1472 73 | New Visitors 1472 1472 74 | % of Total 0.43966547192353644 1.0 75 | Tuesday, September 7, 2010 76 | All Visits 3336 1463 77 | New Visitors 1463 1463 78 | % of Total 0.4385491606714628 1.0 79 | Wednesday, September 22, 2010 80 | All Visits 3320 1438 81 | New Visitors 1438 1438 82 | % of Total 0.4331325301204819 1.0 83 | Wednesday, September 29, 2010 84 | All Visits 3231 1249 85 | New Visitors 1249 1249 86 | % of Total 0.3865676261219437 1.0 87 | # -------------------------------------------------------------------------------- 88 | -------------------------------------------------------------------------------- /model_report/static/model_report/js/highcharts/examples/area-inverted.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Highcharts Example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 98 | 99 | 100 | 101 | 102 | 103 |
    104 | 105 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /model_report/static/model_report/js/highcharts/examples/area-missing.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Highcharts Example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 92 | 93 | 94 | 95 | 96 | 97 |
    98 | 99 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /model_report/static/model_report/js/highcharts/examples/area-negative.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Highcharts Example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 62 | 63 | 64 | 65 | 66 | 67 |
    68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /model_report/static/model_report/js/highcharts/examples/area-stacked-percent.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Highcharts Example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 89 | 90 | 91 | 92 | 93 | 94 |
    95 | 96 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /model_report/static/model_report/js/highcharts/examples/area-stacked.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Highcharts Example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 93 | 94 | 95 | 96 | 97 | 98 |
    99 | 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /model_report/static/model_report/js/highcharts/examples/areaspline.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Highcharts Example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 92 | 93 | 94 | 95 | 96 | 97 |
    98 | 99 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /model_report/static/model_report/js/highcharts/examples/bar-basic.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Highcharts Example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 93 | 94 | 95 | 96 | 97 | 98 |
    99 | 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /model_report/static/model_report/js/highcharts/examples/bar-stacked.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Highcharts Example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 74 | 75 | 76 | 77 | 78 | 79 |
    80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /model_report/static/model_report/js/highcharts/examples/column-basic.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Highcharts Example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 104 | 105 | 106 | 107 | 108 | 109 |
    110 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /model_report/static/model_report/js/highcharts/examples/column-negative.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Highcharts Example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 62 | 63 | 64 | 65 | 66 | 67 |
    68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /model_report/static/model_report/js/highcharts/examples/column-stacked-and-grouped.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Highcharts Example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 86 | 87 | 88 | 89 | 90 | 91 |
    92 | 93 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /model_report/static/model_report/js/highcharts/examples/column-stacked-percent.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Highcharts Example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 70 | 71 | 72 | 73 | 74 | 75 |
    76 | 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /model_report/static/model_report/js/highcharts/examples/column-stacked.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Highcharts Example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 93 | 94 | 95 | 96 | 97 | 98 |
    99 | 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /model_report/static/model_report/js/highcharts/examples/combo-regression.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Highcharts Example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 66 | 67 | 68 | 69 | 70 | 71 |
    72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /model_report/static/model_report/js/highcharts/examples/combo.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Highcharts Example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 104 | 105 | 106 | 107 | 108 | 109 |
    110 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /model_report/static/model_report/js/highcharts/examples/dynamic-click-to-add.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Highcharts Example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 95 | 96 | 97 | 98 | 99 | 100 |
    101 | 102 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /model_report/static/model_report/js/highcharts/examples/dynamic-update.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Highcharts Example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 104 | 105 | 106 | 107 | 108 | 109 |
    110 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /model_report/static/model_report/js/highcharts/examples/line-basic.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Highcharts Example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 88 | 89 | 90 | 91 | 92 | 93 |
    94 | 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /model_report/static/model_report/js/highcharts/examples/line-labels.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Highcharts Example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 73 | 74 | 75 | 76 | 77 | 78 |
    79 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /model_report/static/model_report/js/highcharts/examples/pie-basic.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Highcharts Example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 76 | 77 | 78 | 79 | 80 | 81 |
    82 | 83 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /model_report/static/model_report/js/highcharts/examples/pie-legend.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Highcharts Example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 72 | 73 | 74 | 75 | 76 | 77 |
    78 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /model_report/static/model_report/js/highcharts/examples/spline-inverted.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Highcharts Example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 94 | 95 | 96 | 97 | 98 | 99 |
    100 | 101 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /model_report/static/model_report/js/highcharts/examples/spline-symbols.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Highcharts Example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 94 | 95 | 96 | 97 | 98 | 99 |
    100 | 101 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /model_report/static/model_report/js/highcharts/exporting-server/index.php: -------------------------------------------------------------------------------- 1 | $output"; 74 | echo "Error while converting SVG"; 75 | } 76 | 77 | // stream it 78 | else { 79 | header("Content-Disposition: attachment; filename=$filename.$ext"); 80 | header("Content-Type: $type"); 81 | echo file_get_contents($outfile); 82 | } 83 | 84 | // delete it 85 | unlink("temp/$tempName.svg"); 86 | unlink($outfile); 87 | 88 | // SVG can be streamed directly back 89 | } else if ($ext == 'svg') { 90 | header("Content-Disposition: attachment; filename=$filename.$ext"); 91 | header("Content-Type: $type"); 92 | echo $svg; 93 | 94 | } else { 95 | echo "Invalid type"; 96 | } 97 | ?> 98 | -------------------------------------------------------------------------------- /model_report/static/model_report/js/highcharts/graphics/skies.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/model_report/static/model_report/js/highcharts/graphics/skies.jpg -------------------------------------------------------------------------------- /model_report/static/model_report/js/highcharts/graphics/snow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/model_report/static/model_report/js/highcharts/graphics/snow.png -------------------------------------------------------------------------------- /model_report/static/model_report/js/highcharts/graphics/sun.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/model_report/static/model_report/js/highcharts/graphics/sun.png -------------------------------------------------------------------------------- /model_report/static/model_report/js/highcharts/js/adapters/mootools-adapter.js: -------------------------------------------------------------------------------- 1 | /* 2 | Highcharts JS v2.1.9 (2011-11-11) 3 | MooTools adapter 4 | 5 | (c) 2010-2011 Torstein H?nsi 6 | 7 | License: www.highcharts.com/license 8 | */ 9 | (function(){var e=window,h=e.MooTools.version.substring(0,3),i=h==="1.2"||h==="1.1",m=i||h==="1.3",j=e.$extend||function(){return Object.append.apply(Object,arguments)};e.HighchartsAdapter={init:function(a){var b=Fx.prototype,c=b.start,d=Fx.Morph.prototype,g=d.compute;b.start=function(f){var k=this.element;if(f.d)this.paths=a.init(k,k.d,this.toD);c.apply(this,arguments);return this};d.compute=function(f,k,n){var l=this.paths;if(l)this.element.attr("d",a.step(l[0],l[1],n,this.toD));else return g.apply(this, 10 | arguments)}},animate:function(a,b,c){var d=a.attr,g=c&&c.complete;if(d&&!a.setStyle){a.getStyle=a.attr;a.setStyle=function(){var f=arguments;a.attr.call(a,f[0],f[1][0])};a.$family=a.uid=true}e.HighchartsAdapter.stop(a);c=new Fx.Morph(d?a:$(a),j({transition:Fx.Transitions.Quad.easeInOut},c));if(b.d)c.toD=b.d;g&&c.addEvent("complete",g);c.start(b);a.fx=c},each:function(a,b){return i?$each(a,b):a.each(b)},map:function(a,b){return a.map(b)},grep:function(a,b){return a.filter(b)},merge:function(){var a= 11 | arguments,b=[{}],c=a.length;if(i)a=$merge.apply(null,a);else{for(;c--;)if(typeof a[c]!=="boolean")b[c+1]=a[c];a=Object.merge.apply(Object,b)}return a},extendWithEvents:function(a){a.addEvent||(a.nodeName?$(a):j(a,new Events))},addEvent:function(a,b,c){if(typeof b==="string"){if(b==="unload")b="beforeunload";e.HighchartsAdapter.extendWithEvents(a);a.addEvent(b,c)}},removeEvent:function(a,b,c){if(typeof a!=="string"){e.HighchartsAdapter.extendWithEvents(a);if(b){if(b==="unload")b="beforeunload";c?a.removeEvent(b, 12 | c):a.removeEvents(b)}else a.removeEvents()}},fireEvent:function(a,b,c,d){b={type:b,target:a};b=m?new Event(b):new DOMEvent(b);b=j(b,c);b.preventDefault=function(){d=null};a.fireEvent&&a.fireEvent(b.type,b);d&&d(b)},stop:function(a){a.fx&&a.fx.cancel()}}})(); 13 | -------------------------------------------------------------------------------- /model_report/static/model_report/js/highcharts/js/adapters/prototype-adapter.js: -------------------------------------------------------------------------------- 1 | /* 2 | Highcharts JS v2.1.9 (2011-11-11) 3 | Prototype adapter 4 | 5 | @author Michael Nelson, Torstein H?nsi. 6 | 7 | Feel free to use and modify this script. 8 | Highcharts license: www.highcharts.com/license. 9 | */ 10 | var HighchartsAdapter=function(){var g=typeof Effect!=="undefined";return{init:function(c){if(g)Effect.HighchartsTransition=Class.create(Effect.Base,{initialize:function(a,b,d,e){var f;this.element=a;this.key=b;f=a.attr(b);if(b==="d"){this.paths=c.init(a,a.d,d);this.toD=d;f=0;d=1}this.start(Object.extend(e||{},{from:f,to:d,attribute:b}))},setup:function(){HighchartsAdapter._extend(this.element);if(!this.element._highchart_animation)this.element._highchart_animation={};this.element._highchart_animation[this.key]= 11 | this},update:function(a){var b=this.paths;if(b)a=c.step(b[0],b[1],a,this.toD);this.element.attr(this.options.attribute,a)},finish:function(){delete this.element._highchart_animation[this.key]}})},addNS:function(c){var a=/^(?:click|mouse(?:down|up|over|move|out))$/;return/^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/.test(c)||a.test(c)?c:"h:"+c},addEvent:function(c,a,b){if(c.addEventListener||c.attachEvent)Event.observe($(c),HighchartsAdapter.addNS(a),b);else{HighchartsAdapter._extend(c); 12 | c._highcharts_observe(a,b)}},animate:function(c,a,b){var d;b=b||{};b.delay=0;b.duration=(b.duration||500)/1E3;if(g)for(d in a)new Effect.HighchartsTransition($(c),d,a[d],b);else for(d in a)c.attr(d,a[d]);if(!c.attr)throw"Todo: implement animate DOM objects";},stop:function(c){var a;if(c._highcharts_extended&&c._highchart_animation)for(a in c._highchart_animation)c._highchart_animation[a].cancel()},each:function(c,a){$A(c).each(a)},fireEvent:function(c,a,b,d){if(c.fire)c.fire(HighchartsAdapter.addNS(a), 13 | b);else if(c._highcharts_extended){b=b||{};c._highcharts_fire(a,b)}if(b&&b.defaultPrevented)d=null;d&&d(b)},removeEvent:function(c,a,b){if($(c).stopObserving){if(a)a=HighchartsAdapter.addNS(a);$(c).stopObserving(a,b)}if(window===c)Event.stopObserving(c,a,b);else{HighchartsAdapter._extend(c);c._highcharts_stop_observing(a,b)}},grep:function(c,a){return c.findAll(a)},map:function(c,a){return c.map(a)},merge:function(){function c(a,b){var d,e;for(e in b){d=b[e];a[e]=d&&typeof d==="object"&&d.constructor!== 14 | Array&&typeof d.nodeType!=="number"?c(a[e]||{},d):b[e]}return a}return function(){var a=arguments,b,d={};for(b=0;b 3 | 4 |

    5 | -------------------------------------------------------------------------------- /model_report/templates/model_report/includes/form_config.html: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% if form_config %} 3 | {% with form_config as form %} 4 |
    5 | {% trans "Config chart by" %} 6 | {% include "model_report/includes/form_fields.html" %} 7 |
    8 | {% endwith %} 9 | {% endif %} 10 | -------------------------------------------------------------------------------- /model_report/templates/model_report/includes/form_fields.html: -------------------------------------------------------------------------------- 1 | {% for field in form %} 2 |

    3 | 4 | {{ field }} 5 | 6 | {{ field.errors|join:" " }} 7 | {{ field.help_text }} 8 |

    9 | {% endfor %} 10 | -------------------------------------------------------------------------------- /model_report/templates/model_report/includes/form_filter.html: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% if form_filter %} 3 | {% with form_filter as form %} 4 |
    5 | {% if not form.filter_report_is_all %} 6 | {% trans "Filter results" %} 7 | {% endif %} 8 | {% include "model_report/includes/form_fields.html" %} 9 |
    10 | {% endwith %} 11 | {% endif %} 12 | -------------------------------------------------------------------------------- /model_report/templates/model_report/includes/form_groupby.html: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% if form_groupby %} 3 | {% with form_groupby as form %} 4 |
    5 | {% trans "Group by" %} 6 | {% include "model_report/includes/form_fields.html" %} 7 |
    8 | {% endwith %} 9 | {% endif %} 10 | -------------------------------------------------------------------------------- /model_report/templates/model_report/includes/form_report.html: -------------------------------------------------------------------------------- 1 | {% if form_groupby or form_filter or form_config %} 2 |
    3 |
    4 | {% include "model_report/includes/form_groupby.html" %} 5 | {% include "model_report/includes/form_filter.html" %} 6 | {% include "model_report/includes/form_config.html" %} 7 |

    8 | 9 | {% if report_rows %} 10 | {% for export in report.exports %} 11 | 12 | {% endfor %} 13 | 14 | {% endif %} 15 |

    16 |
    17 |
    18 | {% endif %} 19 | -------------------------------------------------------------------------------- /model_report/templates/model_report/includes/report_chart.html: -------------------------------------------------------------------------------- 1 | {% if chart %} 2 |
    3 | {% endif %} 4 | -------------------------------------------------------------------------------- /model_report/templates/model_report/includes/report_inline.html: -------------------------------------------------------------------------------- 1 | {% if render_report %} 2 | 3 | 4 | {{ report.get_title }} 5 | 6 | 7 | 8 | 9 | {% include "model_report/includes/report_table.html" %} 10 | 11 | 12 | {% endif %} 13 | 14 | -------------------------------------------------------------------------------- /model_report/templates/model_report/includes/report_nav.html: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% for report in report_list %} 3 | {% include "model_report/includes/report_nav_item.html" %} 4 | {% empty %} 5 | {% trans "Empty report list." %} 6 | {% endfor %} 7 | -------------------------------------------------------------------------------- /model_report/templates/model_report/includes/report_nav_item.html: -------------------------------------------------------------------------------- 1 | {{ report.get_title }} 2 | -------------------------------------------------------------------------------- /model_report/templates/model_report/includes/report_table.html: -------------------------------------------------------------------------------- 1 | {% load i18n model_report %} 2 | 3 | 4 | 5 | 6 | {% for column_label in column_labels %} 7 | 8 | {% endfor %} 9 | 10 | 11 | 12 | {% for gruper, rows in report_rows %} 13 | 14 | {% if gruper %} 15 | 16 | 23 | 24 | {% endif %} 25 | 26 | {% for row in rows %} 27 | 28 | {% for value in row %} 29 | 32 | {% endfor %} 33 | 34 | {% if report_inlines and row.is_value %} 35 | {% for inline in report_inlines %} 36 | {% model_report_render_inline inline row %} 37 | {% endfor %} 38 | {% endif %} 39 | {% endfor %} 40 | 41 | {% empty %} 42 | 43 | {% endfor %} 44 | 45 |
    {{ column_label }}
    17 | {% if not report.onlytotals and not rows.0.is_report_totals and not report.is_export %} 18 | - 19 | {% endif %} 20 | {{ gruper|default_if_none:_('Results') }} 21 | {% if report_anchors and not report.parent_report %}{% trans "Go up" %}{% endif %} 22 |
    30 | {{ value|safe }} 31 |
    {% trans "This query has no results" %}
    46 | -------------------------------------------------------------------------------- /model_report/templates/model_report/includes/report_title.html: -------------------------------------------------------------------------------- 1 | {% load i18n %}

    {% trans "Report list" %} » {{ report.get_title }}

    2 | -------------------------------------------------------------------------------- /model_report/templates/model_report/report_list.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% load i18n %} 3 | 4 | {% block title %}{% trans "Report list" %}{% endblock %} 5 | 6 | {% block body_class %}reports{% endblock %} 7 | 8 | 9 | {% block content %} 10 |

    {% trans "Report list" %}

    11 |
      12 |
    • 13 | {% include "model_report/includes/report_nav.html" %} 14 |
    • 15 |
    16 | {% endblock %} 17 | 18 | 19 | -------------------------------------------------------------------------------- /model_report/templates/model_report/widgets/range_widget.html: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 |
    3 |
    4 | {% with min as field %} 5 | 6 | {{ field }} 7 | 8 | {{ field.errors|join:" " }} 9 | {{ field.help_text|safe }} 10 | {% endwith %} 11 |
    12 |
    13 | {% with max as field %} 14 | 15 | {{ field }} 16 | 17 | {{ field.errors|join:" " }} 18 | {{ field.help_text|safe }} 19 | {% endwith %} 20 |
    21 |
    22 | 45 | -------------------------------------------------------------------------------- /model_report/templatetags/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juanpex/django-model-report/6d2fa6175149eb95a1a9829ae3412f38dabb1a32/model_report/templatetags/__init__.py -------------------------------------------------------------------------------- /model_report/templatetags/model_report.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from django import template 3 | from django.template.loader import render_to_string 4 | 5 | 6 | register = template.Library() 7 | 8 | 9 | class ModelReportInlineNode(template.Node): 10 | def __init__(self, inline, row): 11 | self.inline = template.Variable(inline) 12 | self.row = template.Variable(row) 13 | 14 | def render(self, context): 15 | inline = self.inline.resolve(context) 16 | row = self.row.resolve(context) 17 | request = context.get('request') 18 | if row.is_value(): 19 | inline_context = inline.get_render_context(request, by_row=row) 20 | if len(inline_context['report_rows']) > 0: 21 | return render_to_string('model_report/includes/report_inline.html', inline_context) 22 | return '' 23 | 24 | 25 | @register.tag() 26 | def model_report_render_inline(parser, token): 27 | try: 28 | tag_name, inline, row = token.split_contents() 29 | except ValueError: 30 | raise template.TemplateSyntaxError("%r tag requires arguments" % token.contents.split()[0]) 31 | return ModelReportInlineNode(inline, row) 32 | -------------------------------------------------------------------------------- /model_report/urls.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | try: 3 | from django.conf.urls import patterns, url 4 | except ImportError: 5 | from django.conf.urls.defaults import * 6 | 7 | from model_report.views import report, report_list 8 | 9 | 10 | urlpatterns = patterns('', 11 | url(r'^$', report_list, name='model_report_list'), 12 | url(r'^(?P[\w-]+)/$', report, name='model_report_view'), 13 | ) 14 | -------------------------------------------------------------------------------- /model_report/views.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from django.shortcuts import render_to_response 3 | from django.template import RequestContext 4 | from django.http import Http404 5 | 6 | from model_report.report import reports 7 | 8 | 9 | def report_list(request): 10 | """ 11 | This view render all reports registered 12 | """ 13 | context = { 14 | 'report_list': reports.get_reports() 15 | } 16 | return render_to_response('model_report/report_list.html', context, 17 | context_instance=RequestContext(request)) 18 | 19 | 20 | def report(request, slug): 21 | """ 22 | This view render one report 23 | 24 | Keywords arguments: 25 | 26 | slug -- slug of the report 27 | """ 28 | report_class = reports.get_report(slug) 29 | if not report_class: 30 | raise Http404 31 | context = { 32 | 'report_list': reports.get_reports() 33 | } 34 | 35 | report = report_class(request=request) 36 | return report.render(request, extra_context=context) 37 | -------------------------------------------------------------------------------- /model_report/widgets.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from django import forms 3 | from django.template.loader import render_to_string 4 | from django.utils.translation import ugettext as _ 5 | from django.utils.encoding import force_unicode 6 | 7 | 8 | class RangeWidget(forms.MultiWidget): 9 | """ 10 | Render 2 inputs with vDatepicker class in order to select a date range. 11 | """ 12 | def __init__(self, widget, *args, **kwargs): 13 | widgets = (widget, widget) 14 | kwargs['attrs'] = {'class': 'vDatepicker'} 15 | super(RangeWidget, self).__init__(widgets=widgets, *args, **kwargs) 16 | 17 | def decompress(self, value): 18 | return value 19 | 20 | def format_output(self, rendered_widgets): 21 | widget_context = {'min': rendered_widgets[0], 'max': rendered_widgets[1]} 22 | return render_to_string('model_report/widgets/range_widget.html', widget_context) 23 | 24 | 25 | class RangeField(forms.MultiValueField): 26 | """ 27 | Field to filter date values by range. 28 | """ 29 | default_error_messages = { 30 | 'invalid_start': _(u'Enter a valid start value.'), 31 | 'invalid_end': _(u'Enter a valid end value.'), 32 | } 33 | 34 | def __init__(self, field_class, widget=forms.TextInput, *args, **kwargs): 35 | if not 'initial' in kwargs: 36 | kwargs['initial'] = ['', ''] 37 | 38 | fields = (field_class(), field_class()) 39 | 40 | super(RangeField, self).__init__( 41 | fields=fields, 42 | widget=RangeWidget(widget), 43 | *args, **kwargs 44 | ) 45 | self.label = force_unicode(field_class().label) 46 | 47 | def compress(self, data_list): 48 | if data_list: 49 | return [self.fields[0].clean(data_list[0]), self.fields[1].clean(data_list[1])] 50 | return None 51 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | django==1.4 2 | reportlab 3 | html5lib 4 | BeautifulSoup 5 | psycopg2==2.4.5 6 | dj-database-url==0.2.0 7 | xlwt==0.7.4 8 | xhtml2pdf 9 | 10 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from os.path import join, dirname 3 | from setuptools import setup, find_packages 4 | 5 | 6 | version = __import__('model_report').__version__ 7 | 8 | 9 | LONG_DESCRIPTION = """ 10 | django-model-report 11 | =================== 12 | 13 | django reports integrated with highcharts 14 | 15 | $ git clone git://github.com/juanpex/django-model-report.git 16 | """ 17 | 18 | 19 | def long_description(): 20 | try: 21 | return open(join(dirname(__file__), 'README.md')).read() 22 | except IOError: 23 | return LONG_DESCRIPTION 24 | 25 | 26 | setup(name='django-model-report', 27 | version=version, 28 | author='juanpex', 29 | author_email='jpma55@gmail.com', 30 | description='Django reports integrated with highcharts.', 31 | license='BSD', 32 | keywords='django, model, report, reports, highcharts, chart, charts', 33 | url='https://github.com/juanpex/django-model-report', 34 | packages=find_packages(), 35 | include_package_data=True, 36 | zip_safe=False, 37 | long_description=long_description(), 38 | install_requires=[ 39 | 'django>=1.3', 40 | 'reportlab', 41 | 'html5lib', 42 | 'BeautifulSoup', 43 | 'xhtml2pdf', 44 | 'xlwt==0.7.4', 45 | ], 46 | classifiers=['Framework :: Django', 47 | 'Development Status :: 3 - Alpha', 48 | 'Topic :: Internet', 49 | 'License :: OSI Approved :: BSD License', 50 | 'Intended Audience :: Developers', 51 | 'Environment :: Web Environment', 52 | 'Programming Language :: Python :: 2.5', 53 | 'Programming Language :: Python :: 2.6', 54 | 'Programming Language :: Python :: 2.7']) 55 | --------------------------------------------------------------------------------