mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-20 17:56:11 +02:00
Merge pull request #1610 from cisagov/ab/hotfix-staging-unique-hosts
HOTFIX- staging changing host names to not be unique
This commit is contained in:
commit
8b06b38dbf
3 changed files with 24 additions and 2 deletions
|
@ -401,6 +401,8 @@ class HostIPInline(admin.StackedInline):
|
|||
class MyHostAdmin(AuditedAdmin):
|
||||
"""Custom host admin class to use our inlines."""
|
||||
|
||||
search_fields = ["name", "domain__name"]
|
||||
search_help_text = "Search by domain or hostname."
|
||||
inlines = [HostIPInline]
|
||||
|
||||
|
||||
|
@ -1252,7 +1254,7 @@ admin.site.register(models.Domain, DomainAdmin)
|
|||
admin.site.register(models.DraftDomain, DraftDomainAdmin)
|
||||
# Host and HostIP removed from django admin because changes in admin
|
||||
# do not propagate to registry and logic not applied
|
||||
# admin.site.register(models.Host, MyHostAdmin)
|
||||
admin.site.register(models.Host, MyHostAdmin)
|
||||
admin.site.register(models.Website, WebsiteAdmin)
|
||||
admin.site.register(models.PublicContact, AuditedAdmin)
|
||||
admin.site.register(models.DomainApplication, DomainApplicationAdmin)
|
||||
|
|
17
src/registrar/migrations/0062_alter_host_name.py
Normal file
17
src/registrar/migrations/0062_alter_host_name.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
# Generated by Django 4.2.7 on 2024-01-09 02:32
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("registrar", "0061_domain_security_contact_registry_id"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="host",
|
||||
name="name",
|
||||
field=models.CharField(default=None, help_text="Fully qualified domain name", max_length=253),
|
||||
),
|
||||
]
|
|
@ -20,7 +20,7 @@ class Host(TimeStampedModel):
|
|||
null=False,
|
||||
blank=False,
|
||||
default=None, # prevent saving without a value
|
||||
unique=True,
|
||||
unique=False,
|
||||
help_text="Fully qualified domain name",
|
||||
)
|
||||
|
||||
|
@ -30,3 +30,6 @@ class Host(TimeStampedModel):
|
|||
related_name="host", # access this Host via the Domain as `domain.host`
|
||||
help_text="Domain to which this host belongs",
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.domain.name} {self.name}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue