Ok, I finally achieved this by overriding the inline formset, here is
all the code that I needed (in admin.py):

class WorkSeriesImagesFormset(BaseInlineFormSet):
        def get_queryset(self):
                return super(WorkSeriesImagesFormset, 
self).get_queryset().order_by
('series_order')

class WorkSeriesImageInline(admin.TabularInline):
        model = WorkImage
        formset = WorkSeriesImagesFormset

maybe that helps someone else!

w


On Feb 22, 12:20 pm, wolfram w <[email protected]> wrote:
> Hello,
>
> sorry if I missed the obvious answer - however I haven't found one in
> the last hour.
>
> I have an image model that has both series and year models as foreign
> keys - i.e. it belongs to both a series and a year and can be sorted
> differently within either. For ease of use in the admin I would like
> to appear the images in the inlines of the series and year admin
> sorted according to either the field order_in_series and
> order_in_year.
>
> I have already set up two different inline model admins, but ordering
> = ('order_in_series',) in the admin inline model declaration does not
> work - any ideas how I can achieve this?
>
> Many thanks in advance,
> wolfram
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
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