from django.db import models
from jsonfield import JSONField


class Repository(models.Model):
    # github, gitbucket, etc...
    hub = models.CharField(max_length=191, db_index=True)
    # user
    user = models.CharField(max_length=191)
    # repository_name
    name = models.CharField(max_length=191)
    # username/reponame
    full_name = models.CharField(max_length=191, db_index=True)
    # Secret Key
    secret = models.CharField(max_length=191, db_index=True)


class DeploySetting(models.Model):
    repository = models.ForeignKey(Repository)
    branch = models.CharField(max_length=191)
    command = models.TextField()


class HookLog(models.Model):
    data = JSONField()
    created_at = models.DateTimeField("レコード作成日時", auto_now_add=True)


class DeployLog(models.Model):
    log = models.TextField()

@@ -458,32 +458,113 @@
 db_index=True)%0A%0A
+    def __str__(self):%0A        return '%7B%7D: %7B%7D'.format(self.hub, self.full_name)%0A%0A
 %0Aclass DeploySet
@@ -710,16 +710,101 @@
 ield()%0A%0A
+    def __str__(self):%0A        return '%7B%7D: %7B%7D'.format(self.repository, self.branch)%0A%0A
 %0Aclass H
@@ -890,20 +890,8 @@
 eld(
-%22%E3%83%AC%E3%82%B3%E3%83%BC%E3%83%89%E4%BD%9C%E6%88%90%E6%97%A5%E6%99%82%22, 
 auto
@@ -910,65 +910,347 @@
 e)%0A%0A
-%0Aclass DeployLog(models.Model):%0A    log = models.TextField(
+    def __str__(self):%0A        return '%7B%7D: %7B%7D'.format(self.created_at, self.data.get('path'))%0A%0A%0Aclass DeployLog(models.Model):%0A    log = models.TextField()%0A    return_code = models.IntegerField()%0A    created_at = models.DateTimeField(auto_now_add=True)%0A%0A    def __str__(self):%0A        return '%7B%7D: %7B%7D'.format(self.created_at, self.return_code
 )%0A

update core models