Define a custom ModelForm for your model that sets the appropriate queryset parameter (either altering the field in __init__, or just defining the field in the class as a ModelMultipleChoiceField). Then register that ModelForm for use in the admin (via a ModelAdmin class).
On Aug 9, 7:51 pm, Martin Tiršel <dja...@blackpage.eu> wrote: > Hello, > > I have a gallery model and an image model. First, I create some galleries, > then I insert images into them. But now, I want to add multiple thumbnails > feature for galleries (thumbnails representing the gallery, not thumbnails > for images inside gallery), so I added ManyToManyField and I can select > some images, which will be used as thumbnails. But is there a way, how can > I limit these images only to images belonging to the currently editing > gallery? > > There is the limit_choices_to option, but I would need to point to 'self', > what is not possible on this place. Second problem would be that I have to > create gallery first, then insert images and then select thumbnails, so > there is another problem, that if there would be a solution in limiting > the image list, I can not use it in create gallery page in admin. > > What is the best way to solve this problem? > > Thanks, > Martin -- 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.