mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-28 11:36:44 +00:00
Remove 'url' field from serializers (#9150)
* Remove 'url' field from serializers - Not used in any official client - Inconsistent use across models * Bump API version * Adjust unit tests * Fix API version
This commit is contained in:
parent
9d1d0fa66b
commit
c9666ff8ec
@ -1,13 +1,16 @@
|
||||
"""InvenTree API version information."""
|
||||
|
||||
# InvenTree API version
|
||||
INVENTREE_API_VERSION = 314
|
||||
INVENTREE_API_VERSION = 315
|
||||
|
||||
"""Increment this API version number whenever there is a significant change to the API that any clients need to know about."""
|
||||
|
||||
|
||||
INVENTREE_API_TEXT = """
|
||||
|
||||
v315 - 2025-02-22 : https://github.com/inventree/InvenTree/pull/9150
|
||||
- Remove outdated 'url' field from some API endpoints
|
||||
|
||||
v314 - 2025-02-17 : https://github.com/inventree/InvenTree/pull/6293
|
||||
- Removes a considerable amount of old auth endpoints
|
||||
- Introduces allauth-provided auth endpoints
|
||||
@ -74,7 +77,7 @@ v297 - 2024-12-29 : https://github.com/inventree/InvenTree/pull/8438
|
||||
- Adjustments to the CustomUserState API endpoints and serializers
|
||||
|
||||
v296 - 2024-12-25 : https://github.com/inventree/InvenTree/pull/8732
|
||||
- Adjust default "part_detail" behaviour for StockItem API endpoints
|
||||
- Adjust default "part_detail" behavior for StockItem API endpoints
|
||||
|
||||
v295 - 2024-12-23 : https://github.com/inventree/InvenTree/pull/8746
|
||||
- Improve API documentation for build APIs
|
||||
@ -226,7 +229,7 @@ v252 - 2024-09-13 : https://github.com/inventree/InvenTree/pull/8040
|
||||
- Add endpoint for listing all known units
|
||||
|
||||
v251 - 2024-09-06 : https://github.com/inventree/InvenTree/pull/8018
|
||||
- Adds "attach_to_model" field to the ReporTemplate model
|
||||
- Adds "attach_to_model" field to the ReportTemplate model
|
||||
|
||||
v250 - 2024-09-04 : https://github.com/inventree/InvenTree/pull/8069
|
||||
- Fixes 'revision' field definition in Part serializer
|
||||
@ -367,7 +370,7 @@ v211 - 2024-06-26 : https://github.com/inventree/InvenTree/pull/6911
|
||||
- Adds API endpoints for managing data import and export
|
||||
|
||||
v210 - 2024-06-26 : https://github.com/inventree/InvenTree/pull/7518
|
||||
- Adds translateable text to User API fields
|
||||
- Adds translatable text to User API fields
|
||||
|
||||
v209 - 2024-06-26 : https://github.com/inventree/InvenTree/pull/7514
|
||||
- Add "top_level" filter to PartCategory API endpoint
|
||||
@ -489,7 +492,7 @@ v178 - 2024-02-29 : https://github.com/inventree/InvenTree/pull/6604
|
||||
- Stock quantities represented in the BuildLine API endpoint are now filtered by Build.source_location
|
||||
|
||||
v177 - 2024-02-27 : https://github.com/inventree/InvenTree/pull/6581
|
||||
- Adds "subcategoies" count to PartCategoryTree serializer
|
||||
- Adds "subcategories" count to PartCategoryTree serializer
|
||||
- Adds "sublocations" count to StockLocationTree serializer
|
||||
|
||||
v176 - 2024-02-26 : https://github.com/inventree/InvenTree/pull/6535
|
||||
@ -579,7 +582,7 @@ v153 -> 2023-11-21 : https://github.com/inventree/InvenTree/pull/5956
|
||||
- Adds override_min and override_max fields to part pricing API
|
||||
|
||||
v152 -> 2023-11-20 : https://github.com/inventree/InvenTree/pull/5949
|
||||
- Adds barcode support for manufacturerpart model
|
||||
- Adds barcode support for ManufacturerPart model
|
||||
- Adds API endpoint for adding parts to purchase order using barcode scan
|
||||
|
||||
v151 -> 2023-11-13 : https://github.com/inventree/InvenTree/pull/5906
|
||||
@ -1094,7 +1097,7 @@ v8 -> 2021-07-19
|
||||
|
||||
v7 -> 2021-07-03
|
||||
- Introduced the concept of "API forms" in https://github.com/inventree/InvenTree/pull/1716
|
||||
- API OPTIONS endpoints provide comprehensive field metedata
|
||||
- API OPTIONS endpoints provide comprehensive field metadata
|
||||
- Multiple new API endpoints added for database models
|
||||
|
||||
v6 -> 2021-06-23
|
||||
|
@ -62,7 +62,6 @@ class BuildSerializer(
|
||||
model = Build
|
||||
fields = [
|
||||
'pk',
|
||||
'url',
|
||||
'title',
|
||||
'barcode_hash',
|
||||
'batch',
|
||||
@ -112,8 +111,6 @@ class BuildSerializer(
|
||||
|
||||
level = serializers.IntegerField(label=_('Build Level'), read_only=True)
|
||||
|
||||
url = serializers.CharField(source='get_absolute_url', read_only=True)
|
||||
|
||||
status_text = serializers.CharField(source='get_status_display', read_only=True)
|
||||
|
||||
part_detail = part_serializers.PartBriefSerializer(
|
||||
@ -424,7 +421,7 @@ class BuildOutputCreateSerializer(serializers.Serializer):
|
||||
except DjangoValidationError as e:
|
||||
raise ValidationError({'serial_numbers': e.messages})
|
||||
|
||||
# Check for conflicting serial numbesr
|
||||
# Check for conflicting serial numbers
|
||||
existing = part.find_conflicting_serial_numbers(self.serials)
|
||||
|
||||
if len(existing) > 0:
|
||||
|
@ -113,7 +113,7 @@ class CompanySerializer(
|
||||
):
|
||||
"""Serializer for Company object (full detail)."""
|
||||
|
||||
export_exclude_fields = ['url', 'primary_address']
|
||||
export_exclude_fields = ['primary_address']
|
||||
|
||||
import_exclude_fields = ['image']
|
||||
|
||||
@ -123,7 +123,6 @@ class CompanySerializer(
|
||||
model = Company
|
||||
fields = [
|
||||
'pk',
|
||||
'url',
|
||||
'name',
|
||||
'description',
|
||||
'website',
|
||||
@ -163,8 +162,6 @@ class CompanySerializer(
|
||||
|
||||
primary_address = AddressSerializer(required=False, allow_null=True, read_only=True)
|
||||
|
||||
url = serializers.CharField(source='get_absolute_url', read_only=True)
|
||||
|
||||
image = InvenTreeImageSerializerField(required=False, allow_null=True)
|
||||
|
||||
email = serializers.EmailField(
|
||||
@ -353,7 +350,6 @@ class SupplierPartSerializer(
|
||||
'SKU',
|
||||
'supplier',
|
||||
'supplier_detail',
|
||||
'url',
|
||||
'updated',
|
||||
'notes',
|
||||
'tags',
|
||||
@ -445,8 +441,6 @@ class SupplierPartSerializer(
|
||||
source='manufacturer_part.MPN', read_only=True, label=_('MPN')
|
||||
)
|
||||
|
||||
url = serializers.CharField(source='get_absolute_url', read_only=True)
|
||||
|
||||
# Date fields
|
||||
updated = serializers.DateTimeField(allow_null=True, read_only=True)
|
||||
|
||||
|
@ -81,7 +81,6 @@ class CategorySerializer(
|
||||
'pathstring',
|
||||
'path',
|
||||
'starred',
|
||||
'url',
|
||||
'structural',
|
||||
'icon',
|
||||
'parent_default_location',
|
||||
@ -124,8 +123,6 @@ class CategorySerializer(
|
||||
help_text=_('Parent part category'),
|
||||
)
|
||||
|
||||
url = serializers.CharField(source='get_absolute_url', read_only=True)
|
||||
|
||||
part_count = serializers.IntegerField(read_only=True, label=_('Parts'))
|
||||
|
||||
subcategories = serializers.IntegerField(read_only=True, label=_('Subcategories'))
|
||||
@ -1134,11 +1131,11 @@ class PartSerializer(
|
||||
mpn = initial_supplier.get('mpn', '')
|
||||
|
||||
if manufacturer and mpn:
|
||||
manu_part = company.models.ManufacturerPart.objects.create(
|
||||
manufacturer_part = company.models.ManufacturerPart.objects.create(
|
||||
part=instance, manufacturer=manufacturer, MPN=mpn
|
||||
)
|
||||
else:
|
||||
manu_part = None
|
||||
manufacturer_part = None
|
||||
|
||||
supplier = initial_supplier.get('supplier', None)
|
||||
sku = initial_supplier.get('sku', '')
|
||||
@ -1148,7 +1145,7 @@ class PartSerializer(
|
||||
part=instance,
|
||||
supplier=supplier,
|
||||
SKU=sku,
|
||||
manufacturer_part=manu_part,
|
||||
manufacturer_part=manufacturer_part,
|
||||
)
|
||||
|
||||
return instance
|
||||
|
@ -178,7 +178,6 @@ class PartCategoryAPITest(InvenTreeAPITestCase):
|
||||
'parent',
|
||||
'part_count',
|
||||
'pathstring',
|
||||
'url',
|
||||
]
|
||||
|
||||
response = self.get(url, expected_code=200)
|
||||
|
@ -32,7 +32,7 @@ class MetadataSerializer(serializers.ModelSerializer):
|
||||
- Else, if it is a PUT update, overwrite any existing metadata
|
||||
"""
|
||||
if self.partial:
|
||||
# Default behaviour is to "merge" new data in
|
||||
# Default behavior is to "merge" new data in
|
||||
metadata = instance.metadata.copy() if instance.metadata else {}
|
||||
metadata.update(data['metadata'])
|
||||
data['metadata'] = metadata
|
||||
|
@ -1153,7 +1153,6 @@ class LocationSerializer(
|
||||
fields = [
|
||||
'pk',
|
||||
'barcode_hash',
|
||||
'url',
|
||||
'name',
|
||||
'level',
|
||||
'description',
|
||||
@ -1206,8 +1205,6 @@ class LocationSerializer(
|
||||
help_text=_('Parent stock location'),
|
||||
)
|
||||
|
||||
url = serializers.CharField(source='get_absolute_url', read_only=True)
|
||||
|
||||
items = serializers.IntegerField(read_only=True, label=_('Stock Items'))
|
||||
|
||||
sublocations = serializers.IntegerField(read_only=True, label=_('Sublocations'))
|
||||
|
@ -114,7 +114,6 @@ class StockLocationTest(StockAPITestCase):
|
||||
'items',
|
||||
'pathstring',
|
||||
'owner',
|
||||
'url',
|
||||
'icon',
|
||||
'location_type',
|
||||
'location_type_detail',
|
||||
|
Loading…
x
Reference in New Issue
Block a user