Hi James thanks for the response...
this line: <td>{{item.customer_location.customer}}</td>
..... worked this morning and all last week now gives this error:
On Tuesday, June 2, 2015 at 2:00:22 PM UTC-4, Chris Strasser wrote:
-- this line: <td>{{item.customer_location.customer}}</td>
..... worked this morning and all last week now gives this error:
RuntimeError at /sto/
maximum recursion depth exceeded while calling a Python object
| Request Method: | GET |
|---|---|
| Request URL: | http://10.0.0.102:8080/sto/ |
| Django Version: | 1.8 |
| Exception Type: | RuntimeError |
| Exception Value | maximum recursion depth exceeded while calling a Python object |
I can reproduce the encoding error but i forget how to get there at the moment ...
On Tuesday, June 2, 2015 at 2:00:22 PM UTC-4, Chris Strasser wrote:
Hi am plugging away at learning Django and have done well so far (thanks to great documentation and Stackoverflow) but I have run into a problem that i cant seem to figure out.
I have a model that refers to another model that refers to another model.
example :
Class ServiceOrder
id -integer
customer location = foreign key to location
def __str__(self):
return self.stid
class Location:
id -integer
address -char
customer- foreign key to customer
q= '%s %s %s %s ' %(self.addr1, self.addr2, self.city, self.country)
return unicode(q).encode('utf-8')
Class Customer
id=int
name- char
return unicode(self).encode('utf-8')
I have a template that lists the service orders view is below:
def serviceorder_list(request, status = 'Closed'):
ist = ServiceOrder.objects.filter(status = status, stid__lte=20239).select_ related('customer_location__ customer') #stid__lte 20239 to fix database error ... i have existing data that has its own issues...
count = order_list.count()
context ={'list': sto_list, 'count': count}
return render(request, 'order/listview.html', context)
in my listview.html
{% for item in list %}
{% if item.project %}
<td><a href="{{ item.stid }}">{{item.stid}}</a></td>
<td>{{item.project}}</td>
<td>{{item.customer_location.name }}</td> ---------------------- 2 questions here 1) it throws an error on customer names that have accents etc ...
<td>{{item.notes}}</td>2) i am confused about how to properly referenece the customer name or anything else that is not in the Service order model.
<td>{{item.person_responsible}}</td>
<td>{{item.entrydate|date:'M-d-y'}}</td>
<td>{{item.status}}</td>
<td>{{item.billing}}</td>
</tr>
I have read the docs many times and the more i read the more i know that i don't know ... any help would be appreciated
Thanks
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/bd0e074b-f45e-404b-87c7-919c2176d2dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment