Skip to content

Commit

Permalink
Fix: remplacer declared_substance.name par declared_substance.substan…
Browse files Browse the repository at this point in the history
…ce.name
  • Loading branch information
qloridant committed Dec 1, 2024
1 parent a054fb2 commit 7af92c9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions api/serializers/declaration.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,12 @@ def get_declared_plants(self, obj):
"quantité_par_djr": declared_plant.quantity,
"unite": declared_plant.unit.name,
}
if declared_plant.unit
else {}
for declared_plant in obj.declared_plants.filter(active=True)
]

def get_declared_ingredients(self, obj):
def get_declared_microorganisms(self, obj):
return [
{
"genre": declared_microorganism.microorganism.genus,
Expand All @@ -386,11 +388,11 @@ def get_declared_ingredients(self, obj):
def get_declared_substances(self, obj):
return [
{
"nom": declared_substance.name,
"nom": declared_substance.substance.name,
"quantité_par_djr": declared_substance.quantity,
"unite": declared_substance.unit.name,
}
if declared_substance.name and declared_substance.quantity and declared_substance.unit
if declared_substance.substance.name and declared_substance.quantity and declared_substance.unit
else {}
for declared_substance in obj.declared_substances.all()
]
Expand Down

0 comments on commit 7af92c9

Please sign in to comment.