Ejemplo n.º 1
0
class Network(models.Model):
    id = models.UUIDField(
        primary_key=True,
        help_text="ID of network",
        default=make_uuid,
        editable=True,
    )
    govern = models.ForeignKey(Govern,
                               help_text="Govern of node",
                               null=True,
                               on_delete=models.CASCADE)
    type = models.CharField(
        help_text="Type of network, %s" % NetworkType.values(),
        max_length=64,
        default=NetworkType.Fabric.value,
    )
    version = models.CharField(
        help_text="""
    Version of network.
    Fabric supported versions: %s
    """ % (FabricVersions.values()),
        max_length=64,
        default="",
    )
    created_at = models.DateTimeField(help_text="Create time of network",
                                      auto_now_add=True)

    class Meta:
        ordering = ("-created_at", )
Ejemplo n.º 2
0
class Network(models.Model):
    id = models.UUIDField(
        primary_key=True,
        help_text="ID of network",
        default=make_uuid,
        editable=True,
    )
    name = models.CharField(
        help_text="network name, can be generated automatically.",
        max_length=64,
        default=random_name("netowrk"),
    )
    type = models.CharField(
        help_text="Type of network, %s" % NetworkType.values(),
        max_length=64,
        default=NetworkType.Fabric.value,
    )
    version = models.CharField(
        help_text="""
    Version of network.
    Fabric supported versions: %s
    """ % (FabricVersions.values()),
        max_length=64,
        default="",
    )
    created_at = models.DateTimeField(help_text="Create time of network",
                                      auto_now_add=True)
    consensus = models.CharField(
        help_text="Consensus of network",
        max_length=128,
        default="raft",
    )
    organizations = ArrayField(models.CharField(max_length=128, blank=True),
                               help_text="organizations of network",
                               default=list,
                               null=True)
    genesisblock = models.TextField(
        help_text="genesis block",
        null=True,
    )
    database = models.CharField(
        help_text="database of network",
        max_length=128,
        default="leveldb",
    )

    class Meta:
        ordering = ("-created_at", )