예제 #1
0
def create_game(request):
    data = request.POST.dict()
    new_game = Game(status=data['status'],
                    court_id=data['court_id'],
                    court_name=data['court_name'],
                    date=data['date'],
                    time=data['time'],
                    created_by_user_id=data['created_by_user_id'],
                    created_by_user_name=data['created_by_user_name'],
                    game_type=data['game_type'])
    new_game.save()
    return JsonResponse({
        'status': 'success',
        'game': model_to_dict(new_game)
    },
                        status=201)
예제 #2
0
    def response_add(self, request, obj, *args, **kwargs):
        response = super(GameAdmin, self).response_add(request, obj, *args, **kwargs)

        Game.delete_non_related_images()

        return response
예제 #3
0
    def response_change(self, request, obj):
        response = super(GameAdmin, self).response_change(request, obj)

        Game.delete_non_related_images()

        return response