Skip to content

Commit

Permalink
tasotarkistus: field permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
NC-jsAhonen committed Dec 2, 2024
1 parent 7ea4fcd commit 057ceff
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
9 changes: 9 additions & 0 deletions leasing/management/commands/set_group_field_permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,15 @@
6: "view",
7: "change",
},
"old_dwellings_in_housing_companies_price_index": {
1: "view",
2: "view",
3: "view",
4: "view",
5: "view",
6: "view",
7: "change",
},
},
"tenant": {"reference": {6: "change"}, "tenantcontact_set": {6: "change"}},
"leasearea": {
Expand Down
9 changes: 9 additions & 0 deletions leasing/management/commands/set_group_model_permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -973,6 +973,15 @@
6: ("view",),
7: ("view", "add", "change", "delete"),
},
"olddwellingsinhousingcompaniespriceindex": {
1: ("view",),
2: ("view",),
3: ("view",),
4: ("view",),
5: ("view",),
6: ("view",),
7: ("view", "add", "change", "delete"),
},
"uidata": {
1: ("view", "add", "change", "delete"),
2: ("view", "add", "change", "delete"),
Expand Down
14 changes: 13 additions & 1 deletion leasing/serializers/rent.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ class Meta:
fields = ("id", "value", "year", "region", "comment")


class OldDwellingsInHousingCompaniesPriceIndexSerializer(serializers.ModelSerializer):
class OldDwellingsInHousingCompaniesPriceIndexSerializer(
FieldPermissionsSerializerMixin, serializers.ModelSerializer
):
id = serializers.IntegerField(required=False)
point_figures = IndexPointFigureYearlySerializer(
many=True, required=False, allow_null=True
)
Expand Down Expand Up @@ -489,6 +492,7 @@ class Meta:
"manual_ratio",
"manual_ratio_previous",
"override_receivable_type",
"old_dwellings_in_housing_companies_price_index",
)


Expand Down Expand Up @@ -523,6 +527,13 @@ class RentCreateUpdateSerializer(
required=False,
allow_null=True,
)
old_dwellings_in_housing_companies_price_index = InstanceDictPrimaryKeyRelatedField(
instance_class=OldDwellingsInHousingCompaniesPriceIndex,
queryset=OldDwellingsInHousingCompaniesPriceIndex.objects.all(),
related_serializer=OldDwellingsInHousingCompaniesPriceIndexSerializer,
required=False,
allow_null=True,
)

class Meta:
model = Rent
Expand Down Expand Up @@ -554,6 +565,7 @@ class Meta:
"manual_ratio",
"manual_ratio_previous",
"override_receivable_type",
"old_dwellings_in_housing_companies_price_index",
)

def validate(self, rent_data: dict):
Expand Down

0 comments on commit 057ceff

Please sign in to comment.