chore: use more expressive related_name
This commit is contained in:
parent
f3566c2743
commit
d6f58b3e67
|
@ -49,7 +49,7 @@ class Migration(migrations.Migration):
|
|||
field=ietf.utils.models.ForeignKey(
|
||||
default=1, # A lie, but a convenient one - no relations point here.
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="target",
|
||||
related_name="targets_related",
|
||||
to="doc.document",
|
||||
db_index=False,
|
||||
),
|
||||
|
@ -61,7 +61,7 @@ class Migration(migrations.Migration):
|
|||
name="target",
|
||||
field=ietf.utils.models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="target",
|
||||
related_name="targets_related",
|
||||
to="doc.document",
|
||||
db_index=True,
|
||||
),
|
||||
|
|
|
@ -667,7 +667,7 @@ STATUSCHANGE_RELATIONS = ('tops','tois','tohist','toinf','tobcp','toexp')
|
|||
|
||||
class RelatedDocument(models.Model):
|
||||
source = ForeignKey('Document')
|
||||
target = ForeignKey('Document', related_name='target')
|
||||
target = ForeignKey('Document', related_name='targets_related')
|
||||
relationship = ForeignKey(DocRelationshipName)
|
||||
def action(self):
|
||||
return self.relationship.name
|
||||
|
|
|
@ -416,7 +416,7 @@ def start_review_sanity_check(request, name):
|
|||
raise Http404
|
||||
|
||||
# sanity check that there's not already a conflict review document for this document
|
||||
if [ rel.source for rel in doc_to_review.target.filter(relationship='conflrev') ]: # TODO whould be targets or targets_related
|
||||
if [ rel.source for rel in doc_to_review.targets_related.filter(relationship='conflrev') ]:
|
||||
raise Http404
|
||||
|
||||
return doc_to_review
|
||||
|
|
|
@ -673,7 +673,7 @@ def edit_info(request, name):
|
|||
e.save()
|
||||
events.append(e)
|
||||
|
||||
replaces = Document.objects.filter(target__source=doc, target__relationship="replaces") # TODO: again target needs to change
|
||||
replaces = Document.objects.filter(targets_related__source=doc, targets_related__relationship="replaces")
|
||||
if replaces:
|
||||
# this should perhaps be somewhere else, e.g. the
|
||||
# place where the replace relationship is established?
|
||||
|
|
Loading…
Reference in a new issue