# Path: app/models.py
# class Project(models.Model):
#     name = models.CharField(max_length=100)
#     added = models.DateTimeField(default=datetime.now)
# 
#     def __str__(self):  # __unicode__ on Python 2
#         return self.name
# 
#     class Meta:
#         ordering = ('name',)
# 
# class Flag(models.Model):
#     title = models.CharField(max_length=100)
#     note = models.TextField(default="")
#     assessment = models.ForeignKey(Assessment, null=True, on_delete=models.CASCADE)
#     done = models.BooleanField(default=False)
#     added = models.DateTimeField(default=datetime.now)
#     order = models.IntegerField(default=1)
# 
#     def __str__(self):  # __unicode__ on Python 2
#         return self.title
# 
#     class Meta:
#         ordering = ('title',)
# 
# class Sh0t(models.Model):
#     title = models.CharField(max_length=200)
#     body = models.TextField(default="")
#     assessment = models.ForeignKey(Assessment, null=True, on_delete=models.CASCADE)
#     added = models.DateTimeField(default=datetime.now)
#     severity = models.IntegerField(default=5, validators=[MinValueValidator(0), MaxValueValidator(5)])
# 
#     def __str__(self):  # __unicode__ on Python 2
#         return self.title
# 
#     class Meta:
#         ordering = ('severity','title',)
# 
# class Assessment(models.Model):
#     name = models.CharField(max_length=100)
#     project = models.ForeignKey(Project, on_delete=models.CASCADE)
#     added = models.DateTimeField(default=datetime.now)
# 
#     def __str__(self):  # __unicode__ on Python 2
#         return self.name
# 
#     class Meta:
#         ordering = ('name',)
# 
# class Project(models.Model):
#     name = models.CharField(max_length=100)
#     added = models.DateTimeField(default=datetime.now)
# 
#     def __str__(self):  # __unicode__ on Python 2
#         return self.name
# 
#     class Meta:
#         ordering = ('name',)


import django_tables2 as tables
from .models import Project, Flag, Sh0t, Assessment, Project
        model = Project
        template_name = "django_tables2/bootstrap-responsive.html"
        sequence = ('selection', 'name', 'added')
        fields = ('name', 'added')


class FlagTable(tables.Table):
    selection = tables.CheckBoxColumn(accessor='pk', attrs={"th__input": {"onclick": "toggle(this)"}}, orderable=False)
    title = tables.TemplateColumn('<a href="/app/flag/{{ record.pk }}"> {{ record.title }}</a>')
    done = tables.BooleanColumn(yesno='done,')
    project = tables.TemplateColumn('<a href="/app/project/{{ record.assessment.project.pk}}">{{ record.assessment.project }}</a>')
    assessment = tables.TemplateColumn('<a href="/app/assessment/{{ record.assessment.pk}}"> '
                                       '{{ record.assessment }}</a>')

    class Meta:
        model = Flag
        template_name = "django_tables2/bootstrap-responsive.html"
        sequence = ('selection', 'id', 'title', 'done', 'assessment', 'added')
        fields = ('id', 'title', 'added', 'done', 'assessment')
        empty_text = "No Flags yet"


class OpenFlagTable(tables.Table):
    selection = tables.CheckBoxColumn(accessor='pk', attrs={"th__input": {"onclick": "toggle(this)"}}, orderable=False)
    name = tables.TemplateColumn('<a href="/app/flag/{{ record.pk }}"> {{ record.title }}</a>')
    project = tables.TemplateColumn('<a href="/app/project/{{ record.assessment.project.pk}}">{{ record.assessment.project }}</a>')
    assessment = tables.TemplateColumn('<a href="/app/assessment/{{ record.assessment.pk}}"> '
                                       '{{ record.assessment }}</a>')

    class Meta:

# Path: app/models.py
# class Project(models.Model):
#     name = models.CharField(max_length=100)
#     added = models.DateTimeField(default=datetime.now)
# 
#     def __str__(self):  # __unicode__ on Python 2
#         return self.name
# 
#     class Meta:
#         ordering = ('name',)
# 
# class Flag(models.Model):
#     title = models.CharField(max_length=100)
#     note = models.TextField(default="")
#     assessment = models.ForeignKey(Assessment, null=True, on_delete=models.CASCADE)
#     done = models.BooleanField(default=False)
#     added = models.DateTimeField(default=datetime.now)
#     order = models.IntegerField(default=1)
# 
#     def __str__(self):  # __unicode__ on Python 2
#         return self.title
# 
#     class Meta:
#         ordering = ('title',)
# 
# class Sh0t(models.Model):
#     title = models.CharField(max_length=200)
#     body = models.TextField(default="")
#     assessment = models.ForeignKey(Assessment, null=True, on_delete=models.CASCADE)
#     added = models.DateTimeField(default=datetime.now)
#     severity = models.IntegerField(default=5, validators=[MinValueValidator(0), MaxValueValidator(5)])
# 
#     def __str__(self):  # __unicode__ on Python 2
#         return self.title
# 
#     class Meta:
#         ordering = ('severity','title',)
# 
# class Assessment(models.Model):
#     name = models.CharField(max_length=100)
#     project = models.ForeignKey(Project, on_delete=models.CASCADE)
#     added = models.DateTimeField(default=datetime.now)
# 
#     def __str__(self):  # __unicode__ on Python 2
#         return self.name
# 
#     class Meta:
#         ordering = ('name',)
# 
# class Project(models.Model):
#     name = models.CharField(max_length=100)
#     added = models.DateTimeField(default=datetime.now)
# 
#     def __str__(self):  # __unicode__ on Python 2
#         return self.name
# 
#     class Meta:
#         ordering = ('name',)


# Path: app/tables.py
import django_tables2 as tables
from .models import Project, Flag, Sh0t, Assessment, Project

        model = Project
        template_name = "django_tables2/bootstrap-responsive.html"
        sequence = ('selection', 'name', 'added')
        fields = ('name', 'added')


class FlagTable(tables.Table):
    selection = tables.CheckBoxColumn(accessor='pk', attrs={"th__input": {"onclick": "toggle(this)"}}, orderable=False)
    title = tables.TemplateColumn('<a href="/app/flag/{{ record.pk }}"> {{ record.title }}</a>')
    done = tables.BooleanColumn(yesno='done,')
    project = tables.TemplateColumn('<a href="/app/project/{{ record.assessment.project.pk}}">{{ record.assessment.project }}</a>')
    assessment = tables.TemplateColumn('<a href="/app/assessment/{{ record.assessment.pk}}"> '
                                       '{{ record.assessment }}</a>')

    class Meta:
        model = Flag
        template_name = "django_tables2/bootstrap-responsive.html"
        sequence = ('selection', 'id', 'title', 'done', 'assessment', 'added')
        fields = ('id', 'title', 'added', 'done', 'assessment')
        empty_text = "No Flags yet"


class OpenFlagTable(tables.Table):
    selection = tables.CheckBoxColumn(accessor='pk', attrs={"th__input": {"onclick": "toggle(this)"}}, orderable=False)
    name = tables.TemplateColumn('<a href="/app/flag/{{ record.pk }}"> {{ record.title }}</a>')
    project = tables.TemplateColumn('<a href="/app/project/{{ record.assessment.project.pk}}">{{ record.assessment.project }}</a>')
    assessment = tables.TemplateColumn('<a href="/app/assessment/{{ record.assessment.pk}}"> '
                                       '{{ record.assessment }}</a>')

    class Meta:

        model = Flag