Hi, everybody. In my appication ("nude") I have 4 models (really I have some more), something like this:
class State(models.Model): name:models.CharField(CharField(max_length=30) class Admin: pass class WorkCenter(models.Model): State=models.ForeignKey(State) phone= .... .... class Departament(models.Model): WorkCenter=models.ForeignKey(WorkCenter) name=.... .... class Worker(models.Model): name= ... Departament=models.ForeignKey(Departament) ... Because I can't use the admin site filter options to filter a worker list by WorkCenter and by State, I created a view in the DataBase (mysql), that joins the tables: CREATE VIEW nude_WorkerList AS SELECT nude_Worker.*, nude_WorkCenter.id as WorkCenter_id, nude_WorkCenter.State_id FROM nude_Worker, nude_Departament, nude_WorkCenter WHERE Worker.Departament_id=Departament.id and Departament.WorkCenter_id=WorkCenter.id then I create a model, that merge the above ones: class WorkerList(model.Model): name=... Departament=models.ForeignKey(Departament) ... WorkCenter=models.ForeignKey(WorkCenter) State=models.ForeignKey(State) class Admin: list_display=('name') list_filter=('State', 'WorkCenter', 'Departament') This model simulate an all in one an use the view not a table. It seems to work, all is ok in the interactive shell (WorkerList.object.filter(State__id=3) and is fast, but in the browser the request take a very very long time to get response. Why?, There is another way of do that job? thanks. --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---