Thanks.

Here's the views.py

class TransactionReport(tables.ModelTable):
    identifier = tables.Column(sortable=False, visible=False)
    created = tables.Column(sortable=True, visible=True)

    @classmethod
    def get_reports_paid(self, object, req):
        return TransactionReport(object, order_by=req)

    class Meta:
        model = Transaction


    @login_required
    def display_reports(request):
        logger = logging.getLogger(__name__)
        dataqs = Transaction.objects.filter(paid="TRUE")
        req = request.GET.get('sort', 'created')
        tx = TransactionReport().get_reports_paid(dataqs, req)

        return render_to_response('webapp/reports.html', {'table': tx,
'rows' : tx.rows})


rows is of type TransactionReport.


On Wed, Aug 10, 2011 at 11:46 AM, Subhranath Chunder
<subhran...@gmail.com>wrote:

>
>
> On Mon, Aug 8, 2011 at 5:04 PM, Kayode Odeyemi <drey...@gmail.com> wrote:
>
>> Hello,
>>
>> Please why am I get the following error:
>>
>> Caught NameError while rendering: global name 'name' is not defined.
>>
>> Initially I did not receive this sort of error, it just surfaced all
>> off a sudden. I restored my app to the state where everything worked
>> and I'm still getting the same error.
>>
>> Full stack trace:
>>
>> Caught NameError while rendering: global name 'name' is not defined
>> Request Method: GET
>> Request URL:    http://site/reports
>> Django Version: 1.3
>> Exception Type: TemplateSyntaxError
>> Exception Value:
>> Caught NameError while rendering: global name 'name' is not defined
>> Exception Location:     build\bdist.win32\egg\django_tables\models.py in
>> _default_render, line 73
>> Python Executable:      C:\path\apache\apache2.2.10\bin\httpd.exe
>> Python Version: 2.7.1
>>
>> In my template file:
>>
>> {% load humanize %}
>> {% load tables %}
>> {% load pagination_tags %}
>> {% autopaginate rows 2 %}
>>
> What is data type of this variable named 'rows' in here?
>
>
>>
>>                        {% for row in table.rows %}
>>                          <tr class="{% cycle 'odd' 'even' %}">
>>                          {% for value in row %}
>>                            <td class="table-data">{{ value }}<td>
>>                          {% endfor %}
>>                          </tr>
>>                        {% endfor %}
>>
>> When i remove the above code from my template the error goes away but
>> table rows are not displayed.
>>
>> Any suggestions please.
>>
>> Thanks
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Odeyemi 'Kayode O.
http://www.sinati.com. t: @charyorde

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

Reply via email to