[Answer]-Django model – queryset issue

1👍

class Bewertung(models.Model):
   //you don't have to put default="" because this is already required
   von_location= models.ForeignKey(Location,related_name="locations_bewertung")
   von_user = models.ForeignKey(User,related_name="users_bewertung")

   //use DecimalField instead of IntergerField
   //use max_digits not max_length because it is for string
   price_leistung = models.DecimalField(max_digits=3, decimal_place=2, default=0)
   romantic = models.DecimalField(max_digits=3, decimal_place=2, default=0)
   bewertung = models.DecimalField(max_digits=3, decimal_place=2, default=0)

   //you return your unicode with an int field which result to error 
   //so you must do it this way
   def __unicode__(self):
       return "{0}".format(self.bewertung)

Leave a comment