If I understand correctly, what you really need is object (or row) level permissions. It doesn't make a lot of sense to create a table for each user, especially when the data model is exactly the same (and could get you a huge, messy database really quick). Rather, what you want to control is the /access/ to that data. E.g., all data is stored in the same table, but user 1 can access objects (rows) 1, 2, 3 but not 4, 5, 6 and user 2 can access 4, 5, 6, but not 1, 2, 3.
Maybe take a look at http://pypi.python.org/pypi/django-object-permissions. I haven't used it, but it seems to address this issue. Or roll your own object permission model. It's conceptually quite simple: create a permissions model/table with a foreign key relationship to your other model. The permission model should record the user, the object, and (optionally) what level of permission they have to that object (read,write,etc.) _Nik On 9/21/2012 11:07 AM, Rohit Banga wrote: > > Just HAVE to separate data - requirement. > > On Sep 21, 2012 1:59 PM, "Mayukh Mukherjee" <mayu...@gmail.com > <mailto:mayu...@gmail.com>> wrote: > > As I understand it: (And im fairly new to django too) > > A model corresponds to a single table (not multiple). > The question to you is what is different between User1 and User2 > that you need different tables? > > > > On Fri, Sep 21, 2012 at 1:35 PM, Rohit Banga > <iamrohitba...@gmail.com <mailto:iamrohitba...@gmail.com>> wrote: > > Hi > > I am a django #n00b. I came across the django model > documentation and found it pretty interesting. > (https://docs.djangoproject.com/en/dev/topics/db/models/). > > Now my usecase requires I have a set of Models and each model > has multiple tables corresponding to it. > For example when user1 registers I can create a table > user1_t1, user1_t2, user1_t3. > When user2 registers I can create a table user2_t1, user2_t2, > user2_t3. > > I really like the Model abstraction but can't find a way to > create these multiple tables conveniently without creating new > models. I could not find clear solutions to this on the internet. > I just want clear separation between t1, t2, t3 for the all > users. Depending on the logged in user, I want to use the > relevant table. What is the cleanest way to achieve this with > Django? > > If it is not possible to do this with tables I can think about > different databases one for each user with the same set of > tables. Is it possible to do the same with multiple databases? > > Thanks > Rohit Banga > -- > You received this message because you are subscribed to the > Google Groups "Django users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/django-users/-/tl8qKhJb-_cJ. > To post to this group, send email to > django-users@googlegroups.com > <mailto:django-users@googlegroups.com>. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > <mailto:django-users%2bunsubscr...@googlegroups.com>. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > > > > -- > Mayukh Mukherjee > http://www.linkedin.com/in/mayukhmmukherjee > > > > -- > 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 > <mailto:django-users@googlegroups.com>. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > <mailto:django-users%2bunsubscr...@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. -- 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.