Beispiel #1
0
    def setUpTestData(cls):

        content_types = ContentType.objects.filter(model__in=['site', 'rack', 'device'])

        export_templates = (
            ExportTemplate(name='Export Template 1', content_type=content_types[0], template_language=TemplateLanguageChoices.LANGUAGE_DJANGO, template_code='TESTING'),
            ExportTemplate(name='Export Template 2', content_type=content_types[1], template_language=TemplateLanguageChoices.LANGUAGE_JINJA2, template_code='TESTING'),
            ExportTemplate(name='Export Template 3', content_type=content_types[2], template_language=TemplateLanguageChoices.LANGUAGE_JINJA2, template_code='TESTING'),
        )
        ExportTemplate.objects.bulk_create(export_templates)
Beispiel #2
0
    def setUpTestData(cls):
        ct = ContentType.objects.get_for_model(Device)

        export_templates = (
            ExportTemplate(
                content_type=ct,
                name='Export Template 1',
                template_code=
                '{% for obj in queryset %}{{ obj.name }}\n{% endfor %}'),
            ExportTemplate(
                content_type=ct,
                name='Export Template 2',
                template_code=
                '{% for obj in queryset %}{{ obj.name }}\n{% endfor %}'),
            ExportTemplate(
                content_type=ct,
                name='Export Template 3',
                template_code=
                '{% for obj in queryset %}{{ obj.name }}\n{% endfor %}'),
        )
        ExportTemplate.objects.bulk_create(export_templates)