# Path: multiexplorer/multiexplorer/utils.py
# def datetime_to_iso(obj):
#     """
#     Python's default json encoder will blow up when it encounters datetime objects.
#     So this work around is needed in order to just handle making datetime
#     objects into iso8601 string format.
#     """
#     if isinstance(obj, datetime.datetime):
#         serial = obj.isoformat()
#         return serial
#     raise TypeError("Type not serializable")


import json
import arrow
import datetime
from django.utils import timezone
from django.db import models
from django.conf import settings
from .utils import datetime_to_iso
from moneywagon import get_single_transaction, get_block
from moneywagon.supply_estimator import SupplyEstimator
from pricetick.models import PriceTick
        tx['memos'] = Memo.get(txid=txid, crypto=crypto)
        return tx

    @classmethod
    def get_historical_fiat(cls, crypto, fiat, time):
        try:
            return PriceTick.nearest(crypto, fiat, time)
        except PriceTick.DoesNotExist:
            return None


class Memo(models.Model):
    crypto = models.CharField(max_length=8, default='btc')
    encrypted_text = models.TextField(blank=False)
    txid = models.CharField(max_length=72, db_index=True)
    pubkey = models.TextField()
    signature = models.TextField(blank=True)
    created = models.DateTimeField(default=timezone.now)

    @classmethod
    def get(cls, crypto, txid):
        memos = cls.objects.filter(txid=txid, crypto=crypto).exclude(encrypted_text="Please Delete")
        return [x.encrypted_text for x in memos]

    def as_dict(self):
        return {
            'encrypted_text': self.encrypted_text,
            'txid': self.txid,
            'signature': self.signature,
            'pubkey': self.pubkey,

# Path: multiexplorer/multiexplorer/utils.py
# def datetime_to_iso(obj):
#     """
#     Python's default json encoder will blow up when it encounters datetime objects.
#     So this work around is needed in order to just handle making datetime
#     objects into iso8601 string format.
#     """
#     if isinstance(obj, datetime.datetime):
#         serial = obj.isoformat()
#         return serial
#     raise TypeError("Type not serializable")


# Path: multiexplorer/multiexplorer/models.py
import json
import arrow
import datetime
from django.utils import timezone
from django.db import models
from django.conf import settings
from .utils import datetime_to_iso
from moneywagon import get_single_transaction, get_block
from moneywagon.supply_estimator import SupplyEstimator
from pricetick.models import PriceTick

        tx['memos'] = Memo.get(txid=txid, crypto=crypto)
        return tx

    @classmethod
    def get_historical_fiat(cls, crypto, fiat, time):
        try:
            return PriceTick.nearest(crypto, fiat, time)
        except PriceTick.DoesNotExist:
            return None


class Memo(models.Model):
    crypto = models.CharField(max_length=8, default='btc')
    encrypted_text = models.TextField(blank=False)
    txid = models.CharField(max_length=72, db_index=True)
    pubkey = models.TextField()
    signature = models.TextField(blank=True)
    created = models.DateTimeField(default=timezone.now)

    @classmethod
    def get(cls, crypto, txid):
        memos = cls.objects.filter(txid=txid, crypto=crypto).exclude(encrypted_text="Please Delete")
        return [x.encrypted_text for x in memos]

    def as_dict(self):
        return {
            'encrypted_text': self.encrypted_text,
            'txid': self.txid,
            'signature': self.signature,
            'pubkey': self.pubkey,

            'currency': self.crypto