Skip to content

Commit

Permalink
Get forms working by fixing duplicate fields - prep for next DB
Browse files Browse the repository at this point in the history
migration
  • Loading branch information
rmarow committed Oct 15, 2024
1 parent e55447b commit bb74b2d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
10 changes: 5 additions & 5 deletions usaon_benefit_tool/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
Link,
Node,
NodeSubtypeOther,
# NodeSubtypeSocietalBenefitArea,
NodeSubtypeSocietalBenefitArea,
User,
)

Expand Down Expand Up @@ -113,10 +113,10 @@ def get_node_label(node: Node) -> str:
NodeSubtypeOther,
exclude=node_exclude,
),
# NodeSubtypeSocietalBenefitArea: model_form(
# NodeSubtypeSocietalBenefitArea,
# # exclude=node_exclude,
# ),
NodeSubtypeSocietalBenefitArea: model_form(
NodeSubtypeSocietalBenefitArea,
exclude=node_exclude,
),
User: model_form(
User,
only=['orcid', 'biography', 'affiliation', 'role'],
Expand Down
12 changes: 2 additions & 10 deletions usaon_benefit_tool/models/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ class NodeSubtypeSocietalBenefitArea(Node):
"""Fields that are specific to societal benefit area type nodes."""

__tablename__ = "node_subtype_societal_benefit_area"
__table_args__ = (UniqueConstraint('societal_benefit_area_id'),)
# __table_args__ = (UniqueConstraint('societal_benefit_area_id'),)
__mapper_args__: ClassVar = {
'polymorphic_identity': NodeTypeDiscriminator.SOCIETAL_BENEFIT_AREA.value,
}
Expand All @@ -257,20 +257,12 @@ class NodeSubtypeSocietalBenefitArea(Node):
nullable=False,
)

societal_benefit_area_id = Column(
String,
ForeignKey('societal_benefit_area.id'),
nullable=False,
)
name = Column(String(512), nullable=True)
short_name = Column(String(256), nullable=True)
description = Column(String, nullable=True)
framework_name = Column(String(256), nullable=True)
framework_url = Column(String(512), nullable=True)

# TODO: Relationship to societal benefit area table? How would we make a similar
# relationship for the other node types?
societal_benefit_area = relationship("SocietalBenefitArea")
# societal_benefit_area = relationship("SocietalBenefitArea")


class AssessmentNode(BaseModel):
Expand Down

0 comments on commit bb74b2d

Please sign in to comment.