Hello, I developed an AWESOME django website and everything works great except for one MAJOR problem!!
I have the following models: class Collection(models.Model): name = models.CharField("Name", maxlength=200) description = models.TextField(maxlength=1000, blank=True) class Choice(models.Model): choice = models.ForeignKey(Collection, edit_inline=models.TABULAR, num_in_admin=5) size = models.ForeignKey(Size, core=True) price = models.ForeignKey(Price, core=True) class Style(models.Model): name = models.CharField(maxlength=200, core=True) color = models.CharField(maxlength=100) collection = models.ForeignKey(Collection, edit_inline=models.TABULAR, num_in_admin=1) sandp = models.ManyToManyField(Choice) // I have my admin setup to where when I'm viewing a collection I can add Choice and Style records. When I first started adding records to my db everything was fine. I was able to use some JavaScript to only show Choice records that were associated with the Collection for each Style. I had to do this because there is now way (that I know of) to limit which Choices to appear in my Style sandp field. I tried to use the limit_choices_to attribute however it has no way of knowing which Collection I was currently editing. So I used JavaScript and AJAX to only show the Choice objects that are tied to the Collection that I'm currently editing. However, what I've come to find out is that this isn't the most effiecient way to do this, because as the more Choice and Style records I add the longer it takes my JavaScript to run. For an example let's say I have a 1000 Choice records. And let's say I have 100 Style records under a collection. So whenever I go to modify this collection (in the admin) each Style has to pull in 1000 Choice records in it's sandp field and then filter out the ones that are not tied to the current Collection. We'll if I have 100 Styles for a collection then it has to do that 100 times and that creates a problem when trying to load a collection page. I was reading the following Django Google thead and was wondering if this might be the solution: http://groups.google.com/group/django-users/browse_thread/thread/15cbc8a7205ed92e/481afde9d882b76f?lnk=gst&q=limit_choices_to#481afde9d882b76f Could I create a new view that gets called whenever a collection page in my admin gets called? And within that view would I be able to return only the Choice records that are tied to that collection? Is this possible and does this seem like the best way to solve my problem? 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 -~----------~----~----~----~------~----~------~--~---