from django.db import models
from django.utils import timezone

from comics.core.models import Comic


class Set(models.Model):
    name = models.SlugField(max_length=100, unique=True,
        help_text='The set identifier')
    add_new_comics = models.BooleanField(default=False,
        help_text='Automatically add new comics to the set')
    hide_empty_comics = models.BooleanField(default=False,
        help_text='Hide comics without matching releases from view')
    created = models.DateTimeField(auto_now_add=True)
    last_modified = models.DateTimeField()
    last_loaded = models.DateTimeField()
    comics = models.ManyToManyField(Comic)

    class Meta:
        db_table = 'comics_set'
        ordering = ['name']

    def __unicode__(self):
        return self.name

    def get_slug(self):
        return self.name

    def set_slug(self, slug):
        self.name = slug

    slug = property(get_slug, set_slug)

    def set_loaded(self):
        self.last_loaded = timezone.now()
        self.save()

from django.db import models
from django.utils import timezone

from comics.core.models import Comic


class Set(models.Model):
    name = models.SlugField(
        max_length=100, unique=True,
        help_text='The set identifier')
    add_new_comics = models.BooleanField(
        default=False,
        help_text='Automatically add new comics to the set')
    hide_empty_comics = models.BooleanField(
        default=False,
        help_text='Hide comics without matching releases from view')
    created = models.DateTimeField(auto_now_add=True)
    last_modified = models.DateTimeField()
    last_loaded = models.DateTimeField()
    comics = models.ManyToManyField(Comic)

    class Meta:
        db_table = 'comics_set'
        ordering = ['name']

    def __unicode__(self):
        return self.name

    def get_slug(self):
        return self.name

    def set_slug(self, slug):
        self.name = slug

    slug = property(get_slug, set_slug)

    def set_loaded(self):
        self.last_loaded = timezone.now()
        self.save()

Fix all warnings in sets app
flake8: Fix all warnings in sets app

  from django.db import models
  from django.utils import timezone
  
  from comics.core.models import Comic
  
  
  class Set(models.Model):
-     name = models.SlugField(max_length=100, unique=True,
+     name = models.SlugField(
+         max_length=100, unique=True,
          help_text='The set identifier')
-     add_new_comics = models.BooleanField(default=False,
+     add_new_comics = models.BooleanField(
+         default=False,
          help_text='Automatically add new comics to the set')
-     hide_empty_comics = models.BooleanField(default=False,
+     hide_empty_comics = models.BooleanField(
+         default=False,
          help_text='Hide comics without matching releases from view')
      created = models.DateTimeField(auto_now_add=True)
      last_modified = models.DateTimeField()
      last_loaded = models.DateTimeField()
      comics = models.ManyToManyField(Comic)
  
      class Meta:
          db_table = 'comics_set'
          ordering = ['name']
  
      def __unicode__(self):
          return self.name
  
      def get_slug(self):
          return self.name
  
      def set_slug(self, slug):
          self.name = slug
  
      slug = property(get_slug, set_slug)
  
      def set_loaded(self):
          self.last_loaded = timezone.now()
          self.save()
  
Fix all warnings in sets app
## Code Before:
from django.db import models
from django.utils import timezone

from comics.core.models import Comic


class Set(models.Model):
    name = models.SlugField(max_length=100, unique=True,
        help_text='The set identifier')
    add_new_comics = models.BooleanField(default=False,
        help_text='Automatically add new comics to the set')
    hide_empty_comics = models.BooleanField(default=False,
        help_text='Hide comics without matching releases from view')
    created = models.DateTimeField(auto_now_add=True)
    last_modified = models.DateTimeField()
    last_loaded = models.DateTimeField()
    comics = models.ManyToManyField(Comic)

    class Meta:
        db_table = 'comics_set'
        ordering = ['name']

    def __unicode__(self):
        return self.name

    def get_slug(self):
        return self.name

    def set_slug(self, slug):
        self.name = slug

    slug = property(get_slug, set_slug)

    def set_loaded(self):
        self.last_loaded = timezone.now()
        self.save()

## Instruction:
Fix all warnings in sets app
## Code After:
from django.db import models
from django.utils import timezone

from comics.core.models import Comic


class Set(models.Model):
    name = models.SlugField(
        max_length=100, unique=True,
        help_text='The set identifier')
    add_new_comics = models.BooleanField(
        default=False,
        help_text='Automatically add new comics to the set')
    hide_empty_comics = models.BooleanField(
        default=False,
        help_text='Hide comics without matching releases from view')
    created = models.DateTimeField(auto_now_add=True)
    last_modified = models.DateTimeField()
    last_loaded = models.DateTimeField()
    comics = models.ManyToManyField(Comic)

    class Meta:
        db_table = 'comics_set'
        ordering = ['name']

    def __unicode__(self):
        return self.name

    def get_slug(self):
        return self.name

    def set_slug(self, slug):
        self.name = slug

    slug = property(get_slug, set_slug)

    def set_loaded(self):
        self.last_loaded = timezone.now()
        self.save()
