I have problem how to effectivelly manage this:

class Songs(models.Model):
        name= models.TextField()
        .....

class Scheduler(models.Model):
        when=models.DateTimeField()
        song=models.ForeignKey(Songs)
        other_data= models.TextField()

There is abour 10.000 songs in the table and nearly so schedulers. I need to 
somehow connect this together and help user to sellect the right Song for his 
Scheduler, prefferably in Admin interface. I want to avoid 10.000 lines long 
<select> tag, because many times the Scheduler.song will not be changed, only 
the Scheduler.other_data will be.

The best I can thing off with is to show list of Schedulers like so:

5678 | 2007-04-05 18:20:30  | 8765 Hey baby | blah, blah | (connect song)
5677 | 2007-04-05 18:10:30  | 8764 My Love   | blah, blah | (connect song)

and detail like this:

when [2007-04-05 18:20:30]
song [8765] (Hey baby)
other_data [blah, blah]


where (something) means link to another Admin Interface List of Song (for 
simple sorting & filtering) and clicking ont he link will open window with 
songs like this:
8765 | Hey baby | (Select this)
8764 | My Love   | (Select this)

and clicking on the (Select this) would update the record of Scheduler with 
the connected Song id

But I do not know, how to do it the best way.

Maybe the links (connect song) would lead to something like
/admin/my_app/scheduler/5678/song
(which will look like /admin/my_app/song)
and the link  (Select this) would lead to something like

/admin/my_app/scheduler/5678/song/8765/connect/


And the Scheduler.song field will be of type models.IntegerField
and there will be function in scheduler like this

def show_song_name(self):
        """find in table Songs self.song, then return the name"""


Or is there another, better way to do this? (Avoiding extra SQL request for 
each line of Scheduler list and still avoiding 10.000 lines long <select> in 
Scheduler change)

-- 
Zdravi
     Gilhad
     [EMAIL PROTECTED]

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to