kopia lustrzana https://github.com/wagtail/wagtail
Update documentation and code to put mixin first
rodzic
629deeba68
commit
6d1a9efbb6
|
|
@ -216,7 +216,7 @@ To do this, inherit from ``index.Indexed`` and add some ``search_fields`` to the
|
|||
|
||||
from wagtail.wagtailsearch import index
|
||||
|
||||
class Book(models.Model, index.Indexed):
|
||||
class Book(index.Indexed, models.Model):
|
||||
title = models.CharField(max_length=255)
|
||||
genre = models.CharField(max_length=255, choices=GENRE_CHOICES)
|
||||
author = models.ForeignKey(Author)
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ If a snippet model inherits from ``wagtail.wagtailsearch.index.Indexed``, as des
|
|||
...
|
||||
|
||||
@register_snippet
|
||||
class Advert(models.Model, index.Indexed):
|
||||
class Advert(index.Indexed, models.Model):
|
||||
url = models.URLField(null=True, blank=True)
|
||||
text = models.CharField(max_length=255)
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class Migration(migrations.Migration):
|
|||
('live', models.BooleanField(default=False)),
|
||||
('published_date', models.DateField(null=True)),
|
||||
],
|
||||
bases=(models.Model, wagtail.wagtailsearch.index.Indexed),
|
||||
bases=(wagtail.wagtailsearch.index.Indexed, models.Model),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='SearchTestChild',
|
||||
|
|
|
|||
|
|
@ -19,6 +19,6 @@ class Migration(migrations.Migration):
|
|||
('id', models.AutoField(serialize=False, primary_key=True, auto_created=True, verbose_name='ID')),
|
||||
('text', models.CharField(max_length=255)),
|
||||
],
|
||||
bases=(models.Model, wagtail.wagtailsearch.index.Indexed),
|
||||
bases=(wagtail.wagtailsearch.index.Indexed, models.Model),
|
||||
),
|
||||
]
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class RegisterDecorator(models.Model):
|
|||
# A snippet model that inherits from index.Indexed can be searched on
|
||||
|
||||
@register_snippet
|
||||
class SearchableSnippet(models.Model, index.Indexed):
|
||||
class SearchableSnippet(index.Indexed, models.Model):
|
||||
text = models.CharField(max_length=255)
|
||||
|
||||
search_fields = [
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ class Migration(migrations.Migration):
|
|||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
bases=(models.Model, wagtail.wagtailsearch.index.Indexed),
|
||||
bases=(wagtail.wagtailsearch.index.Indexed, models.Model),
|
||||
),
|
||||
migrations.RunPython(
|
||||
set_page_path_collation, migrations.RunPython.noop
|
||||
|
|
|
|||
|
|
@ -240,7 +240,7 @@ class Migration(migrations.Migration):
|
|||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
bases=(models.Model, wagtail.wagtailsearch.index.Indexed),
|
||||
bases=(wagtail.wagtailsearch.index.Indexed, models.Model),
|
||||
),
|
||||
migrations.RunPython(
|
||||
set_page_path_collation, migrations.RunPython.noop
|
||||
|
|
|
|||
|
|
@ -290,7 +290,7 @@ class PageBase(models.base.ModelBase):
|
|||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Page(six.with_metaclass(PageBase, MP_Node, ClusterableModel, index.Indexed)):
|
||||
class Page(six.with_metaclass(PageBase, MP_Node, index.Indexed, ClusterableModel)):
|
||||
title = models.CharField(
|
||||
verbose_name=_('title'),
|
||||
max_length=255,
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue