I am getting a strange error despite following the documentation. I have the following model:
class UserToken(models.Model):
token = models.CharField(max_length=100)
user = models.ForeignKey(User)
Whenever I do UserToken.objects.get(token=tokenValue) (tokenValue is the value I am looking for) locally for MySQL, everything works. I get the value as expected. But when I do the same on my MySQL instance in Amazon RDS, I keep getting the following error:
ERROR Unknown exception: UserToken matching query does not exist.
Is there anything I am missing here? Why would a statement like this not work in RDS?
[EDIT]
Just to clarify, the token values do indeed exist. I checked the database just to make sure. Also I tried the following:
ut = UserToken.objects.raw("select * from user_token") (just to test..there was only one entry in the table) and i’m getting the following error: Unknown exception: 'RawQuerySet' object has no attribute 'token'. Is there a reason for this? The token field does exist.
I’m really not sure how this is different…but previously I was doing
request.raw_post_datato get the json message that the user was sending me. I changed that torequest.POSTandrequest.bodyand somehow that fixed the issue. Just in case anybody else faces this hard-to-debug issue!