# Path: devmason_server/models.py
# class Project(models.Model):
#     name = models.CharField(max_length=200)
#     slug = models.SlugField(unique=True)
#     owner = models.ForeignKey(User, related_name='projects', blank=True, null=True)
# 
#     class Meta:
#         ordering = ['name']
# 
#     def __unicode__(self):
#         return self.name
# 
#     @models.permalink
#     def get_absolute_url(self):
#         return ('project_detail', [self.slug])
# 
# class Build(models.Model):
#     project = models.ForeignKey(Project, related_name='builds')
#     success = models.BooleanField()
#     started = models.DateTimeField()
#     finished = models.DateTimeField()
#     host = models.CharField(max_length=250)
#     arch = models.CharField(max_length=250)
#     user = models.ForeignKey(User, blank=True, null=True, related_name='builds')
#     extra_info = JSONField()
# 
#     class Meta:
#         ordering = ['-finished']
# 
#     def __unicode__(self):
#         return u"Build %s for %s" % (self.pk, self.project)
# 
#     @models.permalink
#     def get_absolute_url(self):
#         return ('build_detail', [self.project.slug, self.pk])
# 
# class BuildStep(models.Model):
#     build = models.ForeignKey(Build, related_name='steps')
#     success = models.BooleanField()
#     started = models.DateTimeField()
#     finished = models.DateTimeField()
#     name = models.CharField(max_length=250)
#     output = models.TextField(blank=True)
#     errout = models.TextField(blank=True)
#     extra_info = JSONField()
# 
#     class Meta:
#         ordering = ['build', 'started']
# 
#     def __unicode__(self):
#         return "%s: %s" % (self.build, self.name)
# 
# class BuildRequest(models.Model):
#     repository = models.ForeignKey(Repository, related_name='build_requests')
#     identifier = models.CharField(max_length=200)
#     requested = models.DateTimeField()
# 
# 
#     def __unicode__(self):
#         return "Build for %s: %s" % (self.repository.project, self.identifier)
# 
#     class Meta:
#         ordering = ['-requested']
# 
# class Repository(models.Model):
#     """
#     Representation of a version control system repository.
#     """
#     project = models.ForeignKey(Project, related_name='repos')
#     url = models.CharField(max_length=500, unique=True)
#     type = models.CharField('Version Control Type', max_length=20,
#                                 choices=VCS_TYPES, default=VCS_TYPES[0][0])
# 
#     def __unicode__(self):
#         return self.url


from django.contrib import admin
from devmason_server.models import Project, Build, BuildStep, BuildRequest, Repository

class BuildAdmin(admin.ModelAdmin):
    model = Build
    list_display = ('project', 'success', 'user', 'started')
    

admin.site.register(Project)

# Path: devmason_server/models.py
# class Project(models.Model):
#     name = models.CharField(max_length=200)
#     slug = models.SlugField(unique=True)
#     owner = models.ForeignKey(User, related_name='projects', blank=True, null=True)
# 
#     class Meta:
#         ordering = ['name']
# 
#     def __unicode__(self):
#         return self.name
# 
#     @models.permalink
#     def get_absolute_url(self):
#         return ('project_detail', [self.slug])
# 
# class Build(models.Model):
#     project = models.ForeignKey(Project, related_name='builds')
#     success = models.BooleanField()
#     started = models.DateTimeField()
#     finished = models.DateTimeField()
#     host = models.CharField(max_length=250)
#     arch = models.CharField(max_length=250)
#     user = models.ForeignKey(User, blank=True, null=True, related_name='builds')
#     extra_info = JSONField()
# 
#     class Meta:
#         ordering = ['-finished']
# 
#     def __unicode__(self):
#         return u"Build %s for %s" % (self.pk, self.project)
# 
#     @models.permalink
#     def get_absolute_url(self):
#         return ('build_detail', [self.project.slug, self.pk])
# 
# class BuildStep(models.Model):
#     build = models.ForeignKey(Build, related_name='steps')
#     success = models.BooleanField()
#     started = models.DateTimeField()
#     finished = models.DateTimeField()
#     name = models.CharField(max_length=250)
#     output = models.TextField(blank=True)
#     errout = models.TextField(blank=True)
#     extra_info = JSONField()
# 
#     class Meta:
#         ordering = ['build', 'started']
# 
#     def __unicode__(self):
#         return "%s: %s" % (self.build, self.name)
# 
# class BuildRequest(models.Model):
#     repository = models.ForeignKey(Repository, related_name='build_requests')
#     identifier = models.CharField(max_length=200)
#     requested = models.DateTimeField()
# 
# 
#     def __unicode__(self):
#         return "Build for %s: %s" % (self.repository.project, self.identifier)
# 
#     class Meta:
#         ordering = ['-requested']
# 
# class Repository(models.Model):
#     """
#     Representation of a version control system repository.
#     """
#     project = models.ForeignKey(Project, related_name='repos')
#     url = models.CharField(max_length=500, unique=True)
#     type = models.CharField('Version Control Type', max_length=20,
#                                 choices=VCS_TYPES, default=VCS_TYPES[0][0])
# 
#     def __unicode__(self):
#         return self.url


# Path: devmason_server/admin.py
from django.contrib import admin
from devmason_server.models import Project, Build, BuildStep, BuildRequest, Repository


class BuildAdmin(admin.ModelAdmin):
    model = Build
    list_display = ('project', 'success', 'user', 'started')
    

admin.site.register(Project)

admin.site.register(Build, BuildAdmin)