# Path: src/publisher/utils.py
# def msid2doi(msid):
#     assert isint(msid), "given msid must be an integer: %r" % msid
#     return "10.7554/eLife.%s" % pad_msid(msid)
# 
# def mk_dxdoi_link(doi):
#     return "https://dx.doi.org/%s" % doi
# 
# def json_dumps(obj, **kwargs):
#     "drop-in for json.dumps that handles datetime objects."
# 
#     def _handler(obj):
#         # datetime objects: 2015-03-17T00:00:00+00:00
#         # date objects: 2015-03-17
#         obj_t = type(obj)
#         if obj_t == date:
#             return ymd(obj)
#         if obj_t == datetime:
#             return ymdhms(obj)
#         raise TypeError(
#             "Object of type %s with value of %s is not JSON serializable"
#             % (type(obj), repr(obj))
#         )
# 
#     return json.dumps(obj, default=_handler, **kwargs)
# 
# def ordered_json_loads(data):
#     "same as json_loads, just ensures order is preserved when loading maps"
#     return json_loads(data, object_pairs_hook=OrderedDict)


from slugify import slugify
from django.db import models
from functools import partial
from annoying.fields import JSONField
from .utils import msid2doi, mk_dxdoi_link, json_dumps, ordered_json_loads
from django.core.exceptions import ObjectDoesNotExist
from django.conf import settings
                    self.articleversion_set.defer(
                        "article_json_v1", "article_json_v1_snippet"
                    )
                    .filter(status=VOR)
                    .earliest("version")
                )
            return self.articleversion_set.filter(status=VOR).earliest("version")
        except models.ObjectDoesNotExist:
            return None

    @property
    def latest_version(self):
        return self.articleversion_set.latest("version")

    @property
    def earliest_version(self):
        return self.articleversion_set.earliest("version")

    @property
    def datetime_published(self):
        try:
            return self.earliest_version.datetime_published
        except ObjectDoesNotExist:
            return None

    @property
    def title(self):
        return self.latest_version.title

    @property

# Path: src/publisher/utils.py
# def msid2doi(msid):
#     assert isint(msid), "given msid must be an integer: %r" % msid
#     return "10.7554/eLife.%s" % pad_msid(msid)
# 
# def mk_dxdoi_link(doi):
#     return "https://dx.doi.org/%s" % doi
# 
# def json_dumps(obj, **kwargs):
#     "drop-in for json.dumps that handles datetime objects."
# 
#     def _handler(obj):
#         # datetime objects: 2015-03-17T00:00:00+00:00
#         # date objects: 2015-03-17
#         obj_t = type(obj)
#         if obj_t == date:
#             return ymd(obj)
#         if obj_t == datetime:
#             return ymdhms(obj)
#         raise TypeError(
#             "Object of type %s with value of %s is not JSON serializable"
#             % (type(obj), repr(obj))
#         )
# 
#     return json.dumps(obj, default=_handler, **kwargs)
# 
# def ordered_json_loads(data):
#     "same as json_loads, just ensures order is preserved when loading maps"
#     return json_loads(data, object_pairs_hook=OrderedDict)


# Path: src/publisher/models.py
from slugify import slugify
from django.db import models
from functools import partial
from annoying.fields import JSONField
from .utils import msid2doi, mk_dxdoi_link, json_dumps, ordered_json_loads
from django.core.exceptions import ObjectDoesNotExist
from django.conf import settings

                    self.articleversion_set.defer(
                        "article_json_v1", "article_json_v1_snippet"
                    )
                    .filter(status=VOR)
                    .earliest("version")
                )
            return self.articleversion_set.filter(status=VOR).earliest("version")
        except models.ObjectDoesNotExist:
            return None

    @property
    def latest_version(self):
        return self.articleversion_set.latest("version")

    @property
    def earliest_version(self):
        return self.articleversion_set.earliest("version")

    @property
    def datetime_published(self):
        try:
            return self.earliest_version.datetime_published
        except ObjectDoesNotExist:
            return None

    @property
    def title(self):
        return self.latest_version.title

    @property

    def version(self):