3

I let a content type inherit from RichTextContent and add a few fields, like a title.

class SimpleTextContent(RichTextContent):
    title = models.CharField(max_length=20)
    ...

Unfortunately, in the Page Admin the text field will appear on top of the corresponding inline admin. But it would be nicer to have the title appear first.

How can I change the order of the fields in a content type's inline admin?

Philipp Zedler
  • 1,660
  • 1
  • 17
  • 36

2 Answers2

5

You have to define feincms_item_editor_inline on SimpleTextContent (docs):

from feincms.admin.item_editor import FeinCMSInline


class SimpleTextInlineAdmin(FeinCMSInline):
    fields = ('title', 'text', 'order', 'region')


class SimpleTextContent(RichTextContent):
    feincms_item_editor_inline = SimpleTextInlineAdmin

    title = models.CharField(max_length=20)

Take care to always include order and region, even though they're not displayed in the admin.

Jonas
  • 970
  • 1
  • 8
  • 17
0

Does this work?

class SimpleTextContent(RichTextContent):
    title = models.CharField(max_length=20)
    ...
    class Meta:
         ordering = ['title', 'some_other_field`,]
Newtt
  • 6,050
  • 13
  • 68
  • 106
  • Thanks a lot, @Newtt, but it does not work. According to the [docs](https://docs.djangoproject.com/en/1.10/ref/models/options/#ordering), `ordering` determines "the default ordering for the object, for use when obtaining lists of objects", i.e. the order of objects in a queryset. – Philipp Zedler Oct 12 '16 at 15:14