Broken layout for multiline fields in plugins #7872

Closed
opened 2025-12-29 20:29:13 +01:00 by adam · 0 comments
Owner

Originally created by @amyasnikov on GitHub (Apr 6, 2023).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v3.4.7

Python version

3.10

Steps to Reproduce

Someone broke down the layout of ObjectEditView related to multiline edit fields (like those which correspond to models.TextField or models.JSONField) starting from version v3.4.6.
Let's create very simple plugin to demonstrate this:

models.py

from django.db import models
from netbox.models import NetBoxModel


class MyModel(NetBoxModel):
    name = models.CharField(max_length=255)
    description = models.TextField()

forms.py

from netbox.forms import NetBoxModelForm
from .models import MyModel


class MyForm(NetBoxModelForm):
    class Meta:
        model = MyModel
        fields = ('name', 'description')

views.py

from netbox.views.generic import ObjectEditView
from .models import MyModel
from .forms import MyForm


class MyEditView(ObjectEditView):
    queryset = MyModel.objects.all()
    form = MyForm

urls.py

from django.urls import path
from .views import MyEditView


urlpatterns = [path('myview/add/', MyEditView.as_view())]

Let's see how the page http://<netbox>/plugins/testplugin/myview/add/ looks like under different versions:

v3.4.5:
v3.4.5-form


v3.4.6 and v3.4.7:
v3.4.6-form

Expected Behavior

The form with TextField or JSONField in v3.4.6+ should look exactly like in v3.4.5, it has to have the same width as the other fields (like name and tags in the example) and have the name of the field on the left

Observed Behavior

TextField in v3.4.6+ is relatively wider that all other fields and has no name of the field on the left.
I tried both: Firefox and Chrome, no difference.

Originally created by @amyasnikov on GitHub (Apr 6, 2023). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v3.4.7 ### Python version 3.10 ### Steps to Reproduce Someone broke down the layout of ObjectEditView related to multiline edit fields (like those which correspond to models.TextField or models.JSONField) starting from version v3.4.6. Let's create very simple plugin to demonstrate this: models.py ``` from django.db import models from netbox.models import NetBoxModel class MyModel(NetBoxModel): name = models.CharField(max_length=255) description = models.TextField() ``` forms.py ``` from netbox.forms import NetBoxModelForm from .models import MyModel class MyForm(NetBoxModelForm): class Meta: model = MyModel fields = ('name', 'description') ``` views.py ``` from netbox.views.generic import ObjectEditView from .models import MyModel from .forms import MyForm class MyEditView(ObjectEditView): queryset = MyModel.objects.all() form = MyForm ``` urls.py ``` from django.urls import path from .views import MyEditView urlpatterns = [path('myview/add/', MyEditView.as_view())] ``` Let's see how the page `http://<netbox>/plugins/testplugin/myview/add/` looks like under different versions: **v3.4.5**: <img width="787" alt="v3.4.5-form" src="https://user-images.githubusercontent.com/9154618/230376868-8abc1d61-71c8-479f-a6ab-121ff4432770.png"> ----------- **v3.4.6 and v3.4.7**: <img width="930" alt="v3.4.6-form" src="https://user-images.githubusercontent.com/9154618/230375198-5fdddd19-26f5-4f42-899f-50b247b2d49d.png"> ### Expected Behavior The form with TextField or JSONField in v3.4.6+ should look exactly like in v3.4.5, it has to have the same width as the other fields (like name and tags in the example) and have the name of the field on the left ### Observed Behavior TextField in v3.4.6+ is relatively wider that all other fields and has no name of the field on the left. I tried both: Firefox and Chrome, no difference.
adam added the type: bugstatus: accepted labels 2025-12-29 20:29:13 +01:00
adam closed this issue 2025-12-29 20:29:13 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#7872