Hi,
I just got this error a few days back. It was resulting from a
OnetoOne model referencing 'user' in one of the admin display_fields.
I thought user would resolve to the __unicode__ value of the user
model, for some reason (django bug?) it does not.
THE FIX
This is more like a patch, but you need to add a user method to your
class (assuming user is where the error is thrown, adjust to your
model key as needed).
def user(self):
return self.user.username
It sucks but it does the trick. Maybe this will help debug on the
django side.
-Paul
On Jun 6, 8:05 pm, grElement <[email protected]> wrote:
> I found the tickets regarding this error on the bug reports and
> noticed that it comes up when there is something wrong with your view,
> but I can't seem to find anything off. Here is my view.py in that app.
> Weird thing is I'm just copying this over from another project and it
> was working fine there and also this was working fine and I was
> viewing these pages, no problem, and I haven't changed anything on
> this file since it started throwing this error? And yes codes/
> models.py does exist.
>
> from django.http import HttpResponse
> from codes.models import *
> from django.shortcuts import *
>
> def tableofcontents(request):
> queryset = get_object_or_404(CodeDocument, pk=1)
> return render_to_response(
> 'tableofcontents.html',
> {'queryset' : queryset},
> )
>
> def codedocument(request):
> queryset = get_object_or_404(CodeDocument, pk=1)
> return render_to_response(
> 'codedocument.html',
> {'queryset' : queryset},
> )
>
> def chapter(request, chapter_number):
> queryset = get_object_or_404(Chapter, number=chapter_number)
> return render_to_response(
> 'chapter.html',
> {'queryset' : queryset},
> )
>
> def section(request, chapter_number, section_number):
> queryset = get_object_or_404(Section, number=section_number)
> return render_to_response(
> 'section.html',
> {'queryset' : queryset},
> )
>
> def subsection(request, chapter_number, section_number,
> subsection_number,template_name="subsection.html"):
> queryset = get_object_or_404(Subsection, number=subsection_number)
> return render_to_response(
> template_name,
> {'subsection' : queryset},
> )
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---