It's all in queries. You assign the user to all your tables as a foreign
key and make sure that all your quiries have user in them as a filter. You
can also extend the user and assign a slug to it so that you have unique
urls for all users. You can generate a slug from the username upon user
creation. That's really it. Cheers

On 28/01/2012 12:35 PM, "Russell Keith-Magee" <russ...@keith-magee.com>
wrote:

> On Wed, Jan 18, 2012 at 5:35 AM, Eryn Wells <e...@erynwells.me> wrote:
> > Hi all,
> >
> > This is my first post and it's a simple question... (I think)
> >
> > In my experience, it seems like Django allows users to log in to access
> and modify the same content, like a blog with multiple authors or a CMS.
> I'm trying to figure out how to do user-specific sites – something like a
> blog site where every user has their own blog and they can log in to add,
> remove, and edit their own posts (and no one else's). Each user has their
> own preferences and the like as well. Is this something that Django's
> built-in user framework can handle? Or could I maybe finagle the sites
> module into doing something like this? Is it as simple as adding a
> ForeignKey to all my models that points to the User that owns that
> particular db row (seems like the brute force way of doing it...) or is
> there a more elegant way?
>
> Hi Eryn,
>
> It sounds to me like a foreign key to User is the best way to handle
> what you're describing. If you set up the auth infrastructure, a
> logged-in user will attach the current user to the request object, so
> if you want to find the Posts for that user, it's a very simple
> filtered query.
>
> I'm not sure why you consider this to be "brute force"; you've pretty
> much defined your requirements as "Show me all the blog posts for this
> user", so that's what you encode in Django -- a view of blog posts,
> filtered to those from the current user.
>
> If your objection is that you need to code everything from scratch --
> well, that's when you start looking for other people that have solved
> the same problem, and use their code. There's a rich community of
> reusable, open source Django applications, and unless you've got very
> specific requirements, you'll probably find a "blog" package that will
> meet those requirements. I'd suggest having a look around Django
> Packages [1] to see if there is something that will meet your needs.
>
> If you're looking for a more complex, CMS-like solution -- there are
> pre-built solutions for those, too (Django CMS, FeinCMS, Mezzanine,
> and others). Which one works best for you will depend on your
> requirements.
>
> [1] http://djangopackages.com/
>
> Yours,
> Russ Magee %-)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to