Django insert Datagram error

the code is as follows

clipboard.png

the database is created as follows


class HyperParameters(models.Model):
    graph = models.ForeignKey(Graph)
    train_times = models.PositiveIntegerField(default=10)
    save = models.BooleanField(default=True)
    learning_rate = models.FloatField(default=0.01)

    def __str__(self):
        return "{id}: {graph} {train_times} {save} {learning_rate}".format(id=self.id,
                                                                   graph=self.graph,
                                                                   train_times=self.train_times,
                                                                   save=self.save,
                                                                   learning_rate=self.learning_rate
                                                                   )

Why should I create data and always report errors in the diagram, such as

HyperParameters.objects.create(learning_rate=0.02)
What does

always mean that BOOL object cannot be called?


you define a field called save, which overrides the default method of the framework.
this is the default save method of django.db.model.Model.
you define a Bool value for him, so call HyperParameters.save () in the framework and boolean is not callable this error.

  

the original answer is wrong. Downstairs positive solution

Menu