BOM-240
Fixing python3. Hashvalues were saving with b prefix in db. Decoded them before insertion.
This commit is contained in:
@@ -20,6 +20,7 @@ import six
|
||||
from django.apps import apps
|
||||
from django.contrib.auth.models import User
|
||||
from django.db import models
|
||||
from django.utils.encoding import python_2_unicode_compatible
|
||||
from django.utils.timezone import now
|
||||
from lazy import lazy
|
||||
from model_utils.models import TimeStampedModel
|
||||
@@ -79,7 +80,7 @@ class BlockRecordList(object):
|
||||
supported by adding a label indicated which algorithm was used, e.g.,
|
||||
"sha256$j0NDRmSPa5bfid2pAcUXaxCm2Dlh3TwayItZstwyeqQ=".
|
||||
"""
|
||||
return b64encode(sha1(self.json_value.encode('utf-8')).digest())
|
||||
return b64encode(sha1(self.json_value.encode('utf-8')).digest()).decode('utf-8')
|
||||
|
||||
@lazy
|
||||
def json_value(self):
|
||||
@@ -128,6 +129,7 @@ class BlockRecordList(object):
|
||||
return cls(blocks, course_key)
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class VisibleBlocks(models.Model):
|
||||
"""
|
||||
A django model used to track the state of a set of visible blocks under a
|
||||
@@ -148,7 +150,7 @@ class VisibleBlocks(models.Model):
|
||||
class Meta(object):
|
||||
app_label = "grades"
|
||||
|
||||
def __unicode__(self):
|
||||
def __str__(self):
|
||||
"""
|
||||
String representation of this model.
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user