# Path: missions/models.py
# class DARTDynamicSettings(models.Model):
#     system_classification = models.ForeignKey(
#         'ClassificationLegend',
#     )
# 
#     host_output_format = models.CharField(
#         max_length=50,
#         default='{ip} ({name})',
#         help_text='Use "{ip}" and "{name}" to specify how you want hosts to be displayed.',
#         validators=[validate_host_format_string]
#     )
# 
#     # Since we're treating Dynamic Settings as a singleton,
#     # override the default manager to enforce this
#     objects = DARTDynamicSettingsManager()


from django import template
from missions.models import DARTDynamicSettings



register = template.Library()


@register.inclusion_tag('tags_managedata.html')
def manage_data_button(mission_id, testcase_id, number_of_attachments, as_button=False):
    """ Returns the text that should be displayed regarding attachments to a test case. """
    return {
        'mission_id': mission_id,
        'test_detail_id': testcase_id,
        'supporting_data_count': number_of_attachments,
        'as_button': as_button
    }

@register.inclusion_tag('tags_preloader_partial.html')
def preloader(align="center"):
    """
    Returns a quick preloader html snippet.
    :param align: string equal to "left", "center" (default), or "right"
    """
    return {
        'align': align,
    }

@register.inclusion_tag('tags_classification_legend_partial.html')
def legend_partial(location):
    """ Returns the top and bottom legend divs. """


# Path: missions/models.py
# class DARTDynamicSettings(models.Model):
#     system_classification = models.ForeignKey(
#         'ClassificationLegend',
#     )
# 
#     host_output_format = models.CharField(
#         max_length=50,
#         default='{ip} ({name})',
#         help_text='Use "{ip}" and "{name}" to specify how you want hosts to be displayed.',
#         validators=[validate_host_format_string]
#     )
# 
#     # Since we're treating Dynamic Settings as a singleton,
#     # override the default manager to enforce this
#     objects = DARTDynamicSettingsManager()


# Path: missions/templatetags/quickparts.py
from django import template
from missions.models import DARTDynamicSettings




register = template.Library()


@register.inclusion_tag('tags_managedata.html')
def manage_data_button(mission_id, testcase_id, number_of_attachments, as_button=False):
    """ Returns the text that should be displayed regarding attachments to a test case. """
    return {
        'mission_id': mission_id,
        'test_detail_id': testcase_id,
        'supporting_data_count': number_of_attachments,
        'as_button': as_button
    }

@register.inclusion_tag('tags_preloader_partial.html')
def preloader(align="center"):
    """
    Returns a quick preloader html snippet.
    :param align: string equal to "left", "center" (default), or "right"
    """
    return {
        'align': align,
    }

@register.inclusion_tag('tags_classification_legend_partial.html')
def legend_partial(location):
    """ Returns the top and bottom legend divs. """


    dynamic_settings_qryset = DARTDynamicSettings.objects.select_related(