hello django users , I am trying to update a class using signals , you will understand once you see the code below
class mail_item_count(models.Model): country = models.CharField(max_length=100) count = models.IntegerField(default=1) def __str__(self): return '{}, {}'.format(self.country,self.count) def sum(self): a = sum(instance.count for instance in self.objects.all()) return a @receiver(post_save, sender=mail_item) def update_count(sender, instance, created, **kwargs): count_object,_ = mail_item_count.objects.get_or_create(country=instance.Pays_origine) count_object.count = count_object.count + 1 count_object.save() but I am getting this error : *" Tried to update field dashboard.mail_item_count.country with a model instance, <Pays: Maroc >. Use a value compatible with CharField. "* can you help me out solving it -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a1f70a09-51f6-426a-a8b4-868f05923438%40googlegroups.com.