Features: None;
Fixes: 1) Correct "name" field reference by replacing dynamic LANGUAGE_CODE-based key; Extra: 1) Remove unnecessary get_prepopulated_fields method; 2) Minor cleanup of admin field logic;
This commit is contained in:
parent
b4b52897fb
commit
b18c75ccd2
1 changed files with 2 additions and 5 deletions
|
|
@ -9,7 +9,7 @@ from django.utils.translation import gettext_lazy as _
|
||||||
from modeltranslation.admin import TabbedTranslationAdmin
|
from modeltranslation.admin import TabbedTranslationAdmin
|
||||||
from mptt.admin import DraggableMPTTAdmin
|
from mptt.admin import DraggableMPTTAdmin
|
||||||
|
|
||||||
from evibes.settings import CONSTANCE_CONFIG, LANGUAGE_CODE
|
from evibes.settings import CONSTANCE_CONFIG
|
||||||
|
|
||||||
from .forms import OrderForm, OrderProductForm, VendorForm
|
from .forms import OrderForm, OrderProductForm, VendorForm
|
||||||
from .models import (
|
from .models import (
|
||||||
|
|
@ -117,7 +117,7 @@ class CategoryAdmin(DraggableMPTTAdmin, BasicModelAdmin, TabbedTranslationAdmin)
|
||||||
None,
|
None,
|
||||||
{
|
{
|
||||||
"fields": (
|
"fields": (
|
||||||
"name_" + LANGUAGE_CODE.replace("-", "_"),
|
"name",
|
||||||
"description",
|
"description",
|
||||||
"parent",
|
"parent",
|
||||||
"is_active",
|
"is_active",
|
||||||
|
|
@ -129,9 +129,6 @@ class CategoryAdmin(DraggableMPTTAdmin, BasicModelAdmin, TabbedTranslationAdmin)
|
||||||
]
|
]
|
||||||
autocomplete_fields = ["parent"]
|
autocomplete_fields = ["parent"]
|
||||||
|
|
||||||
def get_prepopulated_fields(self, request, obj=None):
|
|
||||||
return {"name": ("description",)}
|
|
||||||
|
|
||||||
def indented_title(self, instance):
|
def indented_title(self, instance):
|
||||||
return instance.name
|
return instance.name
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue