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

Uniqueness for judges and order outcomes #1443

Merged
merged 2 commits into from
Aug 15, 2023
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
10 changes: 9 additions & 1 deletion peachjam/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,8 @@ class DocumentNatureAdmin(admin.ModelAdmin):
@admin.register(Court)
class CourtAdmin(admin.ModelAdmin):
inlines = [EntityProfileInline]
list_display = ("name", "code")
search_fields = ("name", "code")


@admin.register(Author)
Expand Down Expand Up @@ -913,13 +915,19 @@ class LabelAdmin(admin.ModelAdmin):
class LocalityAdmin(admin.ModelAdmin):
list_display = ("name", "jurisdiction", "code")
prepopulated_fields = {"code": ("name",)}
search_fields = ("name", "code")


@admin.register(Judge)
class JudgeAdmin(admin.ModelAdmin):
list_display = ("name",)
search_fields = ("name",)


admin.site.register(
[
CitationLink,
Attorney,
Judge,
MatterType,
CourtClass,
AttachedFileNature,
Expand Down
51 changes: 51 additions & 0 deletions peachjam/migrations/0096_auto_20230814_1557.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Generated by Django 3.2.20 on 2023-08-14 15:57

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("peachjam", "0095_api_perms"),
]

operations = [
migrations.AlterField(
model_name="judge",
name="name",
field=models.CharField(max_length=1024, unique=True, verbose_name="name"),
),
migrations.AlterField(
model_name="orderoutcome",
name="name",
field=models.CharField(max_length=1024, unique=True, verbose_name="name"),
),
migrations.AlterField(
model_name="orderoutcome",
name="name_en",
field=models.CharField(
max_length=1024, null=True, unique=True, verbose_name="name"
),
),
migrations.AlterField(
model_name="orderoutcome",
name="name_fr",
field=models.CharField(
max_length=1024, null=True, unique=True, verbose_name="name"
),
),
migrations.AlterField(
model_name="orderoutcome",
name="name_pt",
field=models.CharField(
max_length=1024, null=True, unique=True, verbose_name="name"
),
),
migrations.AlterField(
model_name="orderoutcome",
name="name_sw",
field=models.CharField(
max_length=1024, null=True, unique=True, verbose_name="name"
),
),
]
8 changes: 6 additions & 2 deletions peachjam/models/judgment.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ def __str__(self):


class Judge(models.Model):
name = models.CharField(_("name"), max_length=1024, null=False, blank=False)
name = models.CharField(
_("name"), max_length=1024, null=False, blank=False, unique=True
)
description = models.TextField(_("description"), blank=True)

class Meta:
Expand All @@ -39,7 +41,9 @@ def __str__(self):


class OrderOutcome(models.Model):
name = models.CharField(_("name"), max_length=1024, null=False, blank=False)
name = models.CharField(
_("name"), max_length=1024, null=False, blank=False, unique=True
)
description = models.TextField(_("description"), blank=True)

class Meta:
Expand Down
Loading