Django object has no attribute in a _set.filter

when I make .all then everything works fine when I try to filter for a single value I get AtributeError what am I missing ?

   @property
    def mathe2(self):
        return self.lehrertabelle_set.filter(Stundenanteil_bei_WE = self.Stundenanteil_bei_WE) + self.SON_Gesamt_Gesamt




the models





class LehrerTabelle(models.Model):
   Benutzer = models.ForeignKey(User, on_delete=models.SET_NULL, null=True)
    Konto_FK = models.ForeignKey('SchulverzeichnisTabelle', on_delete=models.SET_NULL, null=True)
    Leitung_der_Klasse = models.CharField(max_length=100, choices=Leitung_Klasse, null=True, blank=True)
    Funktion = models.CharField(max_length=100, choices=Funktion_DD, null=True, blank=True)
    Nname = models.CharField(max_length=150, null=True, blank=True)
    Vname = models.CharField(max_length=150, null=True, blank=True)
    Einstellungsstatus = models.CharField(max_length=100, choices=Einstellungsstatus_DD, null=True, blank=True)
    Pflichtstunden_normal = models.IntegerField(null=True, blank=True)
    Status_normal = models.CharField(max_length=150, choices=N_Kuerzel_DD, null=True, blank=True)
    durch_Ersatzmassnahme_besetzte_WST = models.CharField(max_length=20, null=True, blank=True)
    Teilzeit_in_EZ = models.IntegerField(null=True, blank=True)
    Stundenanteil_bei_WE = models.IntegerField(null=True, blank=True)

need to shorten this bc its to much, the other model is also just an integer with a property

 @property
    def SON_Gesamt_Gesamt(self):
        return self.SON_Gesamt_Summe_1 + self.SON_Gesamt_Summe_2 + self.SON_Gesamt_Summe_3 + self.SON_Gesamt_Summe_4

Back to Top