Skip to content

Commit

Permalink
more arrow stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
longhotsummer committed Jan 10, 2020
1 parent 4132150 commit 84cc5e7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions indigo_api/migrations/0021_document_expression_date.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# -*- coding: utf-8 -*-
import arrow
from django.db import models, migrations
from indigo_api.models import Document
from django.utils.timezone import now


def forwards(apps, schema_editor):
for doc in Document.objects.select_related(None).only('document_xml', 'expression_date').all():
doc.expression_date = doc.publication_date or arrow.now().date()
doc.expression_date = doc.publication_date or now().date()
doc.save()


Expand Down
4 changes: 2 additions & 2 deletions indigo_api/migrations/0042_add_repeal_works.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from django.db import migrations

from cobalt.act import datestring
import arrow
from iso8601 import parse_date


def create_repeals(apps, schema_editor):
Expand All @@ -18,7 +18,7 @@ def create_repeals(apps, schema_editor):

for doc in documents:
if doc.repeal_event:
date = arrow.get(doc.repeal_event['date']).date()
date = parse_date(doc.repeal_event['date']).date()

work = works.get(doc.repeal_event['repealing_uri'])
if not work:
Expand Down
4 changes: 2 additions & 2 deletions indigo_api/migrations/0046_works_for_amendments.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-04-16 14:56
from django.db import migrations
import arrow
from iso8601 import parse_date

from cobalt.act import FrbrUri

Expand All @@ -19,7 +19,7 @@ def create_amendments(apps, schema_editor):
for doc in documents:
for amendment in (doc.amendment_events or []):
work = works.get(amendment['amending_uri'])
date = arrow.get(amendment['date']).date()
date = parse_date(amendment['date']).date()

if not work:
# validate frbr_uri
Expand Down

0 comments on commit 84cc5e7

Please sign in to comment.