Merge remote-tracking branch 'origin/documentation'
This commit is contained in:
commit
6a8d50ceba
|
@ -18,12 +18,17 @@ class WorkTypeSerializer(serializers.ModelSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = WorkType
|
model = WorkType
|
||||||
fields = ('uuid', 'color', 'label', 'deleted')
|
fields = ('uuid', 'color', 'label', 'deleted')
|
||||||
read_only_fields =('deleted',)
|
read_only_fields = ('deleted',)
|
||||||
|
|
||||||
def create(self, validated_data):
|
def create(self, validated_data):
|
||||||
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)
|
||||||
|
@ -32,7 +37,7 @@ class PriceSerializer(serializers.ModelSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Price
|
model = Price
|
||||||
fields = ('uuid', 'get_employee_uuid', 'get_work_type_uuid', 'work_type', 'amount', 'deleted')
|
fields = ('uuid', 'get_employee_uuid', 'get_work_type_uuid', 'work_type', 'amount', 'deleted')
|
||||||
read_only_fields =('deleted',)
|
read_only_fields = ('deleted',)
|
||||||
depth = 1
|
depth = 1
|
||||||
|
|
||||||
def create(self, validated_data):
|
def create(self, validated_data):
|
||||||
|
|
|
@ -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