def create_vocabularies(self, course, taxonomy):
     for name, terms in taxonomy.items():
         concept = Vocabulary(display_name=name, course=course)
         concept.save()
         for term_name in terms:
             term = Term(display_name=term_name, vocabulary=concept)
             term.save()
Beispiel #2
0
 def create_vocabularies(self, course, taxonomy):
     for name, terms in taxonomy.items():
         concept = Vocabulary(display_name=name, course=course)
         concept.save()
         for term_name in terms:
             term = Term(display_name=term_name, vocabulary=concept)
             term.save()
Beispiel #3
0
    def create_vocabularies(self, course, taxonomy):
        course_type = ContentType.objects.get_for_model(course)

        for name, terms in taxonomy.items():
            concept = Vocabulary(display_name=name,
                                 content_type=course_type,
                                 object_id=course.id)
            concept.save()
            for term_name in terms:
                term = Term(display_name=term_name, vocabulary=concept)
                term.save()
Beispiel #4
0
    def create_vocabularies(self, course, taxonomy):
        course_type = ContentType.objects.get_for_model(course)

        for name, terms in taxonomy.items():
            concept = Vocabulary(display_name=name,
                                 content_type=course_type,
                                 object_id=course.id)
            concept.save()
            for term_name in terms:
                term = Term(display_name=term_name,
                            vocabulary=concept)
                term.save()
Beispiel #5
0
    def setUp(self):
        # Every test needs access to the request factory.
        self.factory = RequestFactory()

        course = Course.objects.get(id=1)
        course_type = ContentType.objects.get_for_model(course)

        taxonomy = {
            'Shapes': ['Square', 'Triangle', 'Circle'],
            'Colors': ['Red', 'Blue', 'Green']
        }

        for name, terms in taxonomy.items():
            concept = Vocabulary(display_name=name,
                                 content_type=course_type,
                                 object_id=course.id)
            concept.save()
            for term_name in terms:
                term = Term(display_name=term_name, vocabulary=concept)
                term.save()
Beispiel #6
0
    def setUp(self):
        # Every test needs access to the request factory.
        self.factory = RequestFactory()

        course = Course.objects.get(id=1)
        course_type = ContentType.objects.get_for_model(course)

        taxonomy = {
            'Shapes': ['Square', 'Triangle', 'Circle'],
            'Colors': ['Red', 'Blue', 'Green']
        }

        for name, terms in taxonomy.items():
            concept = Vocabulary(display_name=name,
                                 content_type=course_type,
                                 object_id=course.id)
            concept.save()
            for term_name in terms:
                term = Term(display_name=term_name,
                            vocabulary=concept)
                term.save()