Disallow changing worktype labels, don't show deleted employment
This commit is contained in:
parent
8a1f067e44
commit
b5432060c0
|
@ -24,6 +24,11 @@ class WorkTypeSerializer(serializers.ModelSerializer):
|
||||||
validated_data['client'] = self.context['request'].user.client
|
validated_data['client'] = self.context['request'].user.client
|
||||||
return serializers.ModelSerializer.create(self, validated_data)
|
return serializers.ModelSerializer.create(self, validated_data)
|
||||||
|
|
||||||
|
def update(self, instance, validated_data):
|
||||||
|
if 'label' in validated_data:
|
||||||
|
raise serializers.ValidationError("Cannot update field.")
|
||||||
|
return super().update(instance, validated_data)
|
||||||
|
|
||||||
class PriceSerializer(serializers.ModelSerializer):
|
class PriceSerializer(serializers.ModelSerializer):
|
||||||
get_employee_uuid = serializers.UUIDField(write_only=True)
|
get_employee_uuid = serializers.UUIDField(write_only=True)
|
||||||
get_work_type_uuid = serializers.UUIDField(write_only=True)
|
get_work_type_uuid = serializers.UUIDField(write_only=True)
|
||||||
|
|
|
@ -88,7 +88,8 @@ class EmployerViewSet(viewsets.ModelViewSet):
|
||||||
http_method_names = ['get', 'head', 'put', 'options']
|
http_method_names = ['get', 'head', 'put', 'options']
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
return Manage.objects.filter(provider__user__username=self.request.user)
|
return Manage.objects.filter(provider__user__username=self.request.user) \
|
||||||
|
.filter(deleted=False)
|
||||||
|
|
||||||
class PriceViewSet(viewsets.ModelViewSet):
|
class PriceViewSet(viewsets.ModelViewSet):
|
||||||
lookup_field = 'uuid'
|
lookup_field = 'uuid'
|
||||||
|
|
|
@ -82,6 +82,8 @@ REST_FRAMEWORK = {
|
||||||
|
|
||||||
CORS_ORIGIN_WHITELIST = (
|
CORS_ORIGIN_WHITELIST = (
|
||||||
'localhost:3000',
|
'localhost:3000',
|
||||||
|
'caremyway.ca',
|
||||||
|
'www.caremyway.ca',
|
||||||
)
|
)
|
||||||
|
|
||||||
MIDDLEWARE = [
|
MIDDLEWARE = [
|
||||||
|
|
Loading…
Reference in New Issue
Block a user