def load_clues(infile, limit=10000): with open(infile) as json_file: json_data = json.load(json_file) for i, clue_data in enumerate(json_data): clue = Clue(**clue_data) clue.save() if i > limit: break print "Clue count: {:,}".format(Clue.objects.count())
def get_context_data(self, **kwargs): context = super(HomeView, self).get_context_data(**kwargs) context.update({'cats': Clue.get_random_cats(20)}) return context