Skip to content

Commit

Permalink
Closes #579: Add a description field to ExportTemplate
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremystretch committed Sep 27, 2016
1 parent 0900a6b commit 187a6de
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 3 deletions.
2 changes: 1 addition & 1 deletion netbox/extras/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class GraphAdmin(admin.ModelAdmin):

@admin.register(ExportTemplate)
class ExportTemplateAdmin(admin.ModelAdmin):
list_display = ['name', 'content_type', 'mime_type', 'file_extension']
list_display = ['name', 'content_type', 'description', 'mime_type', 'file_extension']


@admin.register(TopologyMap)
Expand Down
25 changes: 25 additions & 0 deletions netbox/extras/migrations/0003_exporttemplate_add_description.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-09-27 20:20
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('extras', '0002_custom_fields'),
]

operations = [
migrations.AddField(
model_name='exporttemplate',
name='description',
field=models.CharField(blank=True, max_length=200),
),
migrations.AlterField(
model_name='exporttemplate',
name='name',
field=models.CharField(max_length=100),
),
]
3 changes: 2 additions & 1 deletion netbox/extras/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,8 @@ def embed_link(self, obj):

class ExportTemplate(models.Model):
content_type = models.ForeignKey(ContentType, limit_choices_to={'model__in': EXPORTTEMPLATE_MODELS})
name = models.CharField(max_length=200)
name = models.CharField(max_length=100)
description = models.CharField(max_length=200, blank=True)
template_code = models.TextField()
mime_type = models.CharField(max_length=15, blank=True)
file_extension = models.CharField(max_length=15, blank=True)
Expand Down
2 changes: 1 addition & 1 deletion netbox/templates/inc/export_button.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<li><a href="?{% if request.GET %}{{ request.GET.urlencode }}&{% endif %}export">CSV (default)</a></li>
<li class="divider"></li>
{% for et in export_templates %}
<li><a href="?{% if request.GET %}{{ request.GET.urlencode }}&{% endif %}export={{ et.name }}">{{ et.name }}</a></li>
<li><a href="?{% if request.GET %}{{ request.GET.urlencode }}&{% endif %}export={{ et.name }}"{% if et.description %} title="{{ et.description }}"{% endif %}>{{ et.name }}</a></li>
{% endfor %}
</ul>
</div>
Expand Down

0 comments on commit 187a6de

Please sign in to comment.