', '.join(primary_ids) The fact that you're doing this with foreign keys, though, suggests to me that you may have a database normalization problem.
On Jul 27, 3:26 pm, Nick <[email protected]> wrote: > I am getting this to save but I can't get it to output properly > > it's outputting as [16L, 451L, 521L] for a list of id's, which it > should according to documentation. However, how can I output it like > this 16, 451, 521 > > On Jul 27, 12:11 pm, Nick <[email protected]> wrote: > > > 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.

