# Path: cyclosible/playbook/models.py
# class Playbook(models.Model):
#     class Meta:
#         app_label = 'playbook'
#         permissions = (
#             ("view_playbook", "Can view the playbook"),
#             ("can_override_skip_tags", 'Can override skip_tags'),
#             ("can_override_only_tags", 'Can override only_tags'),
#             ("can_override_extra_vars", 'Can override extra_vars'),
#             ("can_override_subset", 'Can override subset'),
#             ("can_run_playbook", 'Can run the playbook')
#         )
# 
#     name = models.CharField(max_length=100, unique=True, db_index=True)
#     only_tags = models.CharField(max_length=1024, default='', blank=True)
#     skip_tags = models.CharField(max_length=1024, default='', blank=True)
#     extra_vars = models.CharField(max_length=1024, default='', blank=True)
#     subset = models.CharField(max_length=1024, default='', blank=True)
#     group = models.ForeignKey(Group, null=True)
# 
#     def __unicode__(self):
#         return self.name
# 
# class PlaybookRunHistory(models.Model):
#     class Meta:
#         app_label = 'playbook'
# 
#     STATUS = (
#         ('SUCCESS', 'Success'),
#         ('RUNNING', 'Running'),
#         ('FAILURE', 'Failure'),
#     )
# 
#     playbook = models.ForeignKey(Playbook, db_index=True, related_name='history')
#     date_launched = models.DateTimeField(blank=True)
#     date_finished = models.DateTimeField(blank=True, null=True)
#     status = models.CharField(max_length=1024, default='RUNNING')
#     task_id = models.CharField(max_length=1024, default='', blank=True)
#     log_url = models.CharField(max_length=1024, default='', blank=True)
#     launched_by = models.ForeignKey(User)


from django.contrib import admin
from .models import Playbook, PlaybookRunHistory
from guardian.admin import GuardedModelAdmin


@admin.register(Playbook)
class PlaybookAdmin(GuardedModelAdmin):
    queryset = Playbook.objects.all()
    list_display = ('name', 'group', 'only_tags', 'skip_tags')


@admin.register(PlaybookRunHistory)
class PlaybookRunHistoryAdmin(GuardedModelAdmin):

# Path: cyclosible/playbook/models.py
# class Playbook(models.Model):
#     class Meta:
#         app_label = 'playbook'
#         permissions = (
#             ("view_playbook", "Can view the playbook"),
#             ("can_override_skip_tags", 'Can override skip_tags'),
#             ("can_override_only_tags", 'Can override only_tags'),
#             ("can_override_extra_vars", 'Can override extra_vars'),
#             ("can_override_subset", 'Can override subset'),
#             ("can_run_playbook", 'Can run the playbook')
#         )
# 
#     name = models.CharField(max_length=100, unique=True, db_index=True)
#     only_tags = models.CharField(max_length=1024, default='', blank=True)
#     skip_tags = models.CharField(max_length=1024, default='', blank=True)
#     extra_vars = models.CharField(max_length=1024, default='', blank=True)
#     subset = models.CharField(max_length=1024, default='', blank=True)
#     group = models.ForeignKey(Group, null=True)
# 
#     def __unicode__(self):
#         return self.name
# 
# class PlaybookRunHistory(models.Model):
#     class Meta:
#         app_label = 'playbook'
# 
#     STATUS = (
#         ('SUCCESS', 'Success'),
#         ('RUNNING', 'Running'),
#         ('FAILURE', 'Failure'),
#     )
# 
#     playbook = models.ForeignKey(Playbook, db_index=True, related_name='history')
#     date_launched = models.DateTimeField(blank=True)
#     date_finished = models.DateTimeField(blank=True, null=True)
#     status = models.CharField(max_length=1024, default='RUNNING')
#     task_id = models.CharField(max_length=1024, default='', blank=True)
#     log_url = models.CharField(max_length=1024, default='', blank=True)
#     launched_by = models.ForeignKey(User)


# Path: cyclosible/playbook/admin.py
from django.contrib import admin
from .models import Playbook, PlaybookRunHistory
from guardian.admin import GuardedModelAdmin



@admin.register(Playbook)
class PlaybookAdmin(GuardedModelAdmin):
    queryset = Playbook.objects.all()
    list_display = ('name', 'group', 'only_tags', 'skip_tags')


@admin.register(PlaybookRunHistory)
class PlaybookRunHistoryAdmin(GuardedModelAdmin):

    queryset = PlaybookRunHistory.objects.all()