Skip to content

Commit

Permalink
Index status on candidates and organizations
Browse files Browse the repository at this point in the history
  • Loading branch information
tudoramariei committed Jul 9, 2024
1 parent 50f2629 commit 1a05bf2
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Generated by Django 4.2.13 on 2024-07-09 11:55

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("hub", "0052_alter_organization_logo"),
]

operations = [
migrations.AlterField(
model_name="candidate",
name="status",
field=models.CharField(
choices=[("pending", "Pending"), ("accepted", "Accepted"), ("rejected", "Rejected")],
db_index=True,
default="pending",
max_length=30,
verbose_name="Status",
),
),
migrations.AlterField(
model_name="organization",
name="status",
field=models.CharField(
choices=[
("draft", "Draft"),
("pending", "Pending approval"),
("accepted", "Accepted"),
("rejected", "Rejected"),
],
db_index=True,
default="draft",
max_length=30,
verbose_name="Status",
),
),
]
2 changes: 2 additions & 0 deletions backend/hub/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ class Organization(StatusModel, TimeStampedModel):
# ("ineligible", _("Ineligible to vote")),
# ("disabled", _("Disabled")),
)
status = models.CharField(_("Status"), choices=STATUS, default=STATUS.draft, max_length=30, db_index=True)

user = models.ForeignKey(
settings.AUTH_USER_MODEL, on_delete=models.SET_NULL, null=True, blank=True, related_name="orgs"
Expand Down Expand Up @@ -483,6 +484,7 @@ class Candidate(StatusModel, TimeStampedModel):
("accepted", _("Accepted")),
("rejected", _("Rejected")),
)
status = models.CharField(_("Status"), choices=STATUS, default=STATUS.pending, max_length=30, db_index=True)

org = models.OneToOneField(Organization, on_delete=models.CASCADE, related_name="candidate", null=True, blank=True)
initial_org = models.ForeignKey(
Expand Down

0 comments on commit 1a05bf2

Please sign in to comment.