Пример #1
0
 def handle(self, *args, **options):
     ConceptDefinition.objects.all().delete()
     ConceptReference.objects.all().delete()
     ItemDependency.objects.all().delete()
     ItemEquation.objects.all().delete()
     for item in MathItem.objects.all():
         self.stdout.write('{}\n'.format(item.get_name()))
         create_item_meta_data(item)
     self.stdout.write(self.style.SUCCESS('Done'))
Пример #2
0
def publish(user, item_type, parent, document, eqns, concepts):
    eqn_conversions = freeze_equations(eqns)
    concept_conversions = save_concepts(concepts)
    document = convert_document(document, eqn_conversions, concept_conversions)
    item = MathItem(created_by=user, item_type=item_type, body=json.dumps(document))
    if parent:
        item.parent = parent
    item.save()
    create_item_meta_data(item)
    return item
Пример #3
0
    def handle(self, *args, **options):
        self.stdout.write('Cleaning meta tables')
        ConceptDefinition.objects.all().delete()
        ConceptReference.objects.all().delete()
        ItemDependency.objects.all().delete()
        ItemMediaDependency.objects.all().delete()
        ItemEquation.objects.all().delete()

        self.stdout.write('Looping through math items')
        self.stdout.ending = ''
        for item in MathItem.objects.all():
            self.stdout.write('{} '.format(item.get_name()))
            create_item_meta_data(item)
        self.stdout.ending = '\n'

        self.stdout.write('\nLooping through concepts')
        for concept in Concept.objects.all():
            create_concept_meta(concept.id)

        self.stdout.write(self.style.SUCCESS('Done'))