On Sun, Sep 23, 2012 at 9:32 PM, Rohit Banga <iamrohitba...@gmail.com> wrote: > How about maintaining one database per department and then using "using" > parameter to select the appropriate database? > There are not too many departments. I know it may not scale or seem elegant > but keeping data in separate tables or databases is a requirement. > Using the following command I feel I can sync all models to a new database. > > ./manage.py syncdb --database=department1 > > Do you foresee any problem with this solution? > I am planning to have a default database with all users and groups and then > based on the group select the appropriate database. > I do not want to sync django-admin tables to all databases. Is there a way > to restrict models to a specific database? > Let say I have databases 0 ... n. > Departments 1 to n have the same set of tables with different data and > database i corresponds to department i. > database 0 is used to store only admin database tables. Is there a > reasonable way to restrict this within the same app or are there problems > that I cannot foresee? > > Thanks > Rohit Banga > http://iamrohitbanga.com/ > > > On Sun, Sep 23, 2012 at 12:56 PM, Dennis Lee Bieber <wlfr...@ix.netcom.com> > wrote: >> >> On Sat, 22 Sep 2012 22:04:41 -0700 (PDT), Bill Beal >> <b.b...@eximflow.com> declaimed the following in >> gmane.comp.python.django.user: >> >> > >> > I should think that if you have a foreign key to the department in all >> > tables that must be segregated by department, you could create a >> > decorator >> > that would apply a filter with the department key. But I don't know how >> > to >> > do it. >> > >> Which basically puts it back to what the OP insists they are not >> permitted to do -- have a single set of tables with a selection based on >> the logged in user's department. >> -- >> Wulfraed Dennis Lee Bieber AF6VN >> wlfr...@ix.netcom.com HTTP://wlfraed.home.netcom.com/ >> >> -- >> 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.
I just came across the Section on Managers in the Django book (p 197 in the second edition) here online: http://www.djangobook.com/en/2.0/chapter10.html Search for the section on Managers. This would be an excellent way to solve your problem. Using one model you can use different managers which filter on Department Name -- Joel Goldstick -- 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.