4 ms·
> article = Article.objects.get(pk=int(article_id,36)) You (assuming op is the maintainer of the site) should really handle any django "get" with a try/except
by run4yourlives 14y ago
> article = Article.objects.get(pk=int(article_id,36))
You (assuming op is the maintainer of the site) should really handle any django "get" with a try/except block.
That, and you should also set debug to False on a production server.
Once the article exists again, it might be worth reading.
- mattwdelong 14y agoI would recommend that get_object_or_404, with the 404 page enabled, would be better suited for this application. Very similar methods, but this way just handles all the heavy lifting. https://docs.djangoproject.com/en/dev/topics/http/shortcuts/#get-object-or-404 https://docs.djangoproject.com/en/dev/topics/http/shortcuts/...
- run4yourlives 14y agoGood point, that would be better.