Ejemplo n.º 1
0
def delete(request, deck_id=None):
    """Deletes a deck."""
    d = {'user': request.user}

    collection_id = queries.getDeckCollectionId(deck_id)
    success = services.delete_deck(deck_id)
    if success:
        log.info('Deck %(d)s deleted from collection %(c)s' % {
            'd': deck_id,
            'c': collection_id
        },
                 extra=d)
    else:
        log.info('Deck %(d)s could not be deleted from collection %(c)s' % {
            'd': deck_id,
            'c': collection_id
        },
                 extra=d)

    response = redirect('collectionIndex', collection_id)
    response['Location'] += '?instructor=edit'

    analytics.track(
        actor=request.user,
        verb=analytics.VERBS.deleted,
        object=analytics.OBJECTS.deck,
        context={"deck_id": deck_id},
    )

    return response
Ejemplo n.º 2
0
def delete(request, deck_id=None):
    """Deletes a deck."""
    d = {'user': request.user}

    collection_id = queries.getDeckCollectionId(deck_id)
    success = services.delete_deck(deck_id)
    if success:
        log.info('Deck %(d)s deleted from collection %(c)s' %{'d':deck_id, 'c':collection_id}, extra=d)
    else:
        log.info('Deck %(d)s could not be deleted from collection %(c)s' %{'d':deck_id, 'c':collection_id}, extra=d)

    response =  redirect('collectionIndex', collection_id)
    response['Location'] += '?instructor=edit'

    analytics.track(
        actor=request.user,
        verb=analytics.VERBS.deleted,
        object=analytics.OBJECTS.deck,
        context={"deck_id": deck_id},
    )

    return response
Ejemplo n.º 3
0
 def test_deleteDeck(self):
     collection = self.make_collection()
     deck = Deck.objects.create(title='a', collection=collection)
     self.assertEqual(services.delete_deck(deck.id), True)
Ejemplo n.º 4
0
 def test_deleteDeck(self):
     collection = self.make_collection()
     deck = Deck.objects.create(title='a', collection=collection)
     self.assertEqual(services.delete_deck(deck.id), True)