from django.contrib.auth.models import Group
from django.db import models

from jsonfield import JSONField


class KeyValue(models.Model):
    group = models.ForeignKey(Group, on_delete=models.CASCADE)
    key = models.CharField(max_length=64, db_index=True)
    value = JSONField()

    def __unicode__(self):
        return u'KV(%s, %s, %r)' % (self.group.name, self.key, self.value)

from django.contrib.auth.models import Group
from django.db import models

from jsonfield import JSONField


class KeyValue(models.Model):
    group = models.ForeignKey(Group, on_delete=models.CASCADE)
    key = models.CharField(max_length=64, db_index=True)
    value = JSONField()

    def __unicode__(self):
        return u'KV(%s, %s, %r)' % (self.group.name, self.key, self.value)

    def __str__(self):
        return 'KV(%s, %s, %r)' % (self.group.name, self.key, self.value)

Add KeyValue.__str__ for python 3
Add KeyValue.__str__ for python 3

  from django.contrib.auth.models import Group
  from django.db import models
  
  from jsonfield import JSONField
  
  
  class KeyValue(models.Model):
      group = models.ForeignKey(Group, on_delete=models.CASCADE)
      key = models.CharField(max_length=64, db_index=True)
      value = JSONField()
  
      def __unicode__(self):
          return u'KV(%s, %s, %r)' % (self.group.name, self.key, self.value)
  
+     def __str__(self):
+         return 'KV(%s, %s, %r)' % (self.group.name, self.key, self.value)
+ 
Add KeyValue.__str__ for python 3
## Code Before:
from django.contrib.auth.models import Group
from django.db import models

from jsonfield import JSONField


class KeyValue(models.Model):
    group = models.ForeignKey(Group, on_delete=models.CASCADE)
    key = models.CharField(max_length=64, db_index=True)
    value = JSONField()

    def __unicode__(self):
        return u'KV(%s, %s, %r)' % (self.group.name, self.key, self.value)

## Instruction:
Add KeyValue.__str__ for python 3
## Code After:
from django.contrib.auth.models import Group
from django.db import models

from jsonfield import JSONField


class KeyValue(models.Model):
    group = models.ForeignKey(Group, on_delete=models.CASCADE)
    key = models.CharField(max_length=64, db_index=True)
    value = JSONField()

    def __unicode__(self):
        return u'KV(%s, %s, %r)' % (self.group.name, self.key, self.value)

    def __str__(self):
        return 'KV(%s, %s, %r)' % (self.group.name, self.key, self.value)
