This is not really django specific, several objects bearing the same name
in the same namespace will always lead to trouble ; )
(And this is not even python specific)

Glad you could fix it and thanks for posting your solution in case someone
else has the same issue though. : )
Le 16 août 2012 21:01, "Babatunde Akinyanmi" <tundeba...@gmail.com> a
écrit :

> Ok I fixed it and in case someone else falls into such a trap, here's
> how I fixed it.
>
> My Answer model had a field with name 'is_correct' and had a method
> with name 'is_correct'. This confused django such that:
>
> >>> ans = Answer.objects.get(id=1)
> >>> ans.is_correct
> <bound method Answer.is_correct of <Answer: Boo>>
>
> So I changed the name of the 'is_correct' method and running the above
> in the code threw an error: .....DatabaseError: column
> examprep_answer.is_correct does not exist.....
>
> Drop my database and syncdb-ing got things back to normal.
>
> I think django should be able to detect such things and raise an error
> or there should be a note in the documentation warning people not to
> name their model methods with model field names.
>
> On 8/16/12, Tundebabzy <tundeba...@gmail.com> wrote:
> > Hi guys, here's bit of my code http://dpaste.com/hold/787292/
> >
> > The problem is that my Answer model in admin is missing the 'is_correct',
> > 'date_added' and 'modified' fields.
> >
> >
> > <
> https://lh4.googleusercontent.com/-FuxmFXdGVP4/UC0K_dwpIhI/AAAAAAAAADI/deTk9J_tQOE/s1600/Screenshot+from+2012-08-16+15%3A57%3A35.png
> >
> >
> > I tried adding:
> > fieldsets = [
> >
> >         (None,               {'fields':
> > ['text','is_correct','explanation']}),
> >
> >     ]
> > to my AnswerInLine definition but that throws an ImproperlyConfigured
> error
> > saying:
> > 'AnswerInline.fieldsets[0][1]['fields']' refers to field 'is_correct'
> that
> > is missing from the form.
> >
> > Can anyone help out?
> >
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To view this discussion on the web visit
> > https://groups.google.com/d/msg/django-users/-/qK1kFc-11lQJ.
> > 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.
> >
> >
>
> --
> Sent from my mobile device
>
> --
> 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.

Reply via email to