Self hosted FLOSS fitness/workout, nutrition and weight tracker
Compare ingredients only based on nutritional values
Roland Geider4f6f759a30a7
diff --git a/wger/nutrition/models/ingredient.py b/wger/nutrition/models/ingredient.pyindex 766677b93..386e7c5a1 100644--- a/wger/nutrition/models/ingredient.py+++ b/wger/nutrition/models/ingredient.py@@ -324,10 +324,21 @@ class Ingredient(AbstractSubmissionModel, AbstractLicenseModel, models.Model):logger.debug('Overwritten behaviour: comparing ingredients on values, not PK.')equal = Trueif isinstance(other, self.__class__):- for i in self._meta.fields:+ for i in (+ 'carbohydrates',+ 'carbohydrates_sugar',+ 'creation_date',+ 'energy',+ 'fat',+ 'fat_saturated',+ 'fibres',+ 'name',+ 'protein',+ 'sodium',+ ):if (- hasattr(self, i.name) and hasattr(other, i.name)- and (getattr(self, i.name, None) != getattr(other, i.name, None))+ hasattr(self, i) and hasattr(other, i)+ and (getattr(self, i, None) != getattr(other, i, None))):equal = Falseelse: