I have been playing with Django for only a day or so but have had great success coercing a legacy database into the Django world. I have quickly found that the Admin interface *nearly* provides all the editing features I currently need for updating my DB and I think it would be a great shame to leave my current 'no code' model to add the few extra features I need in views/templates. I am hoping that the community might be able to help me out with my three questions:
1) Menu item ordering class Iconography(meta.Model): description = meta.CharField(maxlength=255) def __repr__(self): return self.description class META: admin = meta.Admin( ordering = ('description',), ) class Light(meta.Model): window = meta.ForeignKey(Window, edit_inline=meta.TABULAR) sub_location = meta.CharField(maxlength=255, core=True) iconography = meta.ForeignKey(Iconography) class META: admin = meta.Admin() The 'ordering' works as expected when looking at the Iconography table, but when viewing a Light, the 'select' widget shows the Iconography's in (I guess) ID order. Is it possible to sort this menu? 2) Ordering on foreign key field class Window(meta.Model): building = meta.ForeignKey(Building, edit_inline=meta.TABULAR) reference = meta.CharField(maxlength=255, core=True) location = meta.ForeignKey(Location) def __repr__(self): return "%s / W%s / %s" % (self.get_building().principal_name, self.reference, self.get_location()) class META: admin = meta.Admin( ordering = ('reference',), # FIXME sort on building name too ) Is it possible to sort this Window table on the principal_name of the building referred to and then the Window's own reference (effectively sorted on the __repr__ I have written). 3) Linking to another table class Building(meta.Model): """Building table.""" ..... class Window(meta.Model): building = meta.ForeignKey(Building, edit_inline=meta.TABULAR) ...... class Light(meta.Model): window = meta.ForeignKey(Window, edit_inline=meta.TABULAR) ...... Opening an entry in the Window table correcly shows all Lights. Opening an entry in the Building table correctly shows all Windows, but it does not show all the subsequent Lights. In practice I don't want to as there are too many, but is it possible to add links in the inline Windows to open the relevant Window table? I could obviously do all of these things by writing a custom view, but I don't want to embark on coding if I've just missed some simple tricks. Any Help / guidance greatfully received. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---