googaa / django-reporting

Automatically exported from code.google.com/p/django-reporting
0 stars 0 forks source link

Joins to other models #2

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Is it possible to make a join to another model?

For instance; using basic.places.models.Place
(http://github.com/nathanborror/django-basic-apps) can I join to another
table? I keep getting the error:

FieldDoesNotExist at /reporting/my-report/
Place has no field named 'point__country'

This is my basic report:

=====8<=====
from django.db.models import Sum, Avg
import django_reporting as reporting
from basic.places.models import Place

class MyReport(reporting.reports.Report):
    name = 'my-report'
    verbose_name = 'My report'
    model = Place
    list_group = (
        'title',
        'point__country',
    )
    list_filter = (
        'point',
    )
    list_values = ()

reporting.site.register(MyReport)
=====>8=====

Note that I to was having issues with module name conflicts hence the
importing of django_reporting.

In the example on django-reporting home page it looks like this should be
possible.

Original issue reported on code.google.com by alex%alu...@gtempaccount.com on 24 Oct 2009 at 12:17

GoogleCodeExporter commented 9 years ago
yes, now you can do that.. but please note that synax was changed (see 'samples'
directory in repository)

{{{
group_by = [
   'field', 
   'field__lookup__othermodel',
]
}}}

Original comment by ppr.vit...@gmail.com on 14 Nov 2009 at 8:01

GoogleCodeExporter commented 9 years ago

Original comment by ppr.vit...@gmail.com on 14 Nov 2009 at 8:01