Links not allowed in comments anymore
2015-05-19
I haven't worked on the actual blog application for almost a year now. Reading computer related books, writing blog entries about them and other topics and working on the math app has just taken too much time. I have a quite long list of things I want to change or add to the blog and I plan to start doing some of these changes in the next month. I'll just have to finish writing about the next language in the 14languages series (which is Scala).
Yesterday, however I became so fed up with the spam bots adding lots of spam comments to some of the entries in the blog so I implemented a small filter that disallows comments containing links. To do that I had to add one file containing exactly four lines of Python code and add validators=[validate_comment]
to the CharField
representing the text field where the comments are added. Ain't Python (and Django) wonderful ;)
Now there will be no more spam comments added. I hope. If some such comments somehow finds their way pass the filter, I'll have to tweak it to block those as well. We'll see how it goes.
The downside of this is of course that no real comments containing links can be added to the blog entries. That's too bad. Damn bots.