Skip to content

Commit

Permalink
Merge pull request #469 from NASA-IMPACT/455-update-treeroots-to-only…
Browse files Browse the repository at this point in the history
…-contain-the-divisionname-of-the-collection

Update treeroots to only contain the division/name of the collection
  • Loading branch information
code-geek authored Oct 18, 2023
2 parents 1597046 + 0212170 commit e446f81
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 4.2.6 on 2023-10-18 15:35

from django.db import migrations


class Migration(migrations.Migration):
dependencies = [
("sde_collections", "0033_alter_collection_config_folder"),
]

operations = [
migrations.RenameField(
model_name="collection",
old_name="tree_root",
new_name="tree_root_deprecated",
),
]
8 changes: 7 additions & 1 deletion sde_collections/models/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ class Collection(models.Model):
document_type = models.IntegerField(
choices=DocumentTypes.choices, null=True, blank=True
)
tree_root = models.CharField("Tree Root", max_length=1024, default="", blank=True)
tree_root_deprecated = models.CharField(
"Tree Root", max_length=1024, default="", blank=True
)
delete = models.BooleanField(default=False)

# audit columns for production
Expand Down Expand Up @@ -96,6 +98,10 @@ class Meta:
verbose_name = "Collection"
verbose_name_plural = "Collections"

@property
def tree_root(self) -> str:
return f"{self.get_division_display()}/{self.name}/"

@property
def server_url_test(self) -> str:
base_url = "https://sciencediscoveryengine.test.nasa.gov"
Expand Down

0 comments on commit e446f81

Please sign in to comment.