I am needing to do some duct taping for a project that is going on
right now. In it I need to take a values_list of id's from a
ManyToMany field and save those values to a varchar field so a mysql
query can access the values. I am working with two different sets of
developers and this is the best we can come up with in such a short
period of time
Here is the model:
Candidate
filing_id = models.IntegerField()
name = models.CharField()
Race:
name = models.CharField()
primary_advance = models.ManyToManyField('Candidate')
primary_advnace_list = models.CahrField()
def(save, *args, **kwargs):
primary_ids = self.primary_advace.values_list('id', flat=True)
if primary_ids.count() > 0:
primary_advance_list = primary_ids
else:
primary_advance_list = []
super(Race, self).save(*args, **kwargs)
I've tried this but I'm coming back with empty values for the list
fields.
--
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.