Default value for hidden field in Django model
- by Daniel Garcia
I have this Model:
class Occurrence(models.Model):
id = models.AutoField(primary_key=True, null=True)
reference = models.IntegerField(null=True, editable=False)
def save(self):
self.collection = self.id
super(Occurrence, self).save()
I want for the reference field to be hidden and at the same time have the same value as id. This code works if the editable=True but if i want to hide it it doesnt change the value of reference.
how can i fix that?