Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unique constraint from land use agreement estate ids #188

Merged
merged 1 commit into from
Dec 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions leasing/migrations/0026_land_use_agreement_estate_remove_unique.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 2.2.13 on 2020-12-03 11:55

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("leasing", "0025_landuseagreement_improvements"),
]

operations = [
migrations.AlterField(
model_name="landuseagreementestate",
name="estate_id",
field=models.CharField(max_length=50, verbose_name="Estate id"),
),
]
4 changes: 1 addition & 3 deletions leasing/models/land_use_agreement.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,7 @@ class LandUseAgreementEstate(NameModel):
on_delete=models.CASCADE,
)

estate_id = models.CharField(
verbose_name=_("Estate id"), max_length=50, unique=True
)
estate_id = models.CharField(verbose_name=_("Estate id"), max_length=50)


class LandUseAgreementDecisionType(NameModel):
Expand Down
16 changes: 14 additions & 2 deletions leasing/serializers/land_use_agreement.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,21 @@ class Meta:
class LandUseAgreementEstateSerializer(
FieldPermissionsSerializerMixin, serializers.ModelSerializer
):
id = serializers.ReadOnlyField()

class Meta:
model = LandUseAgreementEstate
fields = ("estate_id",)
fields = ("id", "estate_id")


class LandUseAgreementEstateCreateUpdateSerializer(
FieldPermissionsSerializerMixin, serializers.ModelSerializer
):
id = serializers.IntegerField(required=False)

class Meta:
model = LandUseAgreementEstate
fields = ("id", "estate_id")


class LandUseAgreementLitigantContactSerializer(
Expand Down Expand Up @@ -407,7 +419,7 @@ class LandUseAgreementUpdateSerializer(
required=False,
allow_null=True,
)
estate_ids = LandUseAgreementEstateSerializer(
estate_ids = LandUseAgreementEstateCreateUpdateSerializer(
many=True, required=False, allow_null=True
)
addresses = LandUseAgreementAddressSerializer(
Expand Down