mirror of
https://github.com/wagtail/wagtail.git
synced 2024-11-29 09:33:54 +01:00
Rename field.rel to field.remote_field
This commit is contained in:
parent
7a3707eca0
commit
0f6f650178
@ -327,7 +327,7 @@ class PageSerializer(BaseSerializer):
|
||||
if relation_info.to_many:
|
||||
model = getattr(self.Meta, 'model')
|
||||
child_relations = {
|
||||
child_relation.field.rel.related_name: child_relation.related_model
|
||||
child_relation.field.remote_field.related_name: child_relation.related_model
|
||||
for child_relation in get_all_child_relations(model)
|
||||
}
|
||||
|
||||
|
@ -308,13 +308,13 @@ class IndexView(WMABaseView):
|
||||
# Lookups on non-existent fields are ok, since they're ignored
|
||||
# later.
|
||||
return True
|
||||
if hasattr(field, 'rel'):
|
||||
if field.rel is None:
|
||||
if hasattr(field, 'remote_field'):
|
||||
if field.remote_field is None:
|
||||
# This property or relation doesn't exist, but it's allowed
|
||||
# since it's ignored in ChangeList.get_filters().
|
||||
return True
|
||||
model = field.rel.to
|
||||
rel_name = field.rel.get_related_field().name
|
||||
model = field.remote_field.model
|
||||
rel_name = field.remote_field.get_related_field().name
|
||||
elif isinstance(field, ForeignObjectRel):
|
||||
model = field.model
|
||||
rel_name = model._meta.pk.name
|
||||
|
@ -555,7 +555,7 @@ class BaseChooserPanel(BaseFieldPanel):
|
||||
|
||||
def get_chosen_item(self):
|
||||
field = self.instance._meta.get_field(self.field_name)
|
||||
related_model = field.rel.model
|
||||
related_model = field.remote_field.model
|
||||
try:
|
||||
return getattr(self.instance, self.field_name)
|
||||
except related_model.DoesNotExist:
|
||||
@ -606,7 +606,7 @@ class BasePageChooserPanel(BaseChooserPanel):
|
||||
|
||||
return target_models
|
||||
else:
|
||||
return [cls.model._meta.get_field(cls.field_name).rel.to]
|
||||
return [cls.model._meta.get_field(cls.field_name).remote_field.model]
|
||||
|
||||
|
||||
class PageChooserPanel(object):
|
||||
|
@ -510,7 +510,7 @@ class Page(six.with_metaclass(PageBase, AbstractPage, index.Indexed, Clusterable
|
||||
|
||||
for field in cls._meta.fields:
|
||||
if isinstance(field, models.ForeignKey) and field.name not in field_exceptions:
|
||||
if field.rel.on_delete == models.CASCADE:
|
||||
if field.remote_field.on_delete == models.CASCADE:
|
||||
errors.append(
|
||||
checks.Warning(
|
||||
"Field hasn't specified on_delete action",
|
||||
|
Loading…
Reference in New Issue
Block a user