Contact without name is not linked from contacts table #5922

Closed
opened 2025-12-29 19:34:15 +01:00 by adam · 5 comments
Owner

Originally created by @candlerb on GitHub (Jan 11, 2022).

NetBox version

v3.1.5

Python version

3.8

Steps to Reproduce

  1. Create a contact object with an e-mail and phone, but no name (this is permitted)
  2. Go to /tenancy/contacts/
  3. Try to navigate to the contact you created in (1)

Expected Behavior

Be able to click on something to get to the contact, e.g. /tenancy/contacts/24/

Observed Behavior

  1. The "name" column displays as but is not clickable. Ditto "group" and "title".
  2. The "phone" column is a tel: link for the telephone number
  3. The "email" column is a mailto: link for the E-mail address
  4. The "assignments" column is a number, and not linkified

Hence with the default table layout, there is no way to navigate to the contact, or even to know its id.

I think the solution is to make the "name" column clickable when it contains

Workaround: go to Configure Table, add "ID" column. This shows the ID and is clickable.

Originally created by @candlerb on GitHub (Jan 11, 2022). ### NetBox version v3.1.5 ### Python version 3.8 ### Steps to Reproduce 1. Create a contact object with an e-mail and phone, but no name (this is permitted) 2. Go to `/tenancy/contacts/` 3. Try to navigate to the contact you created in (1) ### Expected Behavior Be able to click on something to get to the contact, e.g. `/tenancy/contacts/24/` ### Observed Behavior 1. The "name" column displays as `—` but is not clickable. Ditto "group" and "title". 2. The "phone" column is a `tel:` link for the telephone number 3. The "email" column is a `mailto:` link for the E-mail address 4. The "assignments" column is a number, and not linkified Hence with the default table layout, there is no way to navigate to the contact, or even to know its id. I think the solution is to make the "name" column clickable when it contains `—` **Workaround**: go to Configure Table, add "ID" column. This shows the ID *and* is clickable.
adam closed this issue 2025-12-29 19:34:15 +01:00
Author
Owner

@kkthxbye-code commented on GitHub (Jan 11, 2022):

but no name (this is permitted)

But is that permitted?

>>> b = Contact.objects.create(name="", phone="20202020", email="test@test.com")
>>> b.full_clean()
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/home/removed/devel/netbox-source/venv/lib/python3.10/site-packages/django/db/models/base.py", line 1251, in full_clean
    raise ValidationError(errors)
django.core.exceptions.ValidationError: {'name': ['This field cannot be blank.']}
@kkthxbye-code commented on GitHub (Jan 11, 2022): >but no name (this is permitted) But is that permitted? ```python >>> b = Contact.objects.create(name="", phone="20202020", email="test@test.com") >>> b.full_clean() Traceback (most recent call last): File "<console>", line 1, in <module> File "/home/removed/devel/netbox-source/venv/lib/python3.10/site-packages/django/db/models/base.py", line 1251, in full_clean raise ValidationError(errors) django.core.exceptions.ValidationError: {'name': ['This field cannot be blank.']} ```
Author
Owner

@candlerb commented on GitHub (Jan 11, 2022):

There is a related problem with the 'contacts' table back from another object, e.g. site.

  1. Link a contact with a site
  2. Navigate to the site view, e.g. /dcim/sites/9/
  3. Look at the "contacts" table

image

Normally you'd click on the Name to find out more info (e.g. Email and Phone), but there's nothing to click on here. And if you click on Edit, you're editing the Contact Assignment, not the Contact.

@candlerb commented on GitHub (Jan 11, 2022): There is a related problem with the 'contacts' table back from another object, e.g. site. 1. Link a contact with a site 2. Navigate to the site view, e.g. `/dcim/sites/9/` 3. Look at the "contacts" table ![image](https://user-images.githubusercontent.com/44789/148937258-088fc260-ae31-4f75-acbb-bf77b7cc19fe.png) Normally you'd click on the Name to find out more info (e.g. Email and Phone), but there's nothing to click on here. And if you click on Edit, you're editing the Contact Assignment, not the Contact.
Author
Owner

@candlerb commented on GitHub (Jan 11, 2022):

but no name (this is permitted)

But is that permitted?

>>> b = Contact.objects.create(name="", phone="20202020", email="test@test.com")
>>> b.full_clean()
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/home/removed/devel/netbox-source/venv/lib/python3.10/site-packages/django/db/models/base.py", line 1251, in full_clean
    raise ValidationError(errors)
django.core.exceptions.ValidationError: {'name': ['This field cannot be blank.']}

Weird. I was running the code here and it happily created contacts with no name. Definitely Netbox v3.1.5.

EDIT: this was based on Dan Sheps' code and it didn't have the full_clean() step. That'll be why. I hate the Django ORM :-(

@candlerb commented on GitHub (Jan 11, 2022): > > but no name (this is permitted) > > But is that permitted? > > ```python > >>> b = Contact.objects.create(name="", phone="20202020", email="test@test.com") > >>> b.full_clean() > Traceback (most recent call last): > File "<console>", line 1, in <module> > File "/home/removed/devel/netbox-source/venv/lib/python3.10/site-packages/django/db/models/base.py", line 1251, in full_clean > raise ValidationError(errors) > django.core.exceptions.ValidationError: {'name': ['This field cannot be blank.']} > ``` Weird. I was running the code [here](https://github.com/netbox-community/netbox/discussions/8169#discussioncomment-1942476) and it happily created contacts with no name. Definitely Netbox v3.1.5. EDIT: this was based on Dan Sheps' code and it didn't have the `full_clean()` step. That'll be why. I hate the Django ORM :-(
Author
Owner

@kkthxbye-code commented on GitHub (Jan 11, 2022):

but no name (this is permitted)

But is that permitted?

>>> b = Contact.objects.create(name="", phone="20202020", email="test@test.com")
>>> b.full_clean()
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/home/removed/devel/netbox-source/venv/lib/python3.10/site-packages/django/db/models/base.py", line 1251, in full_clean
    raise ValidationError(errors)
django.core.exceptions.ValidationError: {'name': ['This field cannot be blank.']}

Weird. I was running the code here and it happily created contacts with no name. Definitely Netbox v3.1.5.

When handling objects manually in custom scripts you have to trigger full_clean() yourself.

@kkthxbye-code commented on GitHub (Jan 11, 2022): > > > but no name (this is permitted) > > > > > > But is that permitted? > > ```python > > >>> b = Contact.objects.create(name="", phone="20202020", email="test@test.com") > > >>> b.full_clean() > > Traceback (most recent call last): > > File "<console>", line 1, in <module> > > File "/home/removed/devel/netbox-source/venv/lib/python3.10/site-packages/django/db/models/base.py", line 1251, in full_clean > > raise ValidationError(errors) > > django.core.exceptions.ValidationError: {'name': ['This field cannot be blank.']} > > ``` > > Weird. I was running the code [here](https://github.com/netbox-community/netbox/discussions/8169#discussioncomment-1942476) and it happily created contacts with no name. Definitely Netbox v3.1.5. When handling objects manually in custom scripts you have to trigger full_clean() yourself.
Author
Owner

@jeremystretch commented on GitHub (Jan 11, 2022):

  1. Create a contact object with an e-mail and phone, but no name (this is permitted)

The name is a required field when creating a contact via either the UI or REST API. It's possible to create a nameless contact only if bypassing the validation NetBox has in place, which appears to be the case here. Going to close this out as I don't believe there's any action to take.

@jeremystretch commented on GitHub (Jan 11, 2022): > 1. Create a contact object with an e-mail and phone, but no name (this is permitted) The name is a required field when creating a contact via either the UI or REST API. It's possible to create a nameless contact only if bypassing the validation NetBox has in place, which appears to be the case here. Going to close this out as I don't believe there's any action to take.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#5922