def init_from_registered_applications(self, request):
        created_items = []
        for backend in CostTrackingRegister.get_registered_backends():
            try:
                items = backend.get_default_price_list_items()
            except __HOLE__:
                continue
            with transaction.atomic():
                for item in items:
                    item, created = models.DefaultPriceListItem.objects.update_or_create(
                        resource_content_type=item.resource_content_type,
                        item_type=item.item_type,
                        key=item.key,
                        defaults={
                            'value': item.value,
                            'name': '{}: {}'.format(item.item_type, item.key),
                            'metadata': item.metadata,
                            'units': item.units
                        }
                    )
                    if created:
                        created_items.append(item)
        if created_items:
            message = ungettext(
                'Price item was created: {}'.format(created_items[0].name),
                'Price items were created: {}'.format(', '.join(item.name for item in created_items)),
                len(created_items)
            )
            self.message_user(request, message)
        else:
            self.message_user(request, "Price items for all registered applications have been updated")

        return redirect(reverse('admin:cost_tracking_defaultpricelistitem_changelist'))
dataset/ETHPy150Open opennode/nodeconductor/nodeconductor/cost_tracking/admin.py/DefaultPriceListItemAdmin.init_from_registered_applications