diff --git a/README.md b/README.md index 6ea257f..b23c39e 100644 --- a/README.md +++ b/README.md @@ -132,5 +132,7 @@ Add support for Netbox 3.5 which become the minimum version supported to accomod * [88](https://github.com/mlebreuil/netbox-contract/issues/88) Add a placeholder value to the accounting dimensions jsonfield. This placeholder vale con be configured as part of the PLUGINS_CONFIG parameter in the configuration.py file (see above) * [89](https://github.com/mlebreuil/netbox-contract/issues/89) add the posibility to link contracts to sites and virtual machines. * [99](https://github.com/mlebreuil/netbox-contract/issues/99) list child contracts in on the parent view. - +#### version 2.0.10 +* [107](https://github.com/mlebreuil/netbox-contract/issues/107) Add the contacts tab to the service provider detail view. +* [111](https://github.com/mlebreuil/netbox-contract/issues/111) Correct assignment spelling. diff --git a/assignement_import.csv b/assignment_import.csv similarity index 100% rename from assignement_import.csv rename to assignment_import.csv diff --git a/pyproject.toml b/pyproject.toml index 6277cea..ac7d2bf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "netbox-contract" -version = "2.0.9" +version = "2.0.10" authors = [ { name="Marc Lebreuil", email="marc@famillelebreuil.net" }, ] diff --git a/src/netbox_contract/__init__.py b/src/netbox_contract/__init__.py index 7ab9570..51d6e7f 100644 --- a/src/netbox_contract/__init__.py +++ b/src/netbox_contract/__init__.py @@ -5,7 +5,7 @@ class ContractsConfig(PluginConfig): name = 'netbox_contract' verbose_name = 'Netbox contract' description = 'Contract management plugin for Netbox' - version = '2.0.9' + version = '2.0.10' author = 'Marc Lebreuil' author_email = 'marc@famillelebreuil.net' base_url = 'contracts' diff --git a/src/netbox_contract/api/serializers.py b/src/netbox_contract/api/serializers.py index 999ebd4..2cfbff9 100644 --- a/src/netbox_contract/api/serializers.py +++ b/src/netbox_contract/api/serializers.py @@ -7,7 +7,7 @@ from tenancy.api.nested_serializers import NestedTenantSerializer from utilities.api import get_serializer_for_model -from ..models import Contract, ContractAssignement, Invoice, ServiceProvider +from ..models import Contract, ContractAssignment, Invoice, ServiceProvider class NestedServiceProviderSerializer(WritableNestedSerializer): @@ -40,13 +40,13 @@ class Meta: fields = ('id', 'url', 'display', 'number') -class NestedContractAssignementSerializer(WritableNestedSerializer): +class NestedContractAssignmentSerializer(WritableNestedSerializer): url = serializers.HyperlinkedIdentityField( - view_name='plugins-api:netbox_contract-api:ContractAssignement-detail' + view_name='plugins-api:netbox_contract-api:ContractAssignment-detail' ) class Meta: - model = ContractAssignement + model = ContractAssignment fields = ('id', 'url', 'display', 'contract', 'content_object') @@ -137,16 +137,16 @@ class Meta: ) -class ContractAssignementSerializer(NetBoxModelSerializer): +class ContractAssignmentSerializer(NetBoxModelSerializer): url = serializers.HyperlinkedIdentityField( - view_name='plugins-api:netbox_contract-api:contractassignement-detail' + view_name='plugins-api:netbox_contract-api:contractassignment-detail' ) content_type = ContentTypeField(queryset=ContentType.objects.all()) content_object = serializers.SerializerMethodField(read_only=True) contract = NestedContractSerializer() class Meta: - model = ContractAssignement + model = ContractAssignment fields = [ 'id', 'url', diff --git a/src/netbox_contract/api/urls.py b/src/netbox_contract/api/urls.py index fc9c7e7..e3506c7 100644 --- a/src/netbox_contract/api/urls.py +++ b/src/netbox_contract/api/urls.py @@ -8,6 +8,6 @@ router.register('contracts', views.ContractViewSet) router.register('invoices', views.InvoiceViewSet) router.register('serviceproviders', views.ServiceProviderViewSet) -router.register('contractassignement', views.ContractAssignementViewSet) +router.register('contractassignment', views.ContractAssignmentViewSet) urlpatterns = router.urls diff --git a/src/netbox_contract/api/views.py b/src/netbox_contract/api/views.py index 00df137..8d8a520 100644 --- a/src/netbox_contract/api/views.py +++ b/src/netbox_contract/api/views.py @@ -2,7 +2,7 @@ from .. import filtersets, models from .serializers import ( - ContractAssignementSerializer, + ContractAssignmentSerializer, ContractSerializer, InvoiceSerializer, ServiceProviderSerializer, @@ -25,6 +25,6 @@ class ServiceProviderViewSet(NetBoxModelViewSet): serializer_class = ServiceProviderSerializer -class ContractAssignementViewSet(NetBoxModelViewSet): - queryset = models.ContractAssignement.objects.prefetch_related('contract', 'tags') - serializer_class = ContractAssignementSerializer +class ContractAssignmentViewSet(NetBoxModelViewSet): + queryset = models.ContractAssignment.objects.prefetch_related('contract', 'tags') + serializer_class = ContractAssignmentSerializer diff --git a/src/netbox_contract/filtersets.py b/src/netbox_contract/filtersets.py index f3a3c60..cc62ac2 100644 --- a/src/netbox_contract/filtersets.py +++ b/src/netbox_contract/filtersets.py @@ -1,7 +1,7 @@ from django.db.models import Q from netbox.filtersets import NetBoxModelFilterSet -from .models import Contract, ContractAssignement, Invoice, ServiceProvider +from .models import Contract, ContractAssignment, Invoice, ServiceProvider class ContractFilterSet(NetBoxModelFilterSet): @@ -37,9 +37,9 @@ def search(self, queryset, name, value): return queryset.filter(name__icontains=value) -class ContractAssignementFilterSet(NetBoxModelFilterSet): +class ContractAssignmentFilterSet(NetBoxModelFilterSet): class Meta: - model = ContractAssignement + model = ContractAssignment fields = ('id', 'contract') def search(self, queryset, name, value): diff --git a/src/netbox_contract/forms.py b/src/netbox_contract/forms.py index bee2dfd..53bcdc4 100644 --- a/src/netbox_contract/forms.py +++ b/src/netbox_contract/forms.py @@ -25,7 +25,7 @@ from .constants import SERVICE_PROVIDER_MODELS from .models import ( Contract, - ContractAssignement, + ContractAssignment, InternalEntityChoices, Invoice, ServiceProvider, @@ -314,14 +314,14 @@ class ServiceProviderBulkEditForm(NetBoxModelBulkEditForm): model = ServiceProvider -# ContractAssignement +# ContractAssignment -class ContractAssignementForm(NetBoxModelForm): +class ContractAssignmentForm(NetBoxModelForm): contract = DynamicModelChoiceField(queryset=Contract.objects.all()) class Meta: - model = ContractAssignement + model = ContractAssignment fields = ['content_type', 'object_id', 'contract', 'tags'] widgets = { 'content_type': forms.HiddenInput(), @@ -329,12 +329,12 @@ class Meta: } -class ContractAssignementFilterSetForm(NetBoxModelFilterSetForm): - model = ContractAssignement +class ContractAssignmentFilterSetForm(NetBoxModelFilterSetForm): + model = ContractAssignment contract = DynamicModelChoiceField(queryset=Contract.objects.all()) -class ContractAssignementImportForm(NetBoxModelImportForm): +class ContractAssignmentImportForm(NetBoxModelImportForm): content_type = CSVContentTypeField( queryset=ContentType.objects.all(), help_text='Content Type in the form .', @@ -344,5 +344,5 @@ class ContractAssignementImportForm(NetBoxModelImportForm): ) class Meta: - model = ContractAssignement + model = ContractAssignment fields = ['content_type', 'object_id', 'contract', 'tags'] diff --git a/src/netbox_contract/migrations/0023_rename_contractassignement_contractassignment_and_more.py b/src/netbox_contract/migrations/0023_rename_contractassignement_contractassignment_and_more.py new file mode 100644 index 0000000..4bc6f14 --- /dev/null +++ b/src/netbox_contract/migrations/0023_rename_contractassignement_contractassignment_and_more.py @@ -0,0 +1,26 @@ +# Generated by Django 4.2.10 on 2024-03-24 11:18 + +from django.db import migrations + + +class Migration(migrations.Migration): + dependencies = [ + ('extras', '0107_cachedvalue_extras_cachedvalue_object'), + ('contenttypes', '0002_remove_content_type_name'), + ( + 'netbox_contract', + '0022_alter_contract_internal_partie_alter_contract_parent', + ), + ] + + operations = [ + migrations.RenameModel( + old_name='ContractAssignement', + new_name='ContractAssignment', + ), + migrations.RenameIndex( + model_name='contractassignment', + new_name='netbox_cont_content_3bf04f_idx', + old_name='netbox_cont_content_ff787b_idx', + ), + ] diff --git a/src/netbox_contract/models.py b/src/netbox_contract/models.py index e7fe29c..956912a 100644 --- a/src/netbox_contract/models.py +++ b/src/netbox_contract/models.py @@ -57,7 +57,7 @@ def get_absolute_url(self): return reverse('plugins:netbox_contract:serviceprovider', args=[self.pk]) -class ContractAssignement(NetBoxModel): +class ContractAssignment(NetBoxModel): content_type = models.ForeignKey(to=ContentType, on_delete=models.CASCADE) object_id = models.PositiveBigIntegerField() content_object = GenericForeignKey(ct_field='content_type', fk_field='object_id') @@ -73,7 +73,7 @@ class Meta: ] def get_absolute_url(self): - return reverse('plugins:netbox_contract:contractassignement', args=[self.pk]) + return reverse('plugins:netbox_contract:contractassignment', args=[self.pk]) class Contract(NetBoxModel): diff --git a/src/netbox_contract/navigation.py b/src/netbox_contract/navigation.py index e19fcbe..b99d13b 100644 --- a/src/netbox_contract/navigation.py +++ b/src/netbox_contract/navigation.py @@ -55,9 +55,9 @@ permissions=['netbox_contract.view_serviceprovider'], ) contract_assignemnt_menu_item = PluginMenuItem( - link='plugins:netbox_contract:contractassignement_list', - link_text='Contract assignements', - permissions=['netbox_contract.view_contractassignement'], + link='plugins:netbox_contract:contractassignment_list', + link_text='Contract assignments', + permissions=['netbox_contract.view_contractassignment'], ) items = ( diff --git a/src/netbox_contract/tables.py b/src/netbox_contract/tables.py index efadceb..2c9ee27 100644 --- a/src/netbox_contract/tables.py +++ b/src/netbox_contract/tables.py @@ -1,10 +1,10 @@ import django_tables2 as tables from netbox.tables import NetBoxTable, columns -from .models import Contract, ContractAssignement, Invoice, ServiceProvider +from .models import Contract, ContractAssignment, Invoice, ServiceProvider -class ContractAssignementListTable(NetBoxTable): +class ContractAssignmentListTable(NetBoxTable): content_type = columns.ContentTypeColumn(verbose_name='Object Type') content_object = tables.Column(linkify=True, orderable=False) contract = tables.Column(linkify=True) @@ -12,7 +12,7 @@ class ContractAssignementListTable(NetBoxTable): contract__external_partie_object = tables.Column(linkify=True) class Meta(NetBoxTable.Meta): - model = ContractAssignement + model = ContractAssignment fields = ( 'pk', 'content_type', @@ -32,13 +32,13 @@ class Meta(NetBoxTable.Meta): ) -class ContractAssignementObjectTable(NetBoxTable): +class ContractAssignmentObjectTable(NetBoxTable): contract = tables.Column(linkify=True) actions = columns.ActionsColumn(actions=('edit', 'delete')) contract__external_partie_object = tables.Column(linkify=True) class Meta(NetBoxTable.Meta): - model = ContractAssignement + model = ContractAssignment fields = ( 'pk', 'contract', @@ -64,14 +64,14 @@ class Meta(NetBoxTable.Meta): ) -class ContractAssignementContractTable(NetBoxTable): +class ContractAssignmentContractTable(NetBoxTable): content_type = columns.ContentTypeColumn(verbose_name='Object Type') content_object = tables.Column(linkify=True, verbose_name='Object', orderable=False) content_object__status = tables.Column(verbose_name='Status') actions = columns.ActionsColumn(actions=('edit', 'delete')) class Meta(NetBoxTable.Meta): - model = ContractAssignement + model = ContractAssignment fields = ( 'pk', 'content_type', diff --git a/src/netbox_contract/template_content.py b/src/netbox_contract/template_content.py index f003921..5cc7491 100644 --- a/src/netbox_contract/template_content.py +++ b/src/netbox_contract/template_content.py @@ -5,100 +5,92 @@ from virtualization.models import VirtualMachine from . import tables -from .models import ContractAssignement +from .models import ContractAssignment -class CircuitContractAssignements(PluginTemplateExtension): +class CircuitContractAssignments(PluginTemplateExtension): model = 'circuits.circuit' def full_width_page(self): circuit = self.context['object'] circuit_type = ContentType.objects.get_for_model(Circuit) - contract_assignements = ContractAssignement.objects.filter( + contract_assignments = ContractAssignment.objects.filter( content_type__pk=circuit_type.id, object_id=circuit.id ) - assignements_table = tables.ContractAssignementObjectTable( - contract_assignements - ) - assignements_table.configure(self.context['request']) + assignments_table = tables.ContractAssignmentObjectTable(contract_assignments) + assignments_table.configure(self.context['request']) return self.render( - 'contract_assignements_bottom.html', + 'contract_assignments_bottom.html', extra_context={ - 'assignements_table': assignements_table, + 'assignments_table': assignments_table, }, ) -class DeviceContractAssignements(PluginTemplateExtension): +class DeviceContractAssignments(PluginTemplateExtension): model = 'dcim.device' def full_width_page(self): device = self.context['object'] device_type = ContentType.objects.get_for_model(Device) - contract_assignements = ContractAssignement.objects.filter( + contract_assignments = ContractAssignment.objects.filter( content_type__pk=device_type.id, object_id=device.id ) - assignements_table = tables.ContractAssignementObjectTable( - contract_assignements - ) - assignements_table.configure(self.context['request']) + assignments_table = tables.ContractAssignmentObjectTable(contract_assignments) + assignments_table.configure(self.context['request']) return self.render( - 'contract_assignements_bottom.html', + 'contract_assignments_bottom.html', extra_context={ - 'assignements_table': assignements_table, + 'assignments_table': assignments_table, }, ) -class VMContractAssignements(PluginTemplateExtension): +class VMContractAssignments(PluginTemplateExtension): model = 'virtualization.virtualmachine' def full_width_page(self): vm = self.context['object'] vm_type = ContentType.objects.get_for_model(VirtualMachine) - contract_assignements = ContractAssignement.objects.filter( + contract_assignments = ContractAssignment.objects.filter( content_type__pk=vm_type.id, object_id=vm.id ) - assignements_table = tables.ContractAssignementObjectTable( - contract_assignements - ) - assignements_table.configure(self.context['request']) + assignments_table = tables.ContractAssignmentObjectTable(contract_assignments) + assignments_table.configure(self.context['request']) return self.render( - 'contract_assignements_bottom.html', + 'contract_assignments_bottom.html', extra_context={ - 'assignements_table': assignements_table, + 'assignments_table': assignments_table, }, ) -class SiteContractAssignements(PluginTemplateExtension): +class SiteContractAssignments(PluginTemplateExtension): model = 'dcim.site' def full_width_page(self): site = self.context['object'] site_type = ContentType.objects.get_for_model(Site) - contract_assignements = ContractAssignement.objects.filter( + contract_assignments = ContractAssignment.objects.filter( content_type__pk=site_type.id, object_id=site.id ) - assignements_table = tables.ContractAssignementObjectTable( - contract_assignements - ) - assignements_table.configure(self.context['request']) + assignments_table = tables.ContractAssignmentObjectTable(contract_assignments) + assignments_table.configure(self.context['request']) return self.render( - 'contract_assignements_bottom.html', + 'contract_assignments_bottom.html', extra_context={ - 'assignements_table': assignements_table, + 'assignments_table': assignments_table, }, ) template_extensions = [ - CircuitContractAssignements, - DeviceContractAssignements, - VMContractAssignements, - SiteContractAssignements, + CircuitContractAssignments, + DeviceContractAssignments, + VMContractAssignments, + SiteContractAssignments, ] diff --git a/src/netbox_contract/templates/contact_assignements_bottom.html b/src/netbox_contract/templates/contact_assignments_bottom.html similarity index 100% rename from src/netbox_contract/templates/contact_assignements_bottom.html rename to src/netbox_contract/templates/contact_assignments_bottom.html diff --git a/src/netbox_contract/templates/contract_assignements_bottom.html b/src/netbox_contract/templates/contract_assignments_bottom.html similarity index 57% rename from src/netbox_contract/templates/contract_assignements_bottom.html rename to src/netbox_contract/templates/contract_assignments_bottom.html index 7547be2..c0a26a3 100644 --- a/src/netbox_contract/templates/contract_assignements_bottom.html +++ b/src/netbox_contract/templates/contract_assignments_bottom.html @@ -3,17 +3,17 @@
-
Contracts Assignements
- {% if assignements_table %} +
Contracts Assignments
+ {% if assignments_table %}
- {% render_table assignements_table %} + {% render_table assignments_table %}
{% endif %} - {% if perms.netbox_contract.add_contractassignement %} + {% if perms.netbox_contract.add_contractassignment %} {% endif %} diff --git a/src/netbox_contract/templates/netbox_contract/contract.html b/src/netbox_contract/templates/netbox_contract/contract.html index 089943b..e05f663 100644 --- a/src/netbox_contract/templates/netbox_contract/contract.html +++ b/src/netbox_contract/templates/netbox_contract/contract.html @@ -105,9 +105,9 @@
Contract
-
Assignements
+
Assignments
- {% render_table assignements_table %} + {% render_table assignments_table %}
diff --git a/src/netbox_contract/templates/netbox_contract/contract_assignement.html b/src/netbox_contract/templates/netbox_contract/contract_assignment.html similarity index 92% rename from src/netbox_contract/templates/netbox_contract/contract_assignement.html rename to src/netbox_contract/templates/netbox_contract/contract_assignment.html index 41bc632..ad49bb7 100644 --- a/src/netbox_contract/templates/netbox_contract/contract_assignement.html +++ b/src/netbox_contract/templates/netbox_contract/contract_assignment.html @@ -3,7 +3,7 @@
-
Contract assignement
+
Contract assignment
diff --git a/src/netbox_contract/templates/netbox_contract/serviceprovider.html b/src/netbox_contract/templates/netbox_contract/serviceprovider.html index bbab8dd..dc2a541 100644 --- a/src/netbox_contract/templates/netbox_contract/serviceprovider.html +++ b/src/netbox_contract/templates/netbox_contract/serviceprovider.html @@ -1,4 +1,7 @@ {% extends 'generic/object.html' %} +{% load static %} +{% load helpers %} +{% load i18n %} {% block content %}
@@ -31,7 +34,6 @@
Service Provider
{% include 'inc/panels/custom_fields.html' %} {% include 'inc/panels/comments.html' %} {% include 'inc/panels/tags.html' %} - {% include 'contact_assignements_bottom.html' %}
{% endblock content %} \ No newline at end of file diff --git a/src/netbox_contract/urls.py b/src/netbox_contract/urls.py index 2aa0c80..bf4867d 100644 --- a/src/netbox_contract/urls.py +++ b/src/netbox_contract/urls.py @@ -1,5 +1,6 @@ -from django.urls import path +from django.urls import include, path from netbox.views.generic import ObjectChangeLogView +from utilities.urls import get_model_urls from . import models, views @@ -51,6 +52,11 @@ name='serviceprovider_changelog', kwargs={'model': models.ServiceProvider}, ), + path( + 'serviceproviders//contacts/', + views.ServiceProviderContactsView.as_view(), + name='serviceprovider_contacts', + ), # Contracts path('contracts/', views.ContractListView.as_view(), name='contract_list'), path('contracts/add/', views.ContractEditView.as_view(), name='contract_add'), @@ -69,7 +75,11 @@ views.ContractBulkDeleteView.as_view(), name='contract_bulk_delete', ), - path('contracts//', views.ContractView.as_view(), name='contract'), + path( + 'contracts//', + include(get_model_urls('netbox_contract', 'contract')), + name='contract', + ), path( 'contracts//edit/', views.ContractEditView.as_view(), @@ -100,7 +110,11 @@ views.InvoiceBulkDeleteView.as_view(), name='invoice_bulk_delete', ), - path('invoices//', views.InvoiceView.as_view(), name='invoice'), + path( + 'invoices//', + include(get_model_urls('netbox_contract', 'invoice')), + name='invoice', + ), path( 'invoices//edit/', views.InvoiceEditView.as_view(), name='invoice_edit' ), @@ -115,41 +129,41 @@ name='invoice_changelog', kwargs={'model': models.Invoice}, ), - # Contract assignements + # Contract assignments path( - 'assignements/', - views.ContractAssignementListView.as_view(), - name='contractassignement_list', + 'assignments/', + views.ContractAssignmentListView.as_view(), + name='contractassignment_list', ), path( - 'assignements/add/', - views.ContractAssignementEditView.as_view(), - name='contractassignement_add', + 'assignments/add/', + views.ContractAssignmentEditView.as_view(), + name='contractassignment_add', ), path( - 'assignements/import/', - views.ContractAssignementBulkImportView.as_view(), - name='contractassignement_import', + 'assignments/import/', + views.ContractAssignmentBulkImportView.as_view(), + name='contractassignment_import', ), path( - 'assignements//', - views.ContractAssignementView.as_view(), - name='contractassignement', + 'assignments//', + views.ContractAssignmentView.as_view(), + name='contractassignment', ), path( - 'assignements//edit/', - views.ContractAssignementEditView.as_view(), - name='contractassignement_edit', + 'assignments//edit/', + views.ContractAssignmentEditView.as_view(), + name='contractassignment_edit', ), path( - 'assignements//delete/', - views.ContractAssignementDeleteView.as_view(), - name='contractassignement_delete', + 'assignments//delete/', + views.ContractAssignmentDeleteView.as_view(), + name='contractassignment_delete', ), path( - 'assignements//changelog/', + 'assignments//changelog/', ObjectChangeLogView.as_view(), - name='contractassignement_changelog', - kwargs={'model': models.ContractAssignement}, + name='contractassignment_changelog', + kwargs={'model': models.ContractAssignment}, ), ) diff --git a/src/netbox_contract/views.py b/src/netbox_contract/views.py index 8972b7a..b9fad4b 100644 --- a/src/netbox_contract/views.py +++ b/src/netbox_contract/views.py @@ -7,15 +7,22 @@ from django.shortcuts import get_object_or_404, render from netbox.views import generic from netbox.views.generic.utils import get_prerequisite_model +from tenancy.views import ObjectContactsView from utilities.forms import restrict_form_fields from utilities.utils import count_related, normalize_querydict +from utilities.views import register_model_view from . import filtersets, forms, tables -from .models import Contract, ContractAssignement, Invoice, ServiceProvider +from .models import Contract, ContractAssignment, Invoice, ServiceProvider # ServiceProvider views +@register_model_view(ServiceProvider, 'contacts') +class ServiceProviderContactsView(ObjectContactsView): + queryset = ServiceProvider.objects.all() + + class ServiceProviderView(generic.ObjectView): queryset = ServiceProvider.objects.all() @@ -55,27 +62,27 @@ class ServiceProviderBulkDeleteView(generic.BulkDeleteView): table = tables.ServiceProviderListTable -# Contract assignement view +# Contract assignment view -class ContractAssignementView(generic.ObjectView): - queryset = ContractAssignement.objects.all() +class ContractAssignmentView(generic.ObjectView): + queryset = ContractAssignment.objects.all() -class ContractAssignementListView(generic.ObjectListView): - queryset = ContractAssignement.objects.all() - table = tables.ContractAssignementListTable - filterset = filtersets.ContractAssignementFilterSet - filterset_form = forms.ContractAssignementFilterSetForm +class ContractAssignmentListView(generic.ObjectListView): + queryset = ContractAssignment.objects.all() + table = tables.ContractAssignmentListTable + filterset = filtersets.ContractAssignmentFilterSet + filterset_form = forms.ContractAssignmentFilterSetForm actions = [ 'import', 'export', ] -class ContractAssignementEditView(generic.ObjectEditView): - queryset = ContractAssignement.objects.all() - form = forms.ContractAssignementForm +class ContractAssignmentEditView(generic.ObjectEditView): + queryset = ContractAssignment.objects.all() + form = forms.ContractAssignmentForm def alter_object(self, instance, request, args, kwargs): if not instance.pk and kwargs: @@ -95,35 +102,36 @@ def get_extra_addanother_params(self, request): } -class ContractAssignementDeleteView(generic.ObjectDeleteView): - queryset = ContractAssignement.objects.all() +class ContractAssignmentDeleteView(generic.ObjectDeleteView): + queryset = ContractAssignment.objects.all() -class ContractAssignementBulkImportView(generic.BulkImportView): - queryset = ContractAssignement.objects.all() - model_form = forms.ContractAssignementImportForm - table = tables.ContractAssignementListTable +class ContractAssignmentBulkImportView(generic.BulkImportView): + queryset = ContractAssignment.objects.all() + model_form = forms.ContractAssignmentImportForm + table = tables.ContractAssignmentListTable # Contract views +@register_model_view(Contract) class ContractView(generic.ObjectView): queryset = Contract.objects.all() def get_extra_context(self, request, instance): invoices_table = tables.InvoiceListTable(instance.invoices.all()) invoices_table.configure(request) - assignements_table = tables.ContractAssignementContractTable( + assignments_table = tables.ContractAssignmentContractTable( instance.assignments.all() ) - assignements_table.configure(request) + assignments_table.configure(request) childs_table = tables.ContractListBottomTable(instance.childs.all()) childs_table.configure(request) return { 'invoices_table': invoices_table, - 'assignements_table': assignements_table, + 'assignments_table': assignments_table, 'childs_table': childs_table, } @@ -197,6 +205,7 @@ class ContractBulkDeleteView(generic.BulkDeleteView): # Invoice views +@register_model_view(Invoice) class InvoiceView(generic.ObjectView): queryset = Invoice.objects.all()