def test_dbstore(self): test_key = "color" test_val = "blue" DbStore.objects.create(dbkey=test_key, dbval=test_val) result = dbstore_get(test_key, None) print "\nGot ", result self.assertEqual(test_val, result)
def get_context_data(self, **kwargs): context = super(CluesView, self).get_context_data(**kwargs) cat = kwargs.get('cat') context.update({'cat': kwargs.get('cat')}) if cat: context.update({'clues': Clue.objects.filter(category=kwargs.get('cat'))}) context.update({'answer_tracking': dbstore_get('answer_tracking', False)}) return context
def get(self, request, *args, **kwargs): initial = {'clue_source_name': dbstore_get('clue_source_name', "Jeopardy Clues"), 'answer_tracking': dbstore_get('answer_tracking', True)} form = self.form_class(initial=initial) return render(request, self.template_name, {'form': form})