added base unit to unit editor
This commit is contained in:
parent
a8f1cd26cd
commit
1f10a66c74
@ -478,7 +478,7 @@ class UnitSerializer(UniqueFieldsMixin, ExtendedRecipeMixin, OpenDataModelMixin)
|
|||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Unit
|
model = Unit
|
||||||
fields = ('id', 'name', 'plural_name', 'description', 'numrecipe', 'image', 'open_data_slug')
|
fields = ('id', 'name', 'plural_name', 'description', 'base_unit', 'numrecipe', 'image', 'open_data_slug')
|
||||||
read_only_fields = ('id', 'numrecipe', 'image')
|
read_only_fields = ('id', 'numrecipe', 'image')
|
||||||
|
|
||||||
|
|
||||||
|
@ -492,6 +492,26 @@
|
|||||||
"Combine_All_Steps": "Combine all steps into a single field.",
|
"Combine_All_Steps": "Combine all steps into a single field.",
|
||||||
"Plural": "Plural",
|
"Plural": "Plural",
|
||||||
"plural_short": "plural",
|
"plural_short": "plural",
|
||||||
|
|
||||||
|
"g": "gram [g] (metric, weight)",
|
||||||
|
"kg": "kilogram [kg] (metric, weight)",
|
||||||
|
"ounce": "ounce [oz] (weight)",
|
||||||
|
"pound": "pound (weight)",
|
||||||
|
"ml": "millilitre [ml] (metric, volume)",
|
||||||
|
"l": "litre [l] (metric, volume)",
|
||||||
|
"fluid_ounce": "fluid ounce [fl oz] (US, volume)",
|
||||||
|
"pint": "pint [pt] (US, volume)",
|
||||||
|
"quart": "quart [qt] (US, volume)",
|
||||||
|
"gallon": "gallon [gal] (US, volume)",
|
||||||
|
"tbsp": "tablespoon [tbsp] (US, volume)",
|
||||||
|
"tsp": "teaspoon [tsp] (US, volume)",
|
||||||
|
"imperial_fluid_ounce": "imperial fluid ounce [imp fl oz] (UK, volume)",
|
||||||
|
"imperial_pint": "imperial pint [imp pt] (UK, volume)",
|
||||||
|
"imperial_quart": "imperial quart [imp qt] (UK, volume)",
|
||||||
|
"imperial_gallon": "imperial gal [imp gal] (UK, volume)",
|
||||||
|
"imperial_tbsp": "imperial tablespoon [imp tbsp] (UK, volume)",
|
||||||
|
"imperial_tsp": "imperial teaspoon [imp tsp] (UK, volume)",
|
||||||
|
|
||||||
"Use_Plural_Unit_Always": "Use plural form for unit always",
|
"Use_Plural_Unit_Always": "Use plural form for unit always",
|
||||||
"Use_Plural_Unit_Simple": "Use plural form for unit dynamically",
|
"Use_Plural_Unit_Simple": "Use plural form for unit dynamically",
|
||||||
"Use_Plural_Food_Always": "Use plural form for food always",
|
"Use_Plural_Food_Always": "Use plural form for food always",
|
||||||
|
@ -281,7 +281,7 @@ export class Models {
|
|||||||
apiName: "Unit",
|
apiName: "Unit",
|
||||||
paginated: true,
|
paginated: true,
|
||||||
create: {
|
create: {
|
||||||
params: [["name", "plural_name", "description", "open_data_slug",]],
|
params: [["name", "plural_name", "description", "base_unit","open_data_slug",]],
|
||||||
form: {
|
form: {
|
||||||
show_help: true,
|
show_help: true,
|
||||||
name: {
|
name: {
|
||||||
@ -307,6 +307,34 @@ export class Models {
|
|||||||
placeholder: "",
|
placeholder: "",
|
||||||
optional: true,
|
optional: true,
|
||||||
},
|
},
|
||||||
|
base_unit: {
|
||||||
|
form_field: true,
|
||||||
|
type: "choice",
|
||||||
|
options: [
|
||||||
|
{value: "g", text: "g"},
|
||||||
|
{value: "kg", text: "kg"},
|
||||||
|
{value: "ounce", text: "ounce"},
|
||||||
|
{value: "pound", text: "pound"},
|
||||||
|
{value: "ml", text: "ml"},
|
||||||
|
{value: "l", text: "l"},
|
||||||
|
{value: "fluid_ounce", text: "fluid_ounce"},
|
||||||
|
{value: "pint", text: "pint"},
|
||||||
|
{value: "quart", text: "quart"},
|
||||||
|
{value: "gallon", text: "gallon"},
|
||||||
|
{value: "tbsp", text: "tbsp"},
|
||||||
|
{value: "tsp", text: "tsp"},
|
||||||
|
{value: "imperial_fluid_ounce", text: "imperial_fluid_ounce"},
|
||||||
|
{value: "imperial_pint", text: "imperial_pint"},
|
||||||
|
{value: "imperial_quart", text: "imperial_quart"},
|
||||||
|
{value: "imperial_gallon", text: "imperial_gallon"},
|
||||||
|
{value: "imperial_tbsp", text: "imperial_tbsp"},
|
||||||
|
{value: "imperial_tsp", text: "imperial_tsp"},
|
||||||
|
],
|
||||||
|
field: "base_unit",
|
||||||
|
label: "Base Unit",
|
||||||
|
placeholder: "",
|
||||||
|
optional: true,
|
||||||
|
},
|
||||||
open_data_slug: {
|
open_data_slug: {
|
||||||
form_field: true,
|
form_field: true,
|
||||||
type: "text",
|
type: "text",
|
||||||
|
Loading…
Reference in New Issue
Block a user