Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warnings coming from models #200

Merged
merged 2 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/webmon_app/reporting/dasmon/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class ActiveInstrument(models.Model):
have their DAS turned ON
"""

instrument_id = models.ForeignKey(Instrument, unique=True, on_delete=models.CASCADE)
instrument_id = models.OneToOneField(Instrument, on_delete=models.CASCADE)
is_alive = models.BooleanField(default=True)
is_adara = models.BooleanField(default=True)
has_pvsd = models.BooleanField(default=False)
Expand All @@ -123,7 +123,7 @@ class LegacyURL(models.Model):
Table of URLs pointing to the legacy instrument status service
"""

instrument_id = models.ForeignKey(Instrument, unique=True, on_delete=models.CASCADE)
instrument_id = models.OneToOneField(Instrument, on_delete=models.CASCADE)
url = models.CharField(max_length=128)
long_name = models.CharField(max_length=40)

Expand Down
2 changes: 1 addition & 1 deletion src/webmon_app/reporting/reduction/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class PropertyDefault(models.Model):
Table of default values
"""

property = models.ForeignKey(ReductionProperty, unique=True, on_delete=models.CASCADE)
property = models.OneToOneField(ReductionProperty, on_delete=models.CASCADE)
value = models.TextField(blank=True)
timestamp = models.DateTimeField("timestamp", auto_now=True)

Expand Down
3 changes: 3 additions & 0 deletions src/webmon_app/reporting/reporting_app/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,3 +366,6 @@ def validate_ldap_settings(server_uri, user_dn_template):
TEST_REMOTE_PASSWD = ""

GRAVATAR_URL = "https://www.gravatar.com/avatar/"

# set the default auto field type
DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
4 changes: 2 additions & 2 deletions src/workflow_app/workflow/database/report/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ class WorkflowSummary(models.Model):
Overall status of the workflow for a given run
"""

run_id = models.ForeignKey(DataRun, unique=True, on_delete=models.CASCADE)
run_id = models.OneToOneField(DataRun, on_delete=models.CASCADE)

# Overall status of the workflow for this run
complete = models.BooleanField(default=False)
Expand Down Expand Up @@ -521,7 +521,7 @@ class InstrumentStatus(models.Model):
This can be used to quickly access status information.
"""

instrument_id = models.ForeignKey(Instrument, unique=True, on_delete=models.CASCADE)
instrument_id = models.OneToOneField(Instrument, on_delete=models.CASCADE)
last_run_id = models.ForeignKey(DataRun, null=True, on_delete=models.CASCADE)

class Meta:
Expand Down
Loading