Can you post the error and traceback? It sounds like you may have an encoding issue.
-James
--
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...@googlegroups.com.
To post to this group, send email to django...@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/76ad4dab-574e-4867-96b6-96be02e8a739%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
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 ...
Posting the actual model code will probably help.
Your template has this:
But you specified the issue later as this:
item.customer_location.customer
The former won't work per your summarized model definitions. The Location model has no attribute called 'name'.
The latter will work only if your __str__() function is encoding the data correctly. The reason you are getting a recursion error is because of the 'unicode(self)' (which I'm assuming is part of your model's __str__() definition). You need to change that to something like unicode(self.name). I'm not even sure if the unicode() call is even necessary (haven't done a ton of Python 3 yet).
As far as referring to the Customer name, you can do {{ item.customer_location.customer.name }}
Have you thought about tying in the customer directly to the service order? It shouldn't be an issue to have a customer tied to both the location and the service order. While it'll work the way you have it, your lookups will become more complicated (and expensive from a processing perspective) since you are forcing a lookup across multiple tables. It may not agree with your business process, though. Just a thought.
-James
--
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...@googlegroups.com.
To post to this group, send email to django...@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.
Hi James, Thanks again for responding.
I didn’t post my actual models as they are quite large and my problem is more about understanding proper technique than anything. Self.name did fix my immediate problem thanks, however I am really curious about your last paragraph … how can I tie the customer directly to the service order ? .. I have no idea how I might do it in Django.
C.
--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/9G-WUE4A8ZA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@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/CA%2Be%2BciUY1dFyCTD7PeJsVDiqnzLdEXeqOe1bHOgLuCjeyMjV4g%40mail.gmail.com.
By creating a foreign key to it.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/00d401d09de4%24f8b76fe0%24ea264fa0%24%40gmail.com.