schon/core/forms.py
Egor fureunoir Gorbunov d2b3dccda9 Features: 1) Add system_attributes JSONField to Stock model; 2) Introduce StockForm with system_attributes widget; 3) Integrate StockForm into StockAdmin in Django admin panel.
Fixes: None;

Extra: 1) Update migrations to include addition of `system_attributes`; 2) Modify admin interface to display `system_attributes` in additional_fields.
2025-10-26 19:59:43 +03:00

61 lines
1.3 KiB
Python

from django import forms
from .models import Order, OrderProduct, Product, Vendor
from .widgets import JSONTableWidget
class ProductForm(forms.ModelForm):
class Meta:
model = Product
fields = "__all__"
widgets = {
"attributes": JSONTableWidget(),
}
class VendorForm(forms.ModelForm):
class Meta:
model = Vendor
fields = "__all__"
widgets = {
"authentication": JSONTableWidget(),
}
class CRMForm(forms.ModelForm):
class Meta:
model = Product
fields = "__all__"
widgets = {
"authentication": JSONTableWidget(),
"attributes": JSONTableWidget(),
}
class OrderProductForm(forms.ModelForm):
class Meta:
model = OrderProduct
fields = "__all__"
widgets = {
"notifications": JSONTableWidget(),
"attributes": JSONTableWidget(),
}
class StockForm(forms.ModelForm):
class Meta:
model = Product
fields = "__all__"
widgets = {
"system_attributes": JSONTableWidget(),
}
class OrderForm(forms.ModelForm):
class Meta:
model = Order
fields = "__all__"
widgets = {
"notifications": JSONTableWidget(),
"attributes": JSONTableWidget(),
}