On Feb 1, 6:12 pm, makayabou <[email protected]> wrote:
> Hello,
> I try to simplify the problem.
>
> This model gives me a (None) result:
>
> class OperatingSystem (models.Model):
> operatingsystem = CharField (max_length=30, blank=True, null=True)
> def __unicode__(self):
> return "%s" % (self.operatingsystem)
> class Ordi(models.Model):
> architecture = CharField (max_length=30, blank=True, null=True)
> operatingsystemused = ManyToManyField(OperatingSystem, null=True,
> blank=True)
>
> def __unicode__(self):
> oses_installed =
> u','.join(self.operationsystemused_set.all().values('operatingsystem',flat=
> True))
> return ("%s" % (oses_installed)).upper()
>
> Or also the same with that last line:
>
> return models.join(list(self.operatingsystemused))
>
> What can I do??
>
> thanks
How about
self.operatingsystemused.all().values('operatingsystem',flat= True)
-ak
--
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.