Resond to PR feedback

This commit is contained in:
Seamus Johnston 2023-06-01 11:27:38 -05:00
parent 5b78b0ec67
commit 1cd74ebda5
No known key found for this signature in database
GPG key ID: 2F21225985069105
2 changed files with 19 additions and 7 deletions

View file

@ -1,12 +1,13 @@
# Generated by Django 4.2.1 on 2023-05-26 19:21 # Generated by Django 4.2.1 on 2023-06-01 15:23
from django.db import migrations, models from django.db import migrations
import django_fsm # type: ignore
import registrar.models.utility.domain_field import registrar.models.utility.domain_field
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
("registrar", "0022_draftdomain_domainapplication_approved_domain_and_more"), ("registrar", "0023_alter_contact_first_name_alter_contact_last_name_and_more"),
] ]
operations = [ operations = [
@ -21,7 +22,7 @@ class Migration(migrations.Migration):
migrations.AddField( migrations.AddField(
model_name="domain", model_name="domain",
name="state", name="state",
field=models.CharField( field=django_fsm.FSMField(
choices=[ choices=[
("created", "Created"), ("created", "Created"),
("deleted", "Deleted"), ("deleted", "Deleted"),
@ -30,6 +31,7 @@ class Migration(migrations.Migration):
default="unknown", default="unknown",
help_text="Very basic info about the lifecycle of this domain object", help_text="Very basic info about the lifecycle of this domain object",
max_length=21, max_length=21,
protected=True,
), ),
), ),
migrations.AlterField( migrations.AlterField(

View file

@ -1,6 +1,7 @@
import logging import logging
from datetime import date from datetime import date
from django_fsm import FSMField # type: ignore
from django.db import models from django.db import models
@ -125,7 +126,8 @@ class Domain(TimeStampedModel, DomainHelper):
IDs are provided as strings, e.g. IDs are provided as strings, e.g.
{"registrant": "jd1234", "admin": "sh8013",...} { PublicContact.ContactTypeChoices.REGISTRANT: "jd1234",
PublicContact.ContactTypeChoices.ADMINISTRATIVE: "sh8013",...}
""" """
raise NotImplementedError() raise NotImplementedError()
@ -155,7 +157,14 @@ class Domain(TimeStampedModel, DomainHelper):
@property @property
def password(self) -> str: def password(self) -> str:
"""Get the `auth_info.pw` element from the registry. Not a real password.""" """
Get the `auth_info.pw` element from the registry. Not a real password.
This `auth_info` element is required by the EPP protocol, but the registry is
using a different mechanism to ensure unauthorized clients cannot perform
actions on domains they do not own. This field provides no security features.
It is not a secret.
"""
raise NotImplementedError() raise NotImplementedError()
@property @property
@ -275,10 +284,11 @@ class Domain(TimeStampedModel, DomainHelper):
help_text="Fully qualified domain name", help_text="Fully qualified domain name",
) )
state = models.CharField( state = FSMField(
max_length=21, max_length=21,
choices=State.choices, choices=State.choices,
default=State.UNKNOWN, default=State.UNKNOWN,
protected=True, # cannot change state directly, particularly in Django admin
help_text="Very basic info about the lifecycle of this domain object", help_text="Very basic info about the lifecycle of this domain object",
) )