Reputation: 101
I hava a model like this one:
class PostDetail(models.Model):
topic_id = models.IntegerField()
post_user_id = models.IntegerField()
content = models.TextField()
date = models.DateTimeField(default=timezone.now)
class Meta:
ordering = ("-date",)
I hava a test table like this:
but when I access data in this way:
main_reply = PostDetail.objects.filter(topic_id=id)
print(main_reply[0].date)
It always return None, I am really confuse
ps: When I access it in SQL, it is alright.
Upvotes: 0
Views: 220
Reputation: 101
I use pycharm to insert the data, it occurs errors like above, but if I use the django admin web to insert data, it works alright, and if user post the data to insert the data, it works fine
Upvotes: 2