mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-17 01:57:03 +02:00
model updates
This commit is contained in:
parent
1e98ba38b9
commit
c9c6890e7d
4 changed files with 35 additions and 67 deletions
|
@ -2464,6 +2464,23 @@ class VerifiedByStaffAdmin(ListHeaderAdmin):
|
|||
super().save_model(request, obj, form, change)
|
||||
|
||||
|
||||
class PortfolioAdmin(ListHeaderAdmin):
|
||||
# list_display = ("email", "requestor", "truncated_notes", "created_at")
|
||||
# search_fields = ["email"]
|
||||
# search_help_text = "Search by email."
|
||||
# readonly_fields = [
|
||||
# "requestor",
|
||||
# ]
|
||||
|
||||
# change_form_template = "django/admin/email_clipboard_change_form.html"
|
||||
|
||||
def save_model(self, request, obj, form, change):
|
||||
# Set the creator field to the current admin user
|
||||
obj.creator = request.user if request.user.is_authenticated else None
|
||||
super().save_model(request, obj, form, change)
|
||||
|
||||
|
||||
|
||||
class FederalAgencyAdmin(ListHeaderAdmin):
|
||||
list_display = ["agency"]
|
||||
search_fields = ["agency"]
|
||||
|
|
|
@ -59,14 +59,14 @@ class DomainInformation(TimeStampedModel):
|
|||
|
||||
|
||||
# portfolio
|
||||
portfolio = models.OneToOneField(
|
||||
"registrar.Portfolio",
|
||||
on_delete=models.PROTECT,
|
||||
null=True,
|
||||
blank=True,
|
||||
related_name="DomainRequest_portfolio",
|
||||
help_text="Portfolio associated with this domain",
|
||||
)
|
||||
# portfolio = models.OneToOneField(
|
||||
# "registrar.Portfolio",
|
||||
# on_delete=models.PROTECT,
|
||||
# null=True,
|
||||
# blank=True,
|
||||
# related_name="DomainRequest_portfolio",
|
||||
# help_text="Portfolio associated with this domain",
|
||||
# )
|
||||
|
||||
domain_request = models.OneToOneField(
|
||||
"registrar.DomainRequest",
|
||||
|
|
|
@ -287,14 +287,14 @@ class DomainRequest(TimeStampedModel):
|
|||
)
|
||||
|
||||
# portfolio
|
||||
portfolio = models.OneToOneField(
|
||||
"registrar.Portfolio",
|
||||
on_delete=models.PROTECT,
|
||||
null=True,
|
||||
blank=True,
|
||||
related_name="DomainInformation_portfolio",
|
||||
help_text="Portfolio associated with this domain",
|
||||
)
|
||||
# portfolio = models.OneToOneField(
|
||||
# "registrar.Portfolio",
|
||||
# on_delete=models.PROTECT,
|
||||
# null=True,
|
||||
# blank=True,
|
||||
# related_name="DomainInformation_portfolio",
|
||||
# help_text="Portfolio associated with this domain",
|
||||
# )
|
||||
|
||||
# This is the domain request user who created this domain request. The contact
|
||||
# information that they gave is in the `submitter` field
|
||||
|
|
|
@ -10,34 +10,13 @@ from .utility.time_stamped_model import TimeStampedModel
|
|||
|
||||
class Portfolio(TimeStampedModel):
|
||||
"""
|
||||
TODO:
|
||||
Portfolio is used for organizing domains/domain-requests into
|
||||
manageable groups.
|
||||
"""
|
||||
|
||||
class Meta:
|
||||
"""Contains meta information about this class"""
|
||||
|
||||
indexes = [
|
||||
models.Index(fields=["user"]),
|
||||
models.Index(fields=["email"]),
|
||||
]
|
||||
|
||||
|
||||
# use the short names in Django admin
|
||||
OrganizationChoices = DomainRequest.OrganizationChoices
|
||||
|
||||
# NOTE: This will be specified in a future ticket
|
||||
# class PortfolioTypes(models.TextChoices):
|
||||
# TYPE1 = "foo", "foo"
|
||||
# TYPE2 = "foo", "foo"
|
||||
# TYPE3 = "foo", "foo"
|
||||
# TYPE4 = "foo", "foo"
|
||||
|
||||
# NOTE: This will be specified in a future ticket
|
||||
# portfolio_type = models.TextField(
|
||||
# choices=PortfolioTypes.choices,
|
||||
# null=True,
|
||||
# blank=True,
|
||||
# )
|
||||
|
||||
# creator- user foreign key- stores who created this model should get the user who is adding
|
||||
# it via django admin if there is a user (aka not done via commandline/ manual means)"""
|
||||
|
@ -54,34 +33,6 @@ class Portfolio(TimeStampedModel):
|
|||
null=True,
|
||||
blank=True,
|
||||
)
|
||||
|
||||
# # domains- many to many to Domain field (nullable)
|
||||
# domains = models.ManyToManyField(
|
||||
# "registrar.Domain",
|
||||
# null=True,
|
||||
# blank=True,
|
||||
# related_name="portfolio domains",
|
||||
# verbose_name="portfolio domains",
|
||||
# # on_delete=models.PROTECT, # TODO: protect this?
|
||||
# )
|
||||
|
||||
# # domain_requests- Many to many to Domain Request field (nullable)
|
||||
# domain_requests = models.ManyToManyField(
|
||||
# "registrar.DomainRequest",
|
||||
# null=True,
|
||||
# blank=True,
|
||||
# related_name="portfolio domain requests",
|
||||
# verbose_name="portfolio domain requests",
|
||||
# # on_delete=models.PROTECT, # TODO: protect this?
|
||||
# )
|
||||
|
||||
# # organization
|
||||
# organization = models.OneToOneField(
|
||||
# "registrar.Organization",
|
||||
# null=True,
|
||||
# blank=True,
|
||||
# )
|
||||
|
||||
|
||||
# federal agency - FK to fed agency table (Not nullable, should default to the Non-federal agency value in the fed agency table)
|
||||
federal_agency = models.ForeignKey(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue