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, Matthew Pava <[email protected]> wrote: > > 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 object manager: > class GuestManager(models.Manager): > def get_queryset(self): > return > super().get_queryset().annotate(alpha=Left('lname', 1)) > > class Guest(models.Model): > objects = GuestManager() > > F -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/1A969B54-DDDE-47D1-BD34-58AC234D2965%40gmail.com. For more options, visit https://groups.google.com/d/optout.

