Skip to content

Commit

Permalink
Merge pull request #454 from peteeckel/fix/clarify-record-import
Browse files Browse the repository at this point in the history
Clarify record import
  • Loading branch information
peteeckel authored Oct 23, 2024
2 parents 2d83f5c + a67d137 commit 4ad1fc0
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
2 changes: 2 additions & 0 deletions docs/using_netbox_dns.md
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,8 @@ Note that for managed records there are no buttons for deleting, editing or clon
#### Displaying records
Records can either be displayed by opening the record list view from the "Records" or "Managed Records" navigation item on the left, or per zone via the respective tabs in the zone defail view. In any case, the tables can be filtered by name, value, zone, or tags to narrow down the set of records displayed.

#### Importing records
When importing records in bulk, the mandatory fields are `name`, `zone`, `type` and `value`. If the optional `view` field is not specified, NetBox DNS will always look for the zone specified in `zone` in the default view. To address zones in non-default views, the `view` field must also be specified.
### Registrars
Registrar objects relate to the DNS domain registration and represent the registrar information for DNS domains related to zones. A DNS zone does not necessarily need to be registered: Zones that are not available via public DNS or that are sub-zones of registered zones do not require registration. In most cases registration information is only required (and possible) for second-level domains.

Expand Down
7 changes: 7 additions & 0 deletions netbox_dns/forms/record.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,19 @@ def __init__(self, *args, **kwargs):
to_field_name="name",
required=True,
label=_("Zone"),
error_messages={
"invalid_choice": _("Zone %(value)s not found"),
},
)
view = CSVModelChoiceField(
queryset=View.objects.all(),
to_field_name="name",
required=False,
label=_p("DNS", "View"),
error_messages={
"invalid_choice": _("View %(value)s not found"),
},
help_text=_("This field is required if the zone is not in the default view"),
)
type = CSVChoiceField(
choices=RecordTypeChoices,
Expand Down
12 changes: 6 additions & 6 deletions netbox_dns/forms/zone.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ class ZoneImportForm(ZoneTemplateUpdateMixin, NetBoxModelImportForm):
required=False,
to_field_name="name",
error_messages={
"invalid_choice": _("View not found."),
"invalid_choice": _("View %(value)s not found"),
},
label=_("View"),
)
Expand Down Expand Up @@ -505,7 +505,7 @@ class ZoneImportForm(ZoneTemplateUpdateMixin, NetBoxModelImportForm):
required=False,
to_field_name="name",
error_messages={
"invalid_choice": _("Nameserver not found."),
"invalid_choice": _("Nameserver %(value)s not found"),
},
help_text=_("Primary nameserver for the zone"),
label=_("SOA MName"),
Expand Down Expand Up @@ -560,7 +560,7 @@ class ZoneImportForm(ZoneTemplateUpdateMixin, NetBoxModelImportForm):
required=False,
to_field_name="name",
error_messages={
"invalid_choice": _("Registrar not found."),
"invalid_choice": _("Registrar %(value)s not found"),
},
label=_("Registrar"),
)
Expand All @@ -573,7 +573,7 @@ class ZoneImportForm(ZoneTemplateUpdateMixin, NetBoxModelImportForm):
required=False,
to_field_name="contact_id",
error_messages={
"invalid_choice": _("Registrant contact ID not found"),
"invalid_choice": _("Registrant contact ID %(value)s not found"),
},
label=_("Registrant"),
)
Expand All @@ -582,7 +582,7 @@ class ZoneImportForm(ZoneTemplateUpdateMixin, NetBoxModelImportForm):
required=False,
to_field_name="contact_id",
error_messages={
"invalid_choice": _("Administrative contact ID not found"),
"invalid_choice": _("Administrative contact ID %(value)s not found"),
},
label=_("Administrative Contact"),
)
Expand All @@ -591,7 +591,7 @@ class ZoneImportForm(ZoneTemplateUpdateMixin, NetBoxModelImportForm):
required=False,
to_field_name="contact_id",
error_messages={
"invalid_choice": _("Technical contact ID not found"),
"invalid_choice": _("Technical contact ID %(value)s not found"),
},
label=_("Technical Contact"),
)
Expand Down
10 changes: 5 additions & 5 deletions netbox_dns/forms/zone_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ class ZoneTemplateImportForm(NetBoxModelImportForm):
required=False,
to_field_name="name",
error_messages={
"invalid_choice": _("Registrar not found."),
"invalid_choice": _("Registrar %(value)s not found"),
},
label=_("Registrar"),
)
Expand All @@ -168,7 +168,7 @@ class ZoneTemplateImportForm(NetBoxModelImportForm):
required=False,
to_field_name="contact_id",
error_messages={
"invalid_choice": _("Registrant contact ID not found"),
"invalid_choice": _("Registrant contact ID %(value)s not found"),
},
label=_("Registrant"),
)
Expand All @@ -177,7 +177,7 @@ class ZoneTemplateImportForm(NetBoxModelImportForm):
required=False,
to_field_name="contact_id",
error_messages={
"invalid_choice": _("Administrative contact ID not found"),
"invalid_choice": _("Administrative contact ID %(value)s not found"),
},
label=_("Administrative Contact"),
)
Expand All @@ -186,7 +186,7 @@ class ZoneTemplateImportForm(NetBoxModelImportForm):
required=False,
to_field_name="contact_id",
error_messages={
"invalid_choice": _("Technical contact ID not found"),
"invalid_choice": _("Technical contact ID %(value)s not found"),
},
label=_("Technical Contact"),
)
Expand All @@ -195,7 +195,7 @@ class ZoneTemplateImportForm(NetBoxModelImportForm):
required=False,
to_field_name="contact_id",
error_messages={
"invalid_choice": _("Billing contact ID not found"),
"invalid_choice": _("Billing contact ID %(value)s not found"),
},
label=_("Billing Contact"),
)
Expand Down

0 comments on commit 4ad1fc0

Please sign in to comment.