Skip to content

Commit 950be0b

Browse files
committed
Do constrain on content_type on old State system, but make sure we're
using the old content type - Legacy-Id: 3832
1 parent 27459c5 commit 950be0b

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

redesign/importing/import-docs.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -773,6 +773,8 @@ def import_from_idinternal(d, idinternal):
773773
#all_drafts = all_drafts[all_drafts.count() - 1000:]
774774
#all_drafts = all_drafts.none()
775775

776+
old_internetdraft_content_type_id = ContentType.objects.using("legacy").get(app_label="idtracker", model="internetdraft").pk
777+
776778
for index, o in enumerate(all_drafts.iterator()):
777779
print "importing", o.id_document_tag, o.filename, index, "ballot %s" % o.idinternal.ballot_id if o.idinternal and o.idinternal.ballot_id else ""
778780

@@ -807,9 +809,8 @@ def import_from_idinternal(d, idinternal):
807809

808810
d.unset_state("draft-iesg")
809811
try:
810-
# don't constrain on content type, it may be broken because of
811-
# the two databases in uses
812-
s = StateOld.objects.get(stateobjectrelation__content_id=o.pk)
812+
s = StateOld.objects.get(stateobjectrelation__content_type=old_internetdraft_content_type_id,
813+
stateobjectrelation__content_id=o.pk)
813814
except StateOld.DoesNotExist:
814815
s = None
815816

0 commit comments

Comments
 (0)