On Mar 8, 2008, at 7:04 AM, Evert Rol wrote: > > Have you checked what 'd' is here? It may be something different than > you'd expect or hope, in particular for the __dict__[d] lookup (not > sure what you're expecting here). > I would actually work with something like > Person.objects.filter(id=pID), which keeps b a QuerySet instead of > turning it into an object, and then do more filtering later on.
I can do that, but then I get a key error with the name. However, it works with similar code here: def details(request, pID='0', opts=()): response = HttpResponse() response.write("<HTML><BODY>\n") try: p = Person.objects.get(id=pID) if (pID == '0'): response.write("<H1>Person Details Index</H1><HR>\n") else: for d in opts: response.write("<li>%s: %s</li>" % (d, p.__dict__[d])) except Person.DoesNotExist: response.write("Person Not Found") response.write("</BODY></HTML>") return response > > > But, from the error message, I'm guessing that's actually not (yet) > your problem. It complains about the 'text' attribute that cannot be > found, which would suggest that that field doesn't exist in the actual > database (it's there in the model). Did you sync the database, and > then later added the text attribute to Blog (or even the whole Blog)? > Btw, where in your view is line 53? I'm guessing at "b = > Person.objects.get(id=pID)"? I dropped the database and resynced it. No go. I then went and changed the URL code to pass the params to the view with this to this: details4 = {'opts':('name', 'blogs')} And now I get: KeyError at /People/Blog/1/ 'blogs' Which confused me a bit, since blogs is also a key. I can probably skip this excercise and proceed on with the rest of the book since I know now how to pass multiple views and have multiple URLs, but this concerns me. Part of me still doesn't understand fully why it is not working and I get a feeling that if I don't resolve this, I probably screw up the rest of the exercises in the book. :| --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---