How can I set a django field that gets data from a function depending on other fields? Let me explain using the following example.
class Test(models.Model):
def testType(self):
return str(self.__class__.__name__)
sources = models.CharField(default= testType, max_length=50, null=True, blank=True)
In this case, if I go to django front-end interface and hit "add Test", I can see a box for 'sources' to fill out. This is not the way I wanted. I want: 1. a field named 'sources' in the back-end MySQL database, 2. No box for 'sources' to fill out in the "add Test" form, and 3. The 'sources' field will get data as soon as I add a new record.
Any suggestion that can help me to solve this issue would be appreciated.