2👍
✅
Define __unicode__
method in Instrumentation
model for human-readable representation of the model object:
class Instrumentation(models.Model):
code = models.CharField(max_length=70, unique=True)
marca = models.CharField(max_length=70)
modelo = models.CharField(max_length=70)
familia = models.CharField(max_length=150)
subfamilia = models.CharField(max_length=150)
calibration_date = models.DateField()
#test = models.ForeignKey(Test)
notes = models.TextField(max_length=170, blank=True)
utilization = models.DateField(blank=True)
def is_free(self):
return (self.utilization == None)
def is_calibrated(self):
return (self.calibration_date > date.today())
def __unicode__(self):
return self.code # or self.marca what ever you want
Source:stackexchange.com