Code Monkey home page Code Monkey logo

django-model-report's People

Contributors

arjunnambiartc avatar bitdeli-chef avatar ckinsey avatar cosseyluke avatar cristi23 avatar edos21 avatar ffreckle avatar javierwilson avatar jelenak avatar juanpex avatar lev-veshnyakov avatar masonm avatar pkropf avatar rmaceissoft avatar soybackend avatar suvit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-model-report's Issues

[Question] check_permissions

How can I check to make sure the user is logged in and has permission to run the reports?

And if they don't, prevent access.

Can't use list_group_by or list_filter

Hi, i'm new with django-model-report and I tried to make simple reports for the User model. Here is my code

class UserReport(ReportAdmin):
    model = User
    fields = ('username', 'email', 'first_name', 'last_name', 'last_login', 'date_joined')
    list_group_by = ('date_joined__year', 'date_joined__month')
    list_filter = ('is_active',)

I can list the users but i don't have the group and filter options, only a "Get results" button. If I add to list_group_by or list_filter the "username" field for testing, i can see the option to filter and group but only for this field, not for the other ones.

Also, if i add, for example "date_joined__year" I get an AttributeError: 'NoneType' object has no attribute 'to' when trying to use reportings.

Am I doing something wrong or this is a bug?

The installation of django-report-model gives error in python3 due to the dependency BeautifulSoup

Here is the error:

Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\username\AppData\Local\Temp\pip-install-62dcohsu\BeautifulSoup\setup.py", line 22
        print "Unit tests have failed!"
                                      ^
    SyntaxError: Missing parentheses in call to 'print'

I am not sure but a fix can be using beautifulsoup4 which is supported by python 3.

[Question] How to set Column width

I have a text field I want to put on my report but it only display it as 14px. Is there a way to change this dynamically on a per field basis?

Documentation Examples

This repo has a lot of potential, but it lacks core documentation that will allow it to be more widely used.
Consequently, I've been having a hard time trying to use this tool. I've mostly been trying to digest the source code.

Filter items with a FK relation

I am having issues with adding some filters that have a foreign key relation, this only seems to be an issue with the filters and not the regular fields dict.

This works fine and correctly displays my product:
fields = [
'result__product',
]

But if I try to do the same thing in the filters I get the str method on that model class returned.
list_filter = ('date_timestamp', 'status__status', 'result__product',)

The report is built off this model:

class ResultDetail(models.Model):
"""
Test result detail record
"""
result = models.ForeignKey(Result)
status = models.ForeignKey(ResultStatus)
station = models.ForeignKey(TestSet, blank=True)
stage = models.ForeignKey(Stage, blank=True)
operator = models.ForeignKey(User, related_name='test_operator')
failstep = models.CharField(max_length=100, null=True, blank=True)
shift = models.IntegerField(null=True, blank=True)
date_added = models.DateField(auto_now_add=True, default=datetime.now())
date_timestamp = models.DateTimeField(auto_now_add=True, default=datetime.now())
date_time = models.TimeField(blank=False, null=False, auto_now_add=True, default=datetime.now())

class Meta:
    db_table = 'test_result_detail'
    verbose_name = 'Test Result Detail'
    verbose_name_plural = 'Test Result Details'

And the result field has a FK relation to this model:

class Result(models.Model):
"""
Parent test result record
"""
serial = models.CharField(max_length=50, null=False, blank=False)
sequence = models.ForeignKey(ProductStageSequence, null=True)
last_completed_stage = models.IntegerField(null=True, blank=True)
last_completed_sequence = models.IntegerField(null=True, blank=True)
workorder = models.CharField(max_length=10, blank=True, null=True)
product = models.CharField(max_length=50, blank=True, null=True)
is_complete = models.BooleanField(default=False, null=False, blank=False)
is_scrapped = models.BooleanField(default=False, null=False, blank=False)
value_stream = models.CharField(max_length=50, blank=True, null=True)
promise_date = models.DateField(blank=True, null=True)
sequence_rev = models.IntegerField(blank=True, null=True)
fail_lock = models.BooleanField(default=False, blank=False, null=False)
date_updated = models.DateTimeField()
date_added = models.DateTimeField(auto_created=True)

result_manager = ResultManager()

class Meta:
    db_table = 'test_result'
    verbose_name = 'Test Result'
    verbose_name_plural = 'Test Results'

def __str__(self):
    return '%s' % self.serial

Any ideas where I may be going wrong?

Thanks

[problem] Error when moved to production-

I have this report (below) which works perfectly on my test server. I moved it to production and I get and error "int() argument must be a string or a number, not 'Evaluator'".
On the report screen, as list filter, rather than Supplier, it shows Evaluator. Any ideas why?

from .models import Evaluation
from model_report.report import reports, ReportAdmin
def evaluator_label(report, field):
return ("Evaluator")
class EvaluatorSummaryReport(ReportAdmin):
title = 'Monthly Evaluation Report'
model = Evaluation
fields = ['user__user_id__username', 'user__supplier', 'evaluationdate', 'candidate', 'status', ]
queryset = Evaluation.objects.filter(status='2')
list_order_by = ('evaluationdate',)
list_group_by = ('user__user_id__username', )
list_filter = ('user__supplier', 'evaluationdate', 'status', )
type = 'chart'
chart_types = ('pie')
list_serie_fields = ('evaluationdate',)
override_field_labels = { 'user__user_id__username': evaluator_label, }
reports.register('evaluator-summary', EvaluatorSummaryReport)

Incorrect date conversion

Hi there.

I noticed that the dates in the reports are being converted to the standard UTC timezone, which isn't the timezone declared in the settings file or the timezone stored in the database.

Do you know where this is being changed?

Regards,
Luke Cossey

No base.html

The template report_list.html extends "base.html". There is no base.html in the templates directory.

NoReverseMatch for named URL

I keep getting this error when I navigate to /model/reports/order-report. I am using django 1.9.5.

Internal Server Error: /model/reports/order-report/
Traceback (most recent call last):
File "/home/mubarak/python_env/bookfood/local/lib/python2.7/sitepackages/django/core/handlers/base.py", line 149, in get_response
response = self.process_exception_by_middleware(e, request)
File "/home/mubarak/python_env/bookfood/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 147, in get_response
response = wrapped_callback(request, _callback_args, *_callback_kwargs)
File "/home/mubarak/python_env/bookfood/local/lib/python2.7/site-packages/django_model_report-0.2.1-py2.7.egg/model_report/views.py", line 36, in report
return report.render(request, extra_context=context)
File "/home/mubarak/python_env/bookfood/local/lib/python2.7/site-packages/django_model_report-0.2.1-py2.7.egg/model_report/report.py", line 509, in render
context_instance=RequestContext(request))
File "/home/mubarak/python_env/bookfood/local/lib/python2.7/site-packages/django/shortcuts.py", line 45, in render_to_response
using=using)
File "/home/mubarak/python_env/bookfood/local/lib/python2.7/site-packages/django/template/loader.py", line 114, in render_to_string
template_name, context, context_instance, dirs, dictionary)
File "/home/mubarak/python_env/bookfood/local/lib/python2.7/site-packages/django/template/engine.py", line 244, in render_to_string
return t.render(context_instance)
File "/home/mubarak/python_env/bookfood/local/lib/python2.7/site-packages/django/template/base.py", line 206, in render
return self._render(context)
File "/home/mubarak/python_env/bookfood/local/lib/python2.7/site-packages/django/template/base.py", line 197, in _render
return self.nodelist.render(context)
File "/home/mubarak/python_env/bookfood/local/lib/python2.7/site-packages/django/template/base.py", line 992, in render
bit = node.render_annotated(context)
File "/home/mubarak/python_env/bookfood/local/lib/python2.7/site-packages/django/template/base.py", line 959, in render_annotated
return self.render(context)
File "/home/mubarak/python_env/bookfood/local/lib/python2.7/site-packages/django/template/loader_tags.py", line 173, in render
return compiled_parent._render(context)
File "/home/mubarak/python_env/bookfood/local/lib/python2.7/site-packages/django/template/base.py", line 197, in _render
return self.nodelist.render(context)
File "/home/mubarak/python_env/bookfood/local/lib/python2.7/site-packages/django/template/base.py", line 992, in render
bit = node.render_annotated(context)
File "/home/mubarak/python_env/bookfood/local/lib/python2.7/site-packages/django/template/base.py", line 959, in render_annotated
return self.render(context)
File "/home/mubarak/python_env/bookfood/local/lib/python2.7/site-packages/django/template/defaulttags.py", line 513, in render
six.reraise(_exc_info)
File "/home/mubarak/python_env/bookfood/local/lib/python2.7/site-packages/django/template/defaulttags.py", line 499, in render
url = reverse(view_name, args=args, kwargs=kwargs, current_app=current_app)
File "/home/mubarak/python_env/bookfood/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 600, in reverse
return force_text(iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, *_kwargs)))
File "/home/mubarak/python_env/bookfood/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 508, in _reverse_with_prefix
(lookup_view_s, args, kwargs, len(patterns), patterns))
NoReverseMatch: Reverse for 'signup' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []

Any ideas?

[Question] Problem Installing Django 1.8. Python 2.7

I following the installation, but I get the following error: ImportError: No module named related

What have I missed? Thanks. here's the traceback.

2016-02-11 23:23:07,784 :Traceback (most recent call last):
2016-02-11 23:23:07,785 : File "/bin/user_wsgi_wrapper.py", line 134, in call
2016-02-11 23:23:07,785 : self.error_log_file.logger.exception("Error running WSGI application")
2016-02-11 23:23:07,785 : File "/usr/lib/python2.7/logging/init.py", line 1185, in exception
2016-02-11 23:23:07,785 : self.error(msg, _args, *_kwargs)
2016-02-11 23:23:07,785 : File "/usr/lib/python2.7/logging/init.py", line 1178, in error
2016-02-11 23:23:07,786 : self._log(ERROR, msg, args, **kwargs)
2016-02-11 23:23:07,786 : File "/usr/lib/python2.7/logging/init.py", line 1270, in _log
2016-02-11 23:23:07,786 : record = self.makeRecord(self.name, level, fn, lno, msg, args, exc_info, func, extra)
2016-02-11 23:23:07,786 : File "/usr/lib/python2.7/logging/init.py", line 1244, in makeRecord
2016-02-11 23:23:07,786 : rv = LogRecord(name, level, fn, lno, msg, args, exc_info, func)
2016-02-11 23:23:07,786 : File "/usr/lib/python2.7/logging/init.py", line 284, in init
2016-02-11 23:23:07,787 : self.threadName = threading.current_thread().name
2016-02-11 23:23:07,787 : File "/usr/lib/python2.7/threading.py", line 1160, in currentThread
2016-02-11 23:23:07,787 : return _active[_get_ident()]
2016-02-11 23:23:07,787 : File "/bin/user_wsgi_wrapper.py", line 126, in call
2016-02-11 23:23:07,787 : app_iterator = self.app(environ, start_response)
2016-02-11 23:23:07,787 : File "/bin/user_wsgi_wrapper.py", line 140, in import_error_application
2016-02-11 23:23:07,787 : raise e
2016-02-11 23:23:07,788 :ImportError: No module named related

Chart is not coming

I've written some code like below.
class productStatistic(ReportAdmin):
title = ('Барааны статистик')
model = Product
fields = [
'name','unit_price',
]
list_order_by = ('name','unit_price')
type = 'chart'
list_serie_fields = ('name', 'unit_price')
chart_types = ('pie', 'column', 'line',)

reports.register('product-statistic', productStatistic)

But there is a report instead of chart
problem4

How to know my chart is either working or not working. Please help me? /I used firebug/

export to PDF problem

Hello,

There's a bug in the render_to_pdf problem. I use a lot of UTF-8 encoded data and PDF generation fails for many of the models in my project due to the fact that when you create a new pisa document you specify an 8859-1 encoding (latin-1).

Fortunately, pdf = pisa.pisaDocument(StringIO.StringIO(html.encode("UTF-8")), result) works perfectly.

Could you please change it to UTF-8 or, even better, abstract it and let the user choose whichever encoding he desires?

New future: pagination

Hello Juanpex!

What do You think about integration of pagination in this project? I had some thoughts about this. Maybe this will be nice feature, because if we have a big data for example 10 000 rows, and we want to render this data in report, we will have wait for some seconds (at best).

Empty list being passed to totals functions?

I am running into an issue with report_totals and group_totals where it looks like an empty list of values is being passed to the sum_column, avg_column and count_column functions. When I print out values inside each of these functions, it returns []

Do you know why this would be happening?

Thanks 👍

Alex

Complex relations

Does your project intend to support complex relations?

I'll give you an example:

I have a model called Resource which has a foreign key on field project (for model Project)
The Project model also has a foreign key on field organization (for model Organization)

Therefore, one Organization can have many Projects and each Project can have many Resources.

In the ResourceReport (model = Resource) I have the following fields:

fields = [
'title', # --> title field belongs to the Resource
'type', # --> type field belongs to the Resource
'project__title', # --> title field belongs to the Project associated with the Resource
'project__organization__name', # --> name field belongs to the Organization which is associated with the Project associated with the Resource
]

Grouping works fine by using this config:

list_group_by = (
'project__organization__name',
'project__title',
'type',
)

However, filtering does not, even though the config should basically be the same:

list_filter = (
'project__organization__name',
'project__title',
'type',
)

The report renders 2 select fields with different ids and names (project__title and project__organization__name) but the options are the same in the two select fields (both of them have been populated with project__title values). Also the labels are the same (the label that should be used for the project__title select is used for both select fields).

Should your project work for this case and this is a bug or you didn't cover this kind of relations when you designed it?

[Question] print / export chart

How can I export or print the beautiful chart that is generated?

It exports to excel, pdf, or send the report to the printer, but nothing with the chart.

Custom querysets for filter options

Hello,

I was wondering if you are considering any improvement which might allow the following scenario:

  • we have 2 models: FirstModel & SecondModel
  • FirstModel has a field "second" which is a ForeignKey(SecondModel)
  • we add a filter on field "second" (this should be displayed in a drop-down menu)

Now, I need to display only a subset of the options displayed in the "second" drop-down.
I know that I could override the default get_query_set method of SecondModel to filter out any unwanted objects, but I really need to not do that because then it would mess up other bussiness logic.

Did you consider this use case; is there any way of overriding the default queryset before displaying the filter form?

There's got to be a way to make this more efficient.

I've been looking into it. I'll start a fork with some of my improvements. The problem is when you want to do something like:

def category_name_from_pk(value, instance):
    c = Category.objects.get(pk=value)
    return "<a href='%s' target='_blank'>%s</a>" % (c.get_absolute_url(), c.get_full_name())

# Then in the `ReportAdmin` project

...
override_field_formats = {
    'id': category_name_from_pk
}
...

it ends up doing a ton a queries. I'm looking at a way to bulk perform these overrides, as well as a select_related in there when it's referring to related fields.

[Question] Admin menu

currently my reports show up on my root site with no login required. I would like to prevent that and have the Report List as a link only accessible from the Admin Dashboard. Do you know how I can do that?

Handling single quotes in field values

The javascript renderer for the chart object's options breaks when field names contain single quotes.

I had a look at the code and found it slightly confusing - especially this part: https://github.com/juanpex/django-model-report/blob/master/model_report/highcharts/__init__.py#L227

Which seems like a workaround for the fact can't just use simplejson.dumps by itself as you're using a custom DictObject instead of a normal Python dict.

I couldn't quite work out the purpose of DictObject and CollectionObject but I have a gut feeling that the code would be simpler if the need for them could be avoided. I ran out of time to dig deeper so I wonder if you could give me a bit of background on this area?

example app: Uncaught Reference Error: jQuery is not defined.

4250d25

I'm running the example project locally having cloned the project.

I get the error above in bootstrap.min.js when opening localhost:8000 (the menu still works and tables appear but no charts). After clearing the caches I see the same error on your demo at http://django-model-report.herokuapp.com/.

I tried loading jQuery first (moving the jQuery loads up from report.html) and got a different error ('a' undefined)...

So I set things up with actual bootstrap files locally (swapping out the mins - not nec. for an example IMO). I got it sorta working with a chart at least appearing (on the Browser List page) but it is all white. the percentages pop up and the labelling works.

I'm guessing this needs some serious updating (I used Boostrap 3.0, jquery 2.1.3 and jquery-ui 1.11.4 when pulling in the new files). If I persevere with this I'm going to need to upgrade it from django 1.4 to 1.7.7 (and ideally on to 1.8 at some stage).

I'll continue working on this. If you are interested in a pull request, let me know. The fork is at https://github.com/pwhipp/django-model-report.

FWIW, the demo should show one or more charts at its default settings when it opens.

500 Error when filtering with Many To Many keys

Hi -

I am getting a 500 error when trying to filter by multiple values in a M2M relationship -

DatabaseError: more than one row returned by a subquery used as an expression

Model is like this:

class MyModel(..):
    something = varchar,
    somethingelse = ManyToManyField
    ....

Report is like this:

class MyReport(ReportAdmin):
title = 'MyReport'
model = MyModel
fields = [
    'something',
    'somethingelse',
]

list_filter = (
    'something',
    'somethingelse',
)

What am I doing wrong?

The report works fine when I select one of the options, but as soon as I select more than one, or none, I get the error.

app.model import Browser leads to nowhere

Hi,
in your readme.md you say to add in our reports.py from app.models import Browser but in our own app, this leads to an error : "cannot import name Browser"

it looks like you copy/paste your code from your test_app .

So what should we do ?
Do we have to make our own Browser method too ?

many to many relations don't always work properly

Example:

We have models OurModel and User (the standar Django User model);

OurModel has a ForeignKey defined on field fkfield

On OurModel we define a field users = models.ManyToManyField(User, related_name='ourmodel', limit_choices_to={'is_active': True })

If we were to use in a report UserReport the field 'ourmodel__fkfield__name', the django-model-report would fail.

Now...there is a lot to explain on why it fails, but please take a look at my fork and you can see that I have done some changes. With those changes, I've made it work but I'm not very sure if it does not introduce any regression; therefore, I haven't made a pull request yet.

Could you please take a look at the code I've changed and give me a review perhaps? I think it would be great if you see it before I create the pull request to avoid any further bugs.

Thank you!

PDF, EXCEL unicoding

Hello,
I've tried to get result for reporting but it comes like above a picture.
capture

How can i set utf-8 to my output file like pdf or excel?

Bug: list_filter breaks on relational walk

Bug found in list_filter construct.
I can't use my specific application in this bug report b/c it is corporate knowledge, but I will do my best to describe it with an analogous app.

Say I have a BookCase model, and it can contain many Book models. There are many BookCases.
Book models point to a specific BookCase. I also have an Author model, which points to a specific Book (we assume an author only writes one book here). A Book may have multiple Authors.
In summary, the whole system may look something like this:

                BookCase1                         BookCase2
              /    |     \                        /        \
        Book1    Book2   Book3                 Book4       Book5
       /    |      |       \                /   |   \          \
Author1  Author2 Author3  Author4     Author5 Author6 Author7   Author8

Functions are in place to do the following:

from App.models import BookCase

# gets a specific book case
case = BookCase.objects.filter(identifier="whatever")[0]

# gets all the Books that point to this BookCase
case.books 

#--------------------------
from App.models import Book

# gets a specific book
book = Book.objects.filter(identifier="whatever")[0]

# gets the BookCase that this Book points to
case = book.case

# gets the Authors that point to this book
authors = book.authors

#--------------------------
from App.models import Author

# gets a specific Author
author = Author.objects.filter(identifier="whatever")[0]

# gets the gets the Book that this Author points to
author.book

# gets the BookCase that this Author's Book resides in
author.book__case

Now, if I want to make a model report using this tool to list all authors across all books across all book cases and filter by bookcase, I construct the following:

from App.models import BookCase, Book, Author
from model_report.report import reports, ReportAdmin
from django.utils.translation import ugettext

class AuthorData(ReportAdmin):
    title = ugettext('Book Summary')
    model = Book
    fields = [
        'book__case',
        'book__identifier',
        'book__title',
        'identifier',    # author ID in database
        'name',          # author name
        'address',       # author address
        'phone_number',  # author phone
    ]
    list_group_by = ( 'book__case',)
    list_filter = ('book__case',)  # HERE is the problem
    list_order_by = ('name',)
    type = 'report'
    exports = ('excel', 'pdf')
reports.register('AuthorData', AuthorData)

When rendering the page, I expect that filter would be a list of BookCases, but instead it is a list of Books. Furthermore, upon selecting a Book in that filter and clicking "Get results", an error is thrown saying there is no BookCase matching the filter value. I suspect this is because the parameter for that filter wants a BookCase object, but a Book is given instead, and there's a type mismatch.

error 'NoReverseMatch'

hello, I'm new in python. I want to use your apps but a got an error

NoReverseMatch at /report/

Reverse for 'model_report_view' with arguments '('',)' and keyword arguments '{}' not found.

I had follow your step, but still got that error? what should i do?

thanks

TypeError:$(...).datepicker is not a function

<script src="{% static 'model_report/js/jquery-1.6.2.min.js' %}" type="text/javascript"></script>
<script src="{% static 'model_report/js/jquery-ui-1.8.16.custom.min.js' %}" type="text/javascript"></script>

problem2

Filter options does not work ok with choices field

I've noticed that there's an issue when using a list_filter on a choices field such as

YEAR_IN_SCHOOL_CHOICES = (
('FR', 'Freshman'),
('SO', 'Sophomore'),
('JR', 'Junior'),
('SR', 'Senior'),
)

The problem is that you cannot leave the report unfiltered because you are forced to always choose a value by which the report is filtered.

There seems to be a piece of code which should handle such a situation in model_report.report at line 593:

for field in self.fields:
self.fields[field].required = False
if hasattr(self.fields[field], 'choices'):
if not hasattr(self.fields[field], 'queryset'):
if self.fields[field].choices[0][0]:
self.fields[field].choices.insert(0, ('', '---------'))
self.fields[field].initial = ''

However, this didn't work for me until I changed the last two lines to:

self.base_fields[field].choices.insert(0, ('', '---------'))
self.base_fields[field].initial = ''

By doing so, the select widget is rendered correctly having the '---------' option, too.

Could you please take a look at this? Thank you!

Slug already exists: <class name>

Hi,
I'm getting this error "Slug already exists: ClinicProfileReport" consistently when adding two class methods in a model to reports.py. my code is as follows

from clinic.models import ClinicProfile, DoctorProfile
from model_report.report import reports, ReportAdmin
from model_report.utils import avg_column, count_column, sum_column

def district__name_label(report, field):
return ("District")

def locality__name_label(report, field):
return ("Locality")

def town__name_label(report, field):
return ("Town")

class ClinicProfileReport(ReportAdmin):
model = ClinicProfile
fields = [
'name',
'state',
'district__districtnameen',
'town__townnameen',
'locality__localitynameen',
'created_date',
'phone_no',
]
list_filter = ('state',

                )
list_order_by = ('created_date',)
list_group_by = ('name',)
list_serie_fields = ('name',)
type = 'chart'
override_field_labels = {
    'district__districtnameen': district__name_label,
    'town__townnameen': town__name_label,
    'locality__localitynameen': locality__name_label,
}

group_totals = {
    'name': count_column,
    'phone_no': count_column,
}
report_totals = {
    'name': count_column,
    'phone_no': count_column,
}
chart_types = ('pie', 'column', 'line')

class DoctorProfileReport(ReportAdmin):
model = DoctorProfile
fields = [
'name',
'state',
'district__districtnameen',
'town__townnameen',
'locality__localitynameen',
'created_date',
'phone_no',
]
list_filter = ('state',

                )
list_order_by = ('created_date',)
list_group_by = ('name',)
list_serie_fields = ('name',)
type = 'chart'
override_field_labels = {
    'district__districtnameen': district__name_label,
    'town__townnameen': town__name_label,
    'locality__localitynameen': locality__name_label,
}

group_totals = {
    'name': count_column,
    'phone_no': count_column,
}
report_totals = {
    'name': count_column,
    'phone_no': count_column,
}
chart_types = ('pie', 'column', 'line')

reports.register('ClinicProfileReport', ClinicProfileReport)
reports.register('DoctorProfileReport', DoctorProfileReport)

please help me to resolve this issue, its working perfectly with one class. where i'm did wrong?

Only super admin can view reports?

Is this intentional or is there something wrong with my configuration. Currently I get a 403 when I try to view the reports as any other user.

Issue with datetime on 1.8

I am trying to use a datetime field as seen in the example app

        'date',
        'date__year',
        'date__month',
        'date__day',

But I get the 'NoneType' object has no attribute 'to' error.

Why is this?

Static file

Static files don't come in source code html. How to repair it? There is now base.html in model_report\templates\
problem1

Make table results compatible with django-tables2

Sorry for my bad english.

Please replace in report.py in function

def get_query_set(self, filter_kwargs):

next code

        return qs.distinct()

to

        self.query_set = qs.distinct()
        return self.query_set

and add

class ReportAdmin(object):
    query_set = None

for get result query set and work with django-tables2. Example:

{% load render_table from django_tables2 %}
{% render_table report.query_set %} 

unable to install directly from Git

Hey,

Until now I've only used your application by cloning it onto my local machine and installed it by running pip install . in the root directory of the project. However, there was a problem with the setup because it didn't install highcharts and at runtime it raised an ImproperlyConfigured exception with the message "No module named highcharts".

In order to bypass this problem, whenever I needed to install your project, I first changed the setup.py to dynamically load all the required packages by changing packages=['model_report', ], to packages=find_packages(), (where find_packages is imported from setuptools).

Now, I really need to be able to install it directly from Git because I need to deploy it on another server by running pip install https://github.com/juanpex/django-model-report/tarball/master but this way fails.

Could you please add packages=find_packages(), to setup.py?

Thank you!

PS. I appreciate the effort you put into all my other inquiries.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.