Open sanderboer opened 1 year ago
NB: Right now I copy the multiselectfield into a _str duplicate using the "save" method and I ignore the ages_allowed field in Graphql and read ages_allowed_str instead.
` class Question(models.Model): title = models.CharField(max_length=256) ages_allowed = MultiSelectField( choices=AGES, null=False, default=0, max_length=get_max_length(AGES, None), ) ages_allowed_str = models.CharField(max_length=256, blank=True) info = models.TextField() image = models.ImageField(upload_to=photo_path, blank=True) published_at = models.DateTimeField(default=timezone.now) author = models.ForeignKey(User, on_delete=models.CASCADE) type = models.CharField( max_length=64, choices=ANSWERTYPE, default="boolean", )
def save(self, *args, **kwargs):
self.ages_allowed_str = ",".join(self.ages_allowed)
super().save(*args, **kwargs)
def __str__(self):
return self.title
def __unicode__(self):
return self.__str__()
`
Can you please recheck with https://github.com/goinnn/django-multiselectfield/pull/135 ?
Not sure but this might fix your issue. If not, it'll be probably way easier to fix than before.
I have made a model that uses a MultiSelectField. When I create a schema.py to query all entries of that model, it fails with the error: "unhashable type: 'MSFList'"
Is there a way to remedy this ?
thank you.