# Path: organizer/models.py
# class Tag(models.Model):
#     name = models.CharField(
#         max_length=31, unique=True)
#     slug = models.SlugField(
#         max_length=31,
#         unique=True,
#         help_text='A label for URL config.')
# 
#     objects = TagManager()
# 
#     class Meta:
#         ordering = ['name']
# 
#     def __str__(self):
#         return self.name.title()
# 
#     def get_absolute_url(self):
#         return reverse('organizer_tag_detail',
#                        kwargs={'slug': self.slug})
# 
#     def get_delete_url(self):
#         return reverse('organizer_tag_delete',
#                        kwargs={'slug': self.slug})
# 
#     def get_update_url(self):
#         return reverse('organizer_tag_update',
#                        kwargs={'slug': self.slug})
# 
#     @cached_property
#     def published_posts(self):
#         return tuple(self.blog_posts.filter(
#             pub_date__lt=date.today()))
# 
#     def natural_key(self):
#         return (self.slug,)


from django.core.management.base import (
    BaseCommand, CommandError)
from django.utils.text import slugify
from ...models import Tag



class Command(BaseCommand):
    help = 'Create new Tag.'

    def add_arguments(self, parser):
        parser.add_argument(
            'tag_name',
            default=None,
            help='New tag name.')

    def handle(self, **options):
        tag_name = options.pop('tag_name', None)

# Path: organizer/models.py
# class Tag(models.Model):
#     name = models.CharField(
#         max_length=31, unique=True)
#     slug = models.SlugField(
#         max_length=31,
#         unique=True,
#         help_text='A label for URL config.')
# 
#     objects = TagManager()
# 
#     class Meta:
#         ordering = ['name']
# 
#     def __str__(self):
#         return self.name.title()
# 
#     def get_absolute_url(self):
#         return reverse('organizer_tag_detail',
#                        kwargs={'slug': self.slug})
# 
#     def get_delete_url(self):
#         return reverse('organizer_tag_delete',
#                        kwargs={'slug': self.slug})
# 
#     def get_update_url(self):
#         return reverse('organizer_tag_update',
#                        kwargs={'slug': self.slug})
# 
#     @cached_property
#     def published_posts(self):
#         return tuple(self.blog_posts.filter(
#             pub_date__lt=date.today()))
# 
#     def natural_key(self):
#         return (self.slug,)


# Path: organizer/management/commands/createtag.py
from django.core.management.base import (
    BaseCommand, CommandError)
from django.utils.text import slugify
from ...models import Tag




class Command(BaseCommand):
    help = 'Create new Tag.'

    def add_arguments(self, parser):
        parser.add_argument(
            'tag_name',
            default=None,
            help='New tag name.')

    def handle(self, **options):
        tag_name = options.pop('tag_name', None)

        Tag.objects.create(