Пример #1
0
    def test_get_device_items(self):
        self.assertCountEqual(
            self.rebate.get_device_items(self.rebate.rebated_items), [])
        self.assertCountEqual(
            self.rebate.get_device_items(self.rebate.eligible_items), [])

        item_1 = ItemFactory(device=DeviceFactory(client=self.rebate.client,
                                                  product=self.product_1),
                             purchased_date=date(2018, 7, 16),
                             is_used=False,
                             purchase_type=BULK_PURCHASE)
        item_2 = ItemFactory(device=DeviceFactory(client=self.rebate.client,
                                                  product=self.product_2),
                             purchased_date=date(2018, 7, 31),
                             is_used=True,
                             purchase_type=BULK_PURCHASE)
        ItemFactory(device=DeviceFactory(client=self.rebate.client,
                                         product=ProductFactory()),
                    purchased_date=date(2018, 7, 16),
                    is_used=False,
                    purchase_type=CONSIGNMENT_PURCHASE)
        ItemFactory(device=item_2.device,
                    purchased_date=date(2017, 12, 31),
                    is_used=False,
                    purchase_type=CONSIGNMENT_PURCHASE)

        self.assertCountEqual(
            self.rebate.get_device_items(self.rebate.eligible_items), [item_1])
        self.assertCountEqual(
            self.rebate.get_device_items(self.rebate.rebated_items),
            [item_1, item_2])
        self.assertCountEqual(
            self.rebate.get_device_items(RebatableItem.objects.none()),
            [item_1, item_2])
Пример #2
0
    def setUp(self):
        super().setUp()
        self.client_1 = ClientFactory()
        self.today = datetime.utcnow().date()
        self.path = reverse('api:hospital:tracker:saving_by_date',
                            args=(self.client_1.id, '2017-08'))
        physician = AccountFactory(
            user=self.user,
            client=self.client_1,
            role=RoleFactory(priority=RolePriority.PHYSICIAN.value))
        device_1 = DeviceFactory(client=self.client_1)
        self.item_1, self.item_2 = ItemFactory.create_batch(2,
                                                            device=device_1,
                                                            saving=200,
                                                            cost=1000)
        RepCaseFactory(client=self.client_1,
                       physician=physician,
                       items=[self.item_1, self.item_2],
                       procedure_date=date(2017, 8, 1))
        device_2 = DeviceFactory(client=self.client_1)
        self.item_3 = ItemFactory(device=device_2, saving=150, cost=1000)
        RepCaseFactory(client=self.client_1,
                       physician=physician,
                       items=[self.item_3],
                       procedure_date=date(2017, 7, 5))

        self.item_4 = ItemFactory(device=device_2, saving=200, cost=900)
        RepCaseFactory(client=self.client_1,
                       items=[self.item_4],
                       procedure_date=date(2015, 1, 1))
Пример #3
0
 def setUp(self):
     self.client_1, self.client_2 = ClientFactory.create_batch(2)
     manufacturer = ManufacturerFactory(image=ImageField(
         filename='biotronik.jpg'))
     product = ProductFactory(manufacturer=manufacturer)
     self.item_1 = ItemFactory(cost=randint(110, 150),
                               cost_type=UNIT_COST,
                               device=DeviceFactory(client=self.client_1,
                                                    product=product))
     self.item_2 = ItemFactory(cost=randint(210, 290),
                               cost_type=UNIT_COST,
                               device=DeviceFactory(client=self.client_1))
     self.item_3 = ItemFactory(cost=randint(400, 500),
                               device=DeviceFactory(client=self.client_2))
     self.item_4 = ItemFactory(cost=1000,
                               cost_type=UNIT_COST,
                               device=DeviceFactory(
                                   client=self.client_1,
                                   product=ProductFactory(
                                       manufacturer=manufacturer,
                                       category=product.category)))
     physician_role = RoleFactory(priority=RolePriority.PHYSICIAN.value)
     self.physician_1 = AccountFactory(client=self.client_1,
                                       role=physician_role)
     self.physician_2 = AccountFactory(client=self.client_2,
                                       role=physician_role,
                                       user=self.physician_1.user)
     self.physician_3 = AccountFactory(client=self.client_1,
                                       role=physician_role)
Пример #4
0
    def test_physician_app(self):
        item_3 = ItemFactory(device=DeviceFactory(client=self.client_1),
                             cost=randint(350, 370))
        item_5 = ItemFactory(device=DeviceFactory(client=self.client_1),
                             cost=randint(100, 200))
        RepCaseFactory(client=self.client_1,
                       physician=self.physician_1,
                       items=[self.item_1, self.item_2])
        RepCaseFactory(client=self.client_1,
                       physician=self.physician_3,
                       items=[item_3])
        RepCaseFactory(client=self.client_1,
                       physician=self.physician_3,
                       items=[item_5])

        self.assertCountEqual(
            self.client_1.items,
            [self.item_1, self.item_2, item_3, self.item_4, item_5])
        self.assertCountEqual(
            self.client_1.items.physician_app(),
            [{
                'app': float((self.item_1.cost + self.item_2.cost) / 2),
                'physician_id': self.physician_1.id,
                'physician_name': self.physician_1.user.name,
            }, {
                'app': float((item_3.cost + item_5.cost) / 2),
                'physician_id': self.physician_3.id,
                'physician_name': self.physician_3.user.name,
            }, {
                'app': float(self.item_4.cost),
                'physician_id': None,
                'physician_name': None,
            }])
Пример #5
0
    def test_return_marketshare_with_procedure_date(self):
        device = DeviceFactory(client=self.client_1, product=ProductFactory(manufacturer=self.manufacturer_1))
        device_2 = DeviceFactory(client=self.client_1, product=ProductFactory(manufacturer=self.manufacturer_2))
        item_1, item_2 = ItemFactory.create_batch(2, device=device)
        item_3, item_4 = ItemFactory.create_batch(2, device=device_2)
        RepCaseFactory(client=self.client_1, physician=self.physician, items=[item_1, item_3],
                       procedure_date=date(2018, 5, 1))
        RepCaseFactory(client=self.client_1, physician=self.physician, items=[item_2, item_4],
                       procedure_date=date(2018, 4, 30))

        path = reverse('api:hospital:device:marketshare_by_date', args=(self.client_1.id, '2018-5'))
        response = self.authorized_client.get(path)
        self.assertEqual(response.status_code, status.HTTP_200_OK)
        self.assertCountEqual(response.data, [
            {
                'name': 'May, 2018',
                'marketshare': [{
                    'spend': f'{item_1.cost:.2f}', 'units': 1,
                    'name': self.manufacturer_1.display_name, 'id': self.manufacturer_1.id,
                }, {
                    'spend': f'{item_3.cost:.2f}', 'units': 1,
                    'name': self.manufacturer_2.display_name, 'id': self.manufacturer_2.id,
                }],
            }, {
                'name': f'2018 to Date',
                'marketshare': [{
                    'spend': f'{(item_1.cost + item_2.cost):.2f}', 'units': 2,
                    'name': self.manufacturer_1.display_name, 'id': self.manufacturer_1.id,
                }, {
                    'spend': f'{(item_3.cost + item_4.cost):.2f}', 'units': 2,
                    'name': self.manufacturer_2.display_name, 'id': self.manufacturer_2.id,
                }],
            }
        ])

        path = reverse('api:hospital:device:marketshare_by_date', args=(self.client_1.id, '2018-04'))
        response = self.authorized_client.get(path)
        self.assertEqual(response.status_code, status.HTTP_200_OK)
        self.assertCountEqual(response.data, [
            {
                'name': 'April, 2018',
                'marketshare': [{
                    'spend': f'{item_2.cost:.2f}', 'units': 1,
                    'name': self.manufacturer_1.display_name, 'id': self.manufacturer_1.id,
                }, {
                    'spend': f'{item_4.cost:.2f}', 'units': 1,
                    'name': self.manufacturer_2.display_name, 'id': self.manufacturer_2.id,
                }],
            }, {
                'name': f'2018 to Date',
                'marketshare': [{
                    'spend': f'{(item_1.cost + item_2.cost):.2f}', 'units': 2,
                    'name': self.manufacturer_1.display_name, 'id': self.manufacturer_1.id,
                }, {
                    'spend': f'{(item_3.cost + item_4.cost):.2f}', 'units': 2,
                    'name': self.manufacturer_2.display_name, 'id': self.manufacturer_2.id,
                }],
            }
        ])
Пример #6
0
    def test_devices_by_specialties(self):
        specialty1, specialty2 = SpecialtyFactory.create_batch(2)
        category1 = CategoryFactory(specialty=specialty1)
        category2, category3 = CategoryFactory.create_batch(2, specialty=specialty2)
        product1 = DeviceFactory(client=self.client, product=ProductFactory(name='Device1', category=category1)).product
        product2 = DeviceFactory(client=self.client, product=ProductFactory(name='Device2', category=category2)).product
        product3 = DeviceFactory(client=self.client, product=ProductFactory(name='Device3', category=category3)).product

        self.assertDictEqual(self.client.devices_by_specialties(), {
            specialty1.id: {'name': specialty1.name, 'products': [(product1.id, product1.name)]},
            specialty2.id: {'name': specialty2.name, 'products': [(product2.id, product2.name),
                                                                  (product3.id, product3.name)]}
        })
Пример #7
0
 def setUp(self):
     super().setUp()
     self.client_1 = ClientFactory()
     self.product = ProductFactory()
     self.path = reverse('api:hospital:device:items', args=(self.client_1.id, self.product.id))
     AccountFactory(client=self.client_1, user=self.user)
     ItemFactory.create_batch(2, device=DeviceFactory(product=self.product))
     ItemFactory(device=DeviceFactory(client=self.client_1))
     device = DeviceFactory(client=self.client_1, product=self.product)
     self.item_1, self.item_2 = ItemFactory.create_batch(2, device=device, is_used=False,
                                                         purchase_type=BULK_PURCHASE)
     ItemFactory(device=device, purchase_type=CONSIGNMENT_PURCHASE, is_used=False)
     ItemFactory(device=device, purchase_type=BULK_PURCHASE, is_used=True)
Пример #8
0
 def _create_product_for_client(self, product, category, specialty, client):
     DeviceFactory(
         client=client,
         product=ProductFactory(
             name=product,
             category=CategoryFactory(name=category, specialty=specialty)
         ))
Пример #9
0
    def test_class_method_update_purchase_price(self):
        def update_client_purchase_price():
            PurchasePrice.update(category=self.purchase_price.category,
                                 client=self.purchase_price.client,
                                 year=self.purchase_price.year,
                                 level=self.purchase_price.level,
                                 cost_type=self.purchase_price.cost_type)
            self.purchase_price.refresh_from_db()

        self.assertEqual(self.purchase_price.avg, Decimal(1000))
        self.assertIsNone(self.purchase_price.min)
        self.assertEqual(self.purchase_price.max, 0)

        update_client_purchase_price()
        self.assertEqual(self.purchase_price.avg, Decimal(0))
        self.assertIsNone(self.purchase_price.min)
        self.assertEqual(self.purchase_price.max, 0)

        item = ItemFactory(cost_type=self.purchase_price.cost_type, is_used=True,
                           device=DeviceFactory(client=self.purchase_price.client,
                                                product=ProductFactory(category=self.purchase_price.category,
                                                                       level=self.purchase_price.level)))
        rep_case = RepCaseFactory(procedure_date=date(2017, 12, 31), items=[item])
        update_client_purchase_price()
        self.assertEqual(self.purchase_price.avg, Decimal(0))
        self.assertIsNone(self.purchase_price.min)
        self.assertEqual(self.purchase_price.max, 0)

        rep_case.procedure_date = date(2018, 1, 1)
        rep_case.save()
        update_client_purchase_price()
        self.assertEqual(self.purchase_price.avg, item.cost)
        self.assertEqual(self.purchase_price.min, item.cost)
        self.assertEqual(self.purchase_price.max, item.cost)
Пример #10
0
    def test_return_marketshare_without_specify_procedure_date(self):
        device = DeviceFactory(client=self.client_1, product=ProductFactory(manufacturer=self.manufacturer_1))
        item_1, item_2 = ItemFactory.create_batch(2, device=device)
        RepCaseFactory(client=self.client_1, physician=self.physician, items=[item_1, item_2],
                       procedure_date=self.today)

        response = self.authorized_client.get(self.path)
        self.assertEqual(response.status_code, status.HTTP_200_OK)
        self.assertCountEqual(response.data, [
            {
                'name': f'{month_name[self.today.month]}, {self.today.year}',
                'marketshare': [
                    {
                        'spend': f'{(item_1.cost + item_2.cost):.2f}',
                        'units': 2,
                        'name': self.manufacturer_1.display_name,
                        'id': self.manufacturer_1.id,
                    },
                ],
            }, {
                'name': f'{self.today.year} to Date',
                'marketshare': [
                    {
                        'spend': f'{(item_1.cost + item_2.cost):.2f}',
                        'units': 2,
                        'name': self.manufacturer_1.display_name,
                        'id': self.manufacturer_1.id,
                    },
                ],
            }
        ])
Пример #11
0
 def setUp(self):
     super().setUp()
     self.log_in_master_admin()
     self.specialty = SpecialtyFactory(name='Cardiac Rhythm Management')
     self.client = ClientFactory()
     category = CategoryFactory(specialty=self.specialty)
     product = ProductFactory(category=category)
     DeviceFactory(client=self.client)
     ClientPriceFactory(client=self.client, product=product)
Пример #12
0
    def test_get_method_requires_purchase_price_aggregation(self):
        path = reverse('api:hospital:tracker:app:purchase_price',
                       args=(self.client_1.id, self.category.id, 'advanced',
                             'unit_cost'))
        response = self.authorized_client.get(path)
        self.assertEqual(response.status_code, status.HTTP_200_OK)
        self.assertCountEqual(response.data, {'min': None, 'max': 0, 'avg': 0})

        path = reverse('api:hospital:tracker:app:purchase_price',
                       args=(self.client_1.id, self.category.id, 'entry',
                             'system_cost'))
        response = self.authorized_client.get(path)
        self.assertEqual(response.status_code, status.HTTP_200_OK)
        self.assertCountEqual(response.data, {'min': None, 'max': 0, 'avg': 0})

        entry = ProductLevel.ENTRY.value
        item_1 = ItemFactory(cost_type=SYSTEM_COST,
                             cost=100,
                             is_used=True,
                             device=DeviceFactory(client=self.client_1,
                                                  product=ProductFactory(
                                                      category=self.category,
                                                      level=entry)))
        item_2 = ItemFactory(cost_type=SYSTEM_COST,
                             cost=203,
                             is_used=True,
                             device=DeviceFactory(client=self.client_1,
                                                  product=ProductFactory(
                                                      category=self.category,
                                                      level=entry)))
        item_3 = ItemFactory(device=DeviceFactory(client=self.client_1),
                             cost_type=UNIT_COST,
                             cost=100,
                             is_used=True)
        RepCaseFactory(procedure_date=datetime.utcnow().date(),
                       items=[item_1, item_2])
        RepCaseFactory(procedure_date=datetime.utcnow().date(), items=[item_3])
        response = self.authorized_client.get(path)
        self.assertEqual(response.status_code, status.HTTP_200_OK)
        self.assertCountEqual(response.data, {
            'min': '100.00',
            'max': '200.00',
            'avg': '151.50'
        })
Пример #13
0
    def setUp(self):
        product = ProductFactory()
        manufacturer = product.manufacturer
        client = ClientFactory()
        device = DeviceFactory(client=client, product=product)
        item_1 = ItemFactory(device=device,
                             cost=100,
                             purchased_date=date(2018, 4, 1),
                             is_used=False)
        item_2 = ItemFactory(device=device,
                             cost=120,
                             purchased_date=date(2018, 4, 1),
                             is_used=True)
        item_3 = ItemFactory(device=DeviceFactory(
            client=client, product=ProductFactory(manufacturer=manufacturer)),
                             cost=500,
                             purchased_date=date(2018, 12, 24),
                             is_used=False)
        ItemFactory(device=device,
                    cost=100,
                    purchased_date=date(2017, 12, 23),
                    is_used=True)

        self.rebate = RebateFactory(client=client,
                                    manufacturer=manufacturer,
                                    start_date=date(2018, 1, 1),
                                    end_date=date(2018, 12, 31))
        self.tier = TierFactory(upper_bound=30,
                                tier_type=MARKETSHARE,
                                rebate=self.rebate)
        RebatableItemFactory(rebate=self.rebate,
                             item_type=REBATED_ITEM,
                             content_object=product)

        self.eligible_purchased_items = self.rebate.get_device_items(
            self.rebate.eligible_items)
        self.assertCountEqual(self.eligible_purchased_items,
                              [item_1, item_2, item_3])

        self.rebated_purchased_items = self.rebate.get_device_items(
            self.rebate.rebated_items)
        self.assertCountEqual(self.rebated_purchased_items, [item_1, item_2])
Пример #14
0
    def test_update_prices(self):
        product = ProductFactory(level=self.purchase_price.level,
                                 category=self.purchase_price.category)
        device = DeviceFactory(client=self.purchase_price.client, product=product)
        item_1, item_2 = ItemFactory.create_batch(2, device=device, is_used=True, cost_type=UNIT_COST, cost=100)
        item_3, item_4 = ItemFactory.create_batch(2, device=device, is_used=True, cost_type=UNIT_COST, cost=400)
        RepCaseFactory(procedure_date=date(2018, 1, 2), items=[item_1, item_2])
        RepCaseFactory(procedure_date=date(2018, 12, 11), items=[item_3])

        self.purchase_price.update_prices()
        self.assertEqual(self.purchase_price.min, item_1.cost)
        self.assertEqual(self.purchase_price.max, item_3.cost)
        self.assertEqual(self.purchase_price.avg, (item_1.cost + item_2.cost + item_3.cost) / 3)
Пример #15
0
 def test_session_authorized_staff_user(self):
     DeviceFactory.create_batch(3)
     device_1, device_2 = DeviceFactory.create_batch(2, client=self.hospital)
     response = self.authorized_admin_client.get(self.path)
     self.assertEqual(response.status_code, status.HTTP_200_OK)
     self.assertCountEqual(response.data, [
         {
             'id': device_1.id,
             'name': device_1.product.name,
             'category': device_1.product.category.name,
             'specialty': device_1.product.category.specialty.name,
             'manufacturer': device_1.product.manufacturer.display_name,
             'product': device_1.product.id,
         },
         {
             'id': device_2.id,
             'name': device_2.product.name,
             'category': device_2.product.category.name,
             'specialty': device_2.product.category.specialty.name,
             'manufacturer': device_2.product.manufacturer.display_name,
             'product': device_2.product.id,
         },
     ])
 def setUp(self):
     super().setUp()
     self.log_in_master_admin()
     self.client = ClientFactory()
     self.item_1, self.item_2 = ItemFactory.create_batch(
         2,
         device=DeviceFactory(client=self.client),
         is_used=False,
         purchase_type=BULK_PURCHASE)
     ItemFactory(device=self.item_1.device,
                 is_used=True,
                 purchase_type=BULK_PURCHASE)
     ItemFactory(device=self.item_2.device,
                 is_used=True,
                 purchase_type=CONSIGNMENT_PURCHASE)
Пример #17
0
 def setUp(self):
     super().setUp()
     self.client_1 = ClientFactory()
     physician = AccountFactory(
         client=self.client_1,
         user=self.user,
         role=RoleFactory(priority=RolePriority.PHYSICIAN.value))
     self.category_1, self.category_2, self.category_3 = CategoryFactory.create_batch(
         3)
     device_1 = DeviceFactory(
         client=self.client_1,
         product=ProductFactory(category=self.category_1))
     device_2 = DeviceFactory(
         client=self.client_1,
         product=ProductFactory(category=self.category_2))
     device_3 = DeviceFactory(
         client=self.client_1,
         product=ProductFactory(category=self.category_3))
     rep_case = RepCaseFactory(client=self.client_1, physician=physician)
     ItemFactory(device=device_1, rep_case=rep_case, is_used=True)
     ItemFactory(device=device_2, rep_case=rep_case, is_used=True)
     ItemFactory(device=device_3, rep_case=RepCaseFactory(), is_used=True)
     self.path = reverse('api:hospital:tracker:app:categories',
                         args=(self.client_1.id, ))
Пример #18
0
    def test_marketshare(self):
        self.assertEqual(self.tier.marketshare(self.eligible_purchased_items),
                         100)
        ItemFactory.create_batch(3,
                                 device=DeviceFactory(
                                     client=self.rebate.client,
                                     product=ProductFactory()),
                                 cost=160,
                                 purchased_date=date(2018, 12, 23),
                                 is_used=True)
        self.assertEqual(self.tier.marketshare(self.eligible_purchased_items),
                         60)

        self.rebate.client = ClientFactory()
        self.rebate.save()
        self.assertEqual(self.tier.marketshare(RebatableItem.objects.none()),
                         0)
Пример #19
0
    def test_unused_bulk_items_count_by_client_queryset(self):
        client = ClientFactory()

        ClientPriceFactory(client=client,
                           product=self.product_1,
                           unit_cost=100,
                           system_cost=120)
        ItemFactory.create_batch(
            3, device=client.device_set.get(product=self.product_1))
        ItemFactory.create_batch(2,
                                 device=DeviceFactory(product=self.product_2))
        products = Product.objects.unused_bulk_items_count_by_client(client)
        product = products.first()

        self.assertEqual(products.count(), 1)
        self.assertEqual(product, self.product_1)
        self.assertEqual(product.bulk, 3)
Пример #20
0
 def test_to_string_returns_device_name(self):
     device = DeviceFactory(product=ProductFactory(name='Product name'))
     self.assertEqual(str(device), 'Product name')
Пример #21
0
 def test_item_to_string(self):
     expired_date = timezone.datetime.strptime('2018-12-01', '%Y-%m-%d').date()
     device = DeviceFactory(hospital_number='12345')
     item = ItemFactory(serial_number='SERIAL-ABCD', expired_date=expired_date, device=device)
     self.assertEqual(str(item), f'12345: SERIAL-ABCD expired on 2018-12-01')
Пример #22
0
 def setUp(self):
     super().setUp()
     self.hospital = ClientFactory()
     self.device = DeviceFactory(client=self.hospital)
     self.path = reverse('api:staff:items', args=(self.device.id,))
Пример #23
0
 def test_get_method_returns_physician_app_on_used_devices(self):
     manufacturer = ManufacturerFactory(
         image=ImageField(filename='medtronic.png'), short_name='MDT')
     entry_device_1 = DeviceFactory(client=self.client_1,
                                    product=ProductFactory(
                                        category=self.category,
                                        level=ProductLevel.ENTRY.value,
                                        manufacturer=manufacturer))
     entry_device_2 = DeviceFactory(client=self.client_1,
                                    product=ProductFactory(
                                        category=self.category,
                                        level=ProductLevel.ENTRY.value))
     advanced_device = DeviceFactory(client=self.client_1,
                                     product=ProductFactory(
                                         category=self.category,
                                         level=ProductLevel.ADVANCED.value))
     today = datetime.utcnow().date()
     RepCaseFactory(physician=self.physician,
                    client=self.client_1,
                    procedure_date=today,
                    items=[
                        ItemFactory(is_used=True,
                                    device=entry_device_1,
                                    cost_type=UNIT_COST,
                                    cost=100),
                        ItemFactory(is_used=True,
                                    device=advanced_device,
                                    cost_type=UNIT_COST,
                                    cost=200),
                        ItemFactory(is_used=True,
                                    device=entry_device_2,
                                    cost_type=UNIT_COST,
                                    cost=350),
                        ItemFactory(is_used=True,
                                    device=advanced_device,
                                    cost_type=SYSTEM_COST,
                                    cost=470),
                    ])
     RepCaseFactory(client=self.client_1,
                    procedure_date=today,
                    items=[
                        ItemFactory(is_used=True,
                                    device=entry_device_1,
                                    cost_type=UNIT_COST,
                                    cost=90),
                        ItemFactory(is_used=True,
                                    device=advanced_device,
                                    cost_type=SYSTEM_COST,
                                    cost=430),
                    ])
     response = self.authorized_client.get(self.path)
     self.assertEqual(response.status_code, status.HTTP_200_OK)
     self.assertCountEqual(
         response.data.pop('manufacturers'),
         [{
             'id': manufacturer.id,
             'name': 'MDT',
             'app': '100.00',
             'image': 'manufacturers/medtronic.png'
         }, {
             'id': entry_device_2.product.manufacturer.id,
             'name': entry_device_2.product.manufacturer.display_name,
             'app': '350.00',
             'image': None
         }])
     self.assertDictEqual(
         response.data, {
             'client': {
                 'id': self.client_1.id,
                 'name': self.client_1.name,
                 'min': '90.00',
                 'max': '350.00',
                 'app': '180.00',
             },
             'physician': {
                 'id': self.physician.id,
                 'name': self.physician.user.name,
                 'app': '225.00',
             },
         })
     rmtree(settings.MEDIA_ROOT)