Models
In this application, we need to store the data related to each movie and the movies' ratings from each user of the website. We set up three models:
class UserProfile(models.Model): user = models.ForeignKey(User, unique=True) array = jsonfield.JSONField() arrayratedmoviesindxs = jsonfield.JSONField() lastrecs = jsonfield.JSONField() def __unicode__(self): return self.user.username def save(self, *args, **kwargs): create = kwargs.pop('create', None) recsvec = kwargs.pop('recsvec', None) print 'create:',create if create==True: super(UserProfile, self).save(*args, **kwargs) elif recsvec!=None: self.lastrecs = json.dumps(recsvec.tolist()) super(UserProfile, self).save(*args, **kwargs) else: nmovies = MovieData.objects.count() array = np.zeros(nmovies) ratedmovies = self.ratedmovies.all() self.arrayratedmoviesindxs = json...