Hello all,
Is there a way to check whether a field contains a certain value in a
ManyToManyField in the admin on a custom save method? For example, I
have a model like:
class LastName(models.Model):
lastname = models.CharField(...)
class Person(models.Model):
firstname = models.CharField(...)
lastname = models.ManyToManyField(LastName,...)
jumbledname = models.CharField(..., editable = False)
def save(self):
if self.lastname CONTAINS? 'Smith':
self.jumbledname = u'%s%s' % ('self.firstname,
self.lastname')
else:
self.jumbledname = self.firstname
super(Person,self).save()
Thanks,
-bkev
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---