Hello, I'm programing a kind of admin zone for users, where users can add, manage and delete objects. I want to do it generic, but I have a big problem now. Imagine these models:
from django.contrib.auth.models import User class Library ( models.model ): library_name = models.CharField(..) owner = models.ForeignKey( User ) class Book( models.model ): library = models.ForeignKey( Library ) title = models.CharField(...) class Image ( models.model ): front_page = models.ImageField(..) book = models.ForeignKey( Book ) What I want is a function wich returns the class that have the field owner, populating the fields tables and where to use it with the extra method of the object. I have seen fill_table_cache in query.py, but I don't really understand how it works and if it's suitable for my needs. I need it because I want to show only the images that belong to an user, so I need to make something similar to: images = Image.objects.filter( book__library_owner = request.user ) I started the recursive function but I almost got crazy and this morning I deleted everything. As I'd like to do it general, It should work for diferent models at diferents levels of distance from classes. i.e. words = Word.objects.filter( page__book__library__owner = request.user ) or libraries =Library.objects.filter( owner = request.user ) Do you have any suggestions? Thank you very much. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---