[Answered ]-'User' object has no attribute '__getitem__' error

2👍

It seems likely that you have defined a __unicode__ method on StudentUsername that is returning either a User or a Student object – that is, self.user or self.student – rather than actual unicode. So when Django tries to slice it, it gets this error.

Ensure that your unicode method actually returns unicode text.

Leave a comment