On Sun, 2006-04-09 at 14:19 +0000, Sandro wrote:
> I guess I am still new with databases so my question is regarding how I
> should setup my models for a site where users can create accounts and
> have their own private blogging areas.
> 
> In the past I always worked with flatfiles so every user had their own
> folder on the filesystem and all of their data was within that folder.
> Does this mean that every user should have their own table to hold
> their blog posts or I should have one blog_post table and throw
> everyone's posts into that table?  

One table for all posts is the usual method. The main reason this should
feel "natural" for database design is that you do not want to have to
change the database schema every time you add a new user. Instead, you
add the new user's details to (say) the "user" table and whenever a new
post is made it goes in the "post" table. Entries in the post table
contain, amongst other things, a field indicating the user they belong
to (a foreign key, in database terms).

This type of thinking can take a little while to catch on if you are new
to this, but at some point it should just start to click and you will
find it much easier. There is nothing wrong with the filesystem view of
things, either, it is just that there is no natural concept of
"containment" in database models; it is implemented by including a
relationship (in the most general terms, a pointer to "my parent").

Regards,
Malcolm


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to