diff --git a/hub/servicebroker/serializers.py b/hub/servicebroker/serializers.py index 232ce86..e47adeb 100644 --- a/hub/servicebroker/serializers.py +++ b/hub/servicebroker/serializers.py @@ -1,5 +1,5 @@ from rest_framework import serializers -from services.models import Service, ServiceLevel, CloudProvider +from services.models import Service, CloudProvider class ServicePlanSerializer(serializers.Serializer): diff --git a/hub/servicebroker/views.py b/hub/servicebroker/views.py index 32d0d2b..4ccfe8d 100644 --- a/hub/servicebroker/views.py +++ b/hub/servicebroker/views.py @@ -10,7 +10,7 @@ from .serializers import ( BindingRequestSerializer, BindingResponseSerializer, ) -from services.models import Service, ServiceLevel +from services.models import Service class ServiceBrokerView(APIView): @@ -24,25 +24,11 @@ class CatalogView(ServiceBrokerView): def get(self, request): services = [] marketplace_services = Service.objects.all().prefetch_related( - "cloud_provider", "service_level", "categories" + "cloud_provider", "categories" ) for service in marketplace_services: plans = [] - service_levels = ServiceLevel.objects.all() - - for level in service_levels: - plan = { - "id": f"plan-{service.id}-{level.id}", - "name": level.name, - "description": level.description, - "metadata": { - "costs": [{"amount": float(service.price), "unit": "MONTHLY"}], - "bullets": [level.description], - }, - "free": False, - } - plans.append(plan) service_data = { "id": f"service-{service.id}", diff --git a/hub/services/admin.py b/hub/services/admin.py index 65a18c4..030b053 100644 --- a/hub/services/admin.py +++ b/hub/services/admin.py @@ -3,8 +3,6 @@ from django.utils.html import format_html from .models import ( CloudProvider, ConsultingPartner, - Country, - ServiceLevel, Service, Category, ) @@ -33,24 +31,11 @@ class CloudProviderAdmin(admin.ModelAdmin): return "No logo" -@admin.register(Country) -class CountryAdmin(admin.ModelAdmin): - list_display = ("name", "code") - search_fields = ("name", "code") - - -@admin.register(ServiceLevel) -class ServiceLevelAdmin(admin.ModelAdmin): - list_display = ("name", "response_time") - search_fields = ("name",) - - @admin.register(Service) class ServiceAdmin(admin.ModelAdmin): list_display = ( "name", "cloud_provider", - "service_level", "price", "logo_preview", "category_list", @@ -58,12 +43,10 @@ class ServiceAdmin(admin.ModelAdmin): ) list_filter = ( "cloud_provider", - "service_level", - "countries", "categories", "consulting_partners", ) - filter_horizontal = ("countries", "categories", "consulting_partners") + filter_horizontal = ("categories", "consulting_partners") search_fields = ("name", "description", "slug") prepopulated_fields = {"slug": ("name",)} diff --git a/hub/services/migrations/0008_remove_service_countries_and_more.py b/hub/services/migrations/0008_remove_service_countries_and_more.py new file mode 100644 index 0000000..097c159 --- /dev/null +++ b/hub/services/migrations/0008_remove_service_countries_and_more.py @@ -0,0 +1,27 @@ +# Generated by Django 5.1.5 on 2025-01-28 09:03 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("services", "0007_consultingpartner_service_consulting_partners"), + ] + + operations = [ + migrations.RemoveField( + model_name="service", + name="countries", + ), + migrations.RemoveField( + model_name="service", + name="service_level", + ), + migrations.DeleteModel( + name="Country", + ), + migrations.DeleteModel( + name="ServiceLevel", + ), + ] diff --git a/hub/services/models.py b/hub/services/models.py index 75b1260..cf0cfb3 100644 --- a/hub/services/models.py +++ b/hub/services/models.py @@ -94,26 +94,6 @@ class ConsultingPartner(models.Model): return reverse("services:partner_detail", kwargs={"slug": self.slug}) -class Country(models.Model): - name = models.CharField(max_length=100) - code = models.CharField(max_length=2) - - class Meta: - verbose_name_plural = "Countries" - - def __str__(self): - return self.name - - -class ServiceLevel(models.Model): - name = models.CharField(max_length=100) - description = models.TextField() - response_time = models.CharField(max_length=50) - - def __str__(self): - return self.name - - class Service(models.Model): name = models.CharField(max_length=200) slug = models.SlugField(max_length=250, unique=True) @@ -122,9 +102,7 @@ class Service(models.Model): consulting_partners = models.ManyToManyField( ConsultingPartner, related_name="services", blank=True ) - service_level = models.ForeignKey(ServiceLevel, on_delete=models.CASCADE) categories = models.ManyToManyField(Category, related_name="services") - countries = models.ManyToManyField(Country) price = models.DecimalField(max_digits=10, decimal_places=2) features = ProseEditorField() logo = models.ImageField( diff --git a/hub/services/templates/services/lead_form.html b/hub/services/templates/services/lead_form.html index 4e1789a..7ab8e09 100644 --- a/hub/services/templates/services/lead_form.html +++ b/hub/services/templates/services/lead_form.html @@ -10,7 +10,6 @@
Service Details

Provider: {{ service.cloud_provider.name }}

-

Service Level: {{ service.service_level.name }}

Price: ${{ service.price }}

diff --git a/hub/services/templates/services/partner_detail.html b/hub/services/templates/services/partner_detail.html index 0e01ff7..b93ca54 100644 --- a/hub/services/templates/services/partner_detail.html +++ b/hub/services/templates/services/partner_detail.html @@ -54,12 +54,6 @@ {{ category.full_path }} {% endfor %} -

- - Service Level: {{ service.service_level.name }}
- Price: ${{ service.price }} -
-

View Details diff --git a/hub/services/templates/services/provider_detail.html b/hub/services/templates/services/provider_detail.html index ba57a52..b680070 100644 --- a/hub/services/templates/services/provider_detail.html +++ b/hub/services/templates/services/provider_detail.html @@ -39,12 +39,6 @@ {{ category.full_path }} {% endfor %} -

- - Service Level: {{ service.service_level.name }}
- Price: ${{ service.price }} -
-

View Details diff --git a/hub/services/templates/services/service_detail.html b/hub/services/templates/services/service_detail.html index 594722a..edc5d3e 100644 --- a/hub/services/templates/services/service_detail.html +++ b/hub/services/templates/services/service_detail.html @@ -39,21 +39,12 @@
Service Details

Price: ${{ service.price }}

-

Service Level: {{ service.service_level.name }}

-

Response Time: {{ service.service_level.response_time }}

- -
Available Countries
-
- Show Interest + Order Back to Services diff --git a/hub/services/templates/services/service_list.html b/hub/services/templates/services/service_list.html index 9400c22..2858d58 100644 --- a/hub/services/templates/services/service_list.html +++ b/hub/services/templates/services/service_list.html @@ -53,30 +53,6 @@ -
- - -
- -
- - -
- Clear @@ -118,12 +94,6 @@

{{ service.description|safe|truncatewords:30 }}

-

- - Service Level: {{ service.service_level.name }}
- Price: ${{ service.price }} -
-

View Details Show Interest diff --git a/hub/services/templates/services/thank_you.html b/hub/services/templates/services/thank_you.html index c42d62f..0f34a6a 100644 --- a/hub/services/templates/services/thank_you.html +++ b/hub/services/templates/services/thank_you.html @@ -15,7 +15,6 @@
Service Details

Provider: {{ service.cloud_provider.name }}

-

Service Level: {{ service.service_level.name }}

diff --git a/hub/services/views.py b/hub/services/views.py index 7060f83..9b2719a 100644 --- a/hub/services/views.py +++ b/hub/services/views.py @@ -8,8 +8,6 @@ from .models import ( Service, CloudProvider, ConsultingPartner, - Country, - ServiceLevel, Category, ) @@ -22,20 +20,12 @@ logger = logging.getLogger(__name__) def service_list(request): services = Service.objects.all() cloud_providers = CloudProvider.objects.all() - countries = Country.objects.all() - service_levels = ServiceLevel.objects.all() categories = Category.objects.filter(parent=None) consulting_partners = ConsultingPartner.objects.all() if request.GET.get("cloud_provider"): services = services.filter(cloud_provider_id=request.GET.get("cloud_provider")) - if request.GET.get("country"): - services = services.filter(countries__id=request.GET.get("country")) - - if request.GET.get("service_level"): - services = services.filter(service_level_id=request.GET.get("service_level")) - if request.GET.get("category"): category_id = request.GET.get("category") category = Category.objects.get(id=category_id) @@ -58,8 +48,6 @@ def service_list(request): context = { "services": services, "cloud_providers": cloud_providers, - "countries": countries, - "service_levels": service_levels, "categories": categories, "consulting_partners": consulting_partners, }