On Sep 25, 9:51 am, ionut cristian cucu <cucife...@gmail.com> wrote: > I've tried to do something like that: > class Pacienti_manager(models.Manager): > def get_visible(self): > return(super(Pacienti_manager, > self).get_query_set().filter(pacient_id__exact=pacient_id) > but still no go, I tried > def queryset(self, request): > qs= super(Pacient, self).queryset(request) > return qs.filter(exit_pacient_id=pacient_id) > in Pacient class, but again all objects in Pacient who have an Exit do > show up in the view. > Any ideas what I'm doing wrong?
That method needs to go in your ModelAdmin class, not your model. -- DR. > 2010/9/23 Vali Lungu <vali.lu...@gmail.com>: > > > > > Hi, > > > You may be interested in this: > >http://stackoverflow.com/questions/2618893/how-to-filter-queryset-in-..., > > looks like a similar (solved) problem. > > In short, it's about overriding the queryset() method of ModelAdmin. > > > On Thu, Sep 23, 2010 at 11:33 AM, ionut cristian cucu <cucife...@gmail.com> > > wrote: > > >> Hi list, > >> I just came to django, and to web programming for that matter, so my > >> question is from a n0b: > >> I have to models: > >> class Pacient(models.Model): > >> name=models.CharField('name', max_length=123) > >> <snip> > >> class Exit(models.Model): > >> pacient=models.ForeignKey(Pacient) > >> <snip> > > >> How to I get the admin interface to show only the pacients for whom I > >> have no exit objects. > >> Rephrase: if I have an Exit object for a Pacient, I don't want that > >> Pacient object to show up > >> 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-us...@googlegroups.com. > >> To unsubscribe from this group, send email to > >> django-users+unsubscr...@googlegroups.com. > >> For more options, visit this group at > >>http://groups.google.com/group/django-users?hl=en. > > > -- > > You received this message because you are subscribed to the Google Groups > > "Django users" group. > > To post to this group, send email to django-us...@googlegroups.com. > > To unsubscribe from this group, send email to > > django-users+unsubscr...@googlegroups.com. > > For more options, visit this group at > >http://groups.google.com/group/django-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.