Because I value your opinions!

It took me a little longer than expected (about 5 days), but I've finally got comments ready for the live site. It probably would have been easier had I decided

Why I chose not to use Django's comment system

A couple reasons drove me to use my own solution for comments:

  • Django's comments at the time didn't have a user site field (The latest trunk version does, though)
  • I'm trying to use this blog as a learning experience for Django
  • Django's comments did things I wouldn't ever used, like karma

When using Drupal, it was very common to grab a module because you needed 15% of the functionality it offered. This is something I'm trying to get away from, and comments was a good first step in that direction. I hit one bump in the road, but all-in-all it was a good learning experience, and I'm very happy with the result!

My bump in the road

The only real obstacle which hung me up longer than I would have hoped was an issue with ModelForm, and my model's ForeignKey field. Simply put, I wanted to pass the value for the ForeignKey via a hidden input in the form, and ModelForm renders ForeignKey fields as select boxes, which can't be hidden. I figured I could simply overwrite the default field generated by ModelForm as a CharField, but this results in a TypeError when saving the model. After doing some searching, I ended up stumbling across someone who encountered a similar problem. His solution was a InlineModelChoiceField, which solved the problem quite nicely.

Can I see the code?

Certainly! I just need to clean it up a bit before releasing it to the wild. Stay tooned!

4 Comments

Submit a Comment

My latest project: Bad Company 2 Stats, Weapons, Vehicles, Forums, Information