Re: How to properly use MySQL Generated Fields in Django

2019-04-15 Thread Rob Schneider
Thanks! I’ll give this a try. I did have “alpha” as a function in the model, but found I could not easily include that in queries as easily as a field in the db. so into the db it went. I’ll try this, and see if I can get the data out as wanted. thanks! —rms > On 15 Apr 2019, at 17:08, Matth

RE: How to properly use MySQL Generated Fields in Django

2019-04-15 Thread Matthew Pava
I wouldn’t save alpha in the database. I would use a property on the model or annotate the field to the object manager. Property: class Guest(models.Model): @property def alpha(self): return self.lname[0] if self.lname else '' Or on the