attribute: Phillie Casablanca

Beyond first steps



So i've gotten more comfortable with Django.

And I've realized I now want to move beyond the initial simple blog example I initially followed.
(http://blog.disqus.net/2007/03/11/a-django-primer/)

It was a great frist step, but now to build more of a real site you need some extra features.
There are a couple of things I realized that I needed to add to the initial data model.

Mainly categories and a slug.

I first read about slugs on the django site, but didn't understand them.
Now that I wanted to link back to a historical single entry I realized that there needs to be some kind of identifier for a particular post, and slugs appear to be commonly used.

So I needed to update the model while at the same time not wanting to lose my previous notes.
Which means I apparently have to drop down into mysql and run the alter table commands myself.

This was a little daunting when I first read, "If you do care about deleting data, you’ll have to execute the ALTER TABLE statements manually in your database.". They always make it sound so easy.

Ok, so it wasn't that hard.

But, I didn't know the structure of the tables that django expects, but I remembered running across a command in the django tutorial that spat out the need sql commands to create tables, "python manage.py sql [appname]". So I ran this command and it gave me just what I needed the expected inputs for the columns I needed to add.

Next to alter the tables.

Entering mysql was easy enough, just entering 'mysql' on the command line.
But, I needed to enter the password, 'mysql -p' will gave the password prompt, then to connect to the db. (I didn't remember the password or the name of the db I created initially, luckily this is all in the settings.py file). So "connect " did the job there, then I was at the alter table add line.

And it seems to work. At least I'm not getting page errors anymore after I changed the model and ran syncdb...

Now on to the undocumented but documented commenting system:
http://code.djangoproject.com/wiki/UsingFreeComment

monkut // April 15, 2008 // 7:42 a.m.