|
4 | 4 | from django.utils.safestring import mark_safe
|
5 | 5 | from django.utils.translation import gettext as _
|
6 | 6 |
|
7 |
| -from extras.choices import CustomFieldVisibilityChoices, CustomFieldTypeChoices |
| 7 | +from extras.choices import CustomFieldVisibilityChoices, CustomFieldTypeChoices, JournalEntryKindChoices |
8 | 8 | from extras.models import *
|
9 | 9 | from extras.utils import FeatureQuery
|
| 10 | +from netbox.forms import NetBoxModelImportForm |
10 | 11 | from utilities.forms import CSVModelForm
|
11 | 12 | from utilities.forms.fields import CSVChoiceField, CSVContentTypeField, CSVMultipleContentTypeField, SlugField
|
12 | 13 |
|
|
15 | 16 | 'CustomFieldImportForm',
|
16 | 17 | 'CustomLinkImportForm',
|
17 | 18 | 'ExportTemplateImportForm',
|
| 19 | + 'JournalEntryImportForm', |
18 | 20 | 'SavedFilterImportForm',
|
19 | 21 | 'TagImportForm',
|
20 | 22 | 'WebhookImportForm',
|
@@ -132,3 +134,20 @@ class Meta:
|
132 | 134 | help_texts = {
|
133 | 135 | 'color': mark_safe(_('RGB color in hexadecimal (e.g. <code>00ff00</code>)')),
|
134 | 136 | }
|
| 137 | + |
| 138 | + |
| 139 | +class JournalEntryImportForm(NetBoxModelImportForm): |
| 140 | + assigned_object_type = CSVContentTypeField( |
| 141 | + queryset=ContentType.objects.all(), |
| 142 | + label=_('Assigned object type'), |
| 143 | + ) |
| 144 | + kind = CSVChoiceField( |
| 145 | + choices=JournalEntryKindChoices, |
| 146 | + help_text=_('The classification of entry') |
| 147 | + ) |
| 148 | + |
| 149 | + class Meta: |
| 150 | + model = JournalEntry |
| 151 | + fields = ( |
| 152 | + 'assigned_object_type', 'assigned_object_id', 'created_by', 'kind', 'comments', 'tags' |
| 153 | + ) |
0 commit comments