As you well know, I started out rolling my own blog and couldn’t finish due to being an extreme n00b. Now that I’ve made fairly significant progress with my FlaskCasts site I am slightly considering transferring all of this over to a strictly Python blog….but….IDK. We will see.
I got hung up on a couple of things tonight trying to get my flask casts site up off of the ground. First off I really got hung up on name vs id in my form fields. Apparently Flasks Request isn’t too fond of having both a name and an ID…and playing around with Bootstrap the ID tag was automatically placed so I was stuck for several minutes…about an hour..kind of sucked. Again…SOMETHING SMALL! But…I just wrote about it…so all the while I kept telling myself IT HAS TO BE SOMETHING SMALL AND STUPID….ALWAYS IS.
[pastacode lang=”python” manual=”%20%20%20%20%40staticmethod%0A%20%20%20%20def%20update(post_id%2C%20title%2C%20content)%3A%0A%20%20%20%20%20%20%20%20mongo.db.posts.update(%7B’_id’%3A%20post_id%7D%2C%20%7B’%24set’%3A%20%7B%22title%22%3A%20title%2C%20%22content%22%3A%20content%7D%7D)” message=”” highlight=”” provider=”manual”/]
Then I ran into an issue trying to update by post…I forgot the $set (loss for a word here) and ran into some issues…luckily solved em all.
Next up…the create method. This one will be a little tricky because Ive designed the site to show posts by the slug for SEO reasons…so I won’t be able to have duplicate slugs in the database. The slugs are generated with the object/Post itself based on the title….however…I’m leaving myself the option of changing the title/content if need be. This is a simple site so…a lot of common functionality really isn’t required but its fun to think through the possibilities.
Lets do some Checkio…
30 minutes later
and it beat me…lol
working on it,…..