Why is post_type a CharField and not a ForeignKey?

asked 2012-11-08 21:02:26 -0500

Kaseko gravatar image

updated 2012-11-08 21:02:46 -0500

Any reason for having post_type as CharField instead of a ForeignKey on the Post model?

edit retag flag offensive close merge delete


I think you are misunderstanding the purpose. Post type is a string "question", "answer", "comment", etc, to distinguish, what of kind is the post. Why should it be a foreign key? It could have been a small int to save bytes, but it is what it is now.

Evgeny gravatar image Evgeny  ( 2012-11-08 21:04:09 -0500 )edit

It was one thing that stood out when I was looking at the admin interface. I was thinking one helpful feature request would be, e.g, to turn an answer into a comment. But you wouldn't do that through the admin interface anyways.

Kaseko gravatar image Kaseko  ( 2012-11-08 22:04:03 -0500 )edit

We have a feature like that in the repository version.

Evgeny gravatar image Evgeny  ( 2012-11-08 22:15:30 -0500 )edit