# 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 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 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 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 Template(models.Model):
#     name = models.CharField(max_length=100)
#     body = models.TextField(default="")
#     added = models.DateTimeField(default=datetime.now)
# 
#     def __str__(self):  # __unicode__ on Python 2
#         return self.name
# 
#     class Meta:
#         ordering = ('name',)
# 
# Path: configuration/models.py
# class CaseMaster(models.Model):
#     name = models.CharField(max_length=100)
#     module = models.ForeignKey(ModuleMaster, on_delete=models.CASCADE)
#     description = models.TextField(default="")
#     order = models.IntegerField(default=0)
#     created_by = models.ForeignKey(User, related_name="case_module_created_by", null=True, on_delete=models.CASCADE)
#     created = models.DateTimeField(default=datetime.now)
#     updated_by = models.ForeignKey(User, related_name="case_module_updated_by", null=True, on_delete=models.CASCADE)
#     updated = models.DateTimeField(default=datetime.now)
# 
#     def __str__(self):  # __unicode__ on Python 2
#         return self.name
# 
#     def save(self, *args, **kwargs):
#         if not self.id:
#             self.created = timezone.now()
#         self.updated = timezone.now()
#         return super(CaseMaster, self).save(*args, **kwargs)
# 
#     class Meta:
#         ordering = ('name',)
# 
# class ModuleMaster(models.Model):
#     name = models.CharField(max_length=100)
#     description = models.TextField(default="")
#     order = models.IntegerField(default=0)
#     methodology = models.ForeignKey(MethodologyMaster, on_delete=models.CASCADE, null=True, default=None)
#     created_by = models.ForeignKey(User, related_name="module_created_by", null=True, on_delete=models.CASCADE)
#     created = models.DateTimeField(default=datetime.now)
#     updated_by = models.ForeignKey(User, related_name="module_updated_by", null=True, on_delete=models.CASCADE)
#     updated = models.DateTimeField(default=datetime.now)
# 
#     def __str__(self):  # __unicode__ on Python 2
#         return self.name
# 
#     def save(self, *args, **kwargs):
#         if not self.id:
#             self.created = timezone.now()
#         self.updated = timezone.now()
#         return super(ModuleMaster, self).save(*args, **kwargs)
# 
#     class Meta:
#         ordering = ('name',)
# 
# class MethodologyMaster(models.Model):
#     name = models.CharField(max_length=100)
#     description = models.TextField(default="")
#     order = models.IntegerField(default=0)
#     created_by = models.ForeignKey(User, related_name="methodology_created_by", null=True, on_delete=models.CASCADE)
#     created = models.DateTimeField(default=datetime.now)
#     updated_by = models.ForeignKey(User, related_name="methodology_updated_by", null=True, on_delete=models.CASCADE)
#     updated = models.DateTimeField(default=datetime.now)
# 
#     def __str__(self):  # __unicode__ on Python 2
#         return self.name
# 
#     def save(self, *args, **kwargs):
#         if not self.id:
#             self.created = timezone.now()
#         self.updated = timezone.now()
#         return super(MethodologyMaster, self).save(*args, **kwargs)
# 
#     class Meta:
#         ordering = ('name',)


from app.models import Project, Assessment, Sh0t, Flag, Template
from configuration.models import CaseMaster, ModuleMaster, MethodologyMaster
from rest_framework import serializers
        model = Project
        fields = ('name', 'added')


class AssessmentSerializer(serializers.ModelSerializer):
    class Meta:
        model = Assessment
        fields = ('name', 'added', 'project')


class FlagSerializer(serializers.ModelSerializer):
    class Meta:
        model = Flag
        fields = ('id', 'title', 'note', 'done', 'assessment')


class Sh0tSerializer(serializers.ModelSerializer):
    class Meta:
        model = Sh0t
        fields = ('title', 'severity', 'body', 'added', 'assessment')


class TemplateSerializer(serializers.ModelSerializer):
    class Meta:
        model = Template
        fields = ('name', 'body')


class CaseMasterSerializer(serializers.ModelSerializer):
    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 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 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 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 Template(models.Model):
#     name = models.CharField(max_length=100)
#     body = models.TextField(default="")
#     added = models.DateTimeField(default=datetime.now)
# 
#     def __str__(self):  # __unicode__ on Python 2
#         return self.name
# 
#     class Meta:
#         ordering = ('name',)
# 
# Path: configuration/models.py
# class CaseMaster(models.Model):
#     name = models.CharField(max_length=100)
#     module = models.ForeignKey(ModuleMaster, on_delete=models.CASCADE)
#     description = models.TextField(default="")
#     order = models.IntegerField(default=0)
#     created_by = models.ForeignKey(User, related_name="case_module_created_by", null=True, on_delete=models.CASCADE)
#     created = models.DateTimeField(default=datetime.now)
#     updated_by = models.ForeignKey(User, related_name="case_module_updated_by", null=True, on_delete=models.CASCADE)
#     updated = models.DateTimeField(default=datetime.now)
# 
#     def __str__(self):  # __unicode__ on Python 2
#         return self.name
# 
#     def save(self, *args, **kwargs):
#         if not self.id:
#             self.created = timezone.now()
#         self.updated = timezone.now()
#         return super(CaseMaster, self).save(*args, **kwargs)
# 
#     class Meta:
#         ordering = ('name',)
# 
# class ModuleMaster(models.Model):
#     name = models.CharField(max_length=100)
#     description = models.TextField(default="")
#     order = models.IntegerField(default=0)
#     methodology = models.ForeignKey(MethodologyMaster, on_delete=models.CASCADE, null=True, default=None)
#     created_by = models.ForeignKey(User, related_name="module_created_by", null=True, on_delete=models.CASCADE)
#     created = models.DateTimeField(default=datetime.now)
#     updated_by = models.ForeignKey(User, related_name="module_updated_by", null=True, on_delete=models.CASCADE)
#     updated = models.DateTimeField(default=datetime.now)
# 
#     def __str__(self):  # __unicode__ on Python 2
#         return self.name
# 
#     def save(self, *args, **kwargs):
#         if not self.id:
#             self.created = timezone.now()
#         self.updated = timezone.now()
#         return super(ModuleMaster, self).save(*args, **kwargs)
# 
#     class Meta:
#         ordering = ('name',)
# 
# class MethodologyMaster(models.Model):
#     name = models.CharField(max_length=100)
#     description = models.TextField(default="")
#     order = models.IntegerField(default=0)
#     created_by = models.ForeignKey(User, related_name="methodology_created_by", null=True, on_delete=models.CASCADE)
#     created = models.DateTimeField(default=datetime.now)
#     updated_by = models.ForeignKey(User, related_name="methodology_updated_by", null=True, on_delete=models.CASCADE)
#     updated = models.DateTimeField(default=datetime.now)
# 
#     def __str__(self):  # __unicode__ on Python 2
#         return self.name
# 
#     def save(self, *args, **kwargs):
#         if not self.id:
#             self.created = timezone.now()
#         self.updated = timezone.now()
#         return super(MethodologyMaster, self).save(*args, **kwargs)
# 
#     class Meta:
#         ordering = ('name',)


# Path: api/serializers.py
from app.models import Project, Assessment, Sh0t, Flag, Template
from configuration.models import CaseMaster, ModuleMaster, MethodologyMaster
from rest_framework import serializers

        model = Project
        fields = ('name', 'added')


class AssessmentSerializer(serializers.ModelSerializer):
    class Meta:
        model = Assessment
        fields = ('name', 'added', 'project')


class FlagSerializer(serializers.ModelSerializer):
    class Meta:
        model = Flag
        fields = ('id', 'title', 'note', 'done', 'assessment')


class Sh0tSerializer(serializers.ModelSerializer):
    class Meta:
        model = Sh0t
        fields = ('title', 'severity', 'body', 'added', 'assessment')


class TemplateSerializer(serializers.ModelSerializer):
    class Meta:
        model = Template
        fields = ('name', 'body')


class CaseMasterSerializer(serializers.ModelSerializer):
    class Meta:

        model = CaseMaster