# Path: boardinghouse/contrib/template/models.py
# class SchemaTemplate(SharedSchemaMixin, models.Model):
#     """
#     A ``boardinghouse.contrib.template.models.SchemaTemplate`` can be used
#     for creating a new schema complete with some initial data.
#     """
#     template_schema_id = models.AutoField(primary_key=True)
#     name = models.CharField(max_length=128, unique=True)
#     is_active = models.BooleanField(default=True)
#     description = models.TextField(null=True, blank=True)
# 
#     objects = SchemaTemplateQuerySet.as_manager()
# 
#     class Meta:
#         default_permissions = ('add', 'change', 'delete', 'view', 'activate', 'clone')
#         verbose_name = lazy(verbose_name, six.text_type)()
#         verbose_name_plural = lazy(verbose_name_plural, six.text_type)()
# 
#     def __str__(self):
#         return self.name
# 
#     @property
#     def schema(self):
#         return '{0}{1}'.format(settings.BOARDINGHOUSE_TEMPLATE_PREFIX, self.pk)
# 
#     def activate(self):
#         activate_schema(self.schema)
# 
#     def deactivate(self):
#         deactivate_schema()


from django.contrib import admin
from django.utils.translation import ugettext as _
from .models import SchemaTemplate



@admin.register(SchemaTemplate)
class SchemaTemplateAdmin(admin.ModelAdmin):
    list_display = [
        'name', 'is_active', 'description',
    ]
    inlines = []


# Inject an action into the registered ModelAdmin for our Schema model.
def create_template_from_schema(modeladmin, request, queryset):
    created = []
    for schema in queryset:

# Path: boardinghouse/contrib/template/models.py
# class SchemaTemplate(SharedSchemaMixin, models.Model):
#     """
#     A ``boardinghouse.contrib.template.models.SchemaTemplate`` can be used
#     for creating a new schema complete with some initial data.
#     """
#     template_schema_id = models.AutoField(primary_key=True)
#     name = models.CharField(max_length=128, unique=True)
#     is_active = models.BooleanField(default=True)
#     description = models.TextField(null=True, blank=True)
# 
#     objects = SchemaTemplateQuerySet.as_manager()
# 
#     class Meta:
#         default_permissions = ('add', 'change', 'delete', 'view', 'activate', 'clone')
#         verbose_name = lazy(verbose_name, six.text_type)()
#         verbose_name_plural = lazy(verbose_name_plural, six.text_type)()
# 
#     def __str__(self):
#         return self.name
# 
#     @property
#     def schema(self):
#         return '{0}{1}'.format(settings.BOARDINGHOUSE_TEMPLATE_PREFIX, self.pk)
# 
#     def activate(self):
#         activate_schema(self.schema)
# 
#     def deactivate(self):
#         deactivate_schema()


# Path: boardinghouse/contrib/template/admin.py
from django.contrib import admin
from django.utils.translation import ugettext as _
from .models import SchemaTemplate




@admin.register(SchemaTemplate)
class SchemaTemplateAdmin(admin.ModelAdmin):
    list_display = [
        'name', 'is_active', 'description',
    ]
    inlines = []


# Inject an action into the registered ModelAdmin for our Schema model.
def create_template_from_schema(modeladmin, request, queryset):
    created = []
    for schema in queryset:

        template = SchemaTemplate(name=schema.name)