Browse Source

Add score field to Example model

pull/2028/head
Hironsan 2 years ago
parent
commit
de3678ea8e
3 changed files with 20 additions and 0 deletions
  1. 18
      backend/examples/migrations/0007_example_score.py
  2. 1
      backend/examples/models.py
  3. 1
      backend/examples/serializers.py

18
backend/examples/migrations/0007_example_score.py

@ -0,0 +1,18 @@
# Generated by Django 4.0.7 on 2022-10-21 07:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("examples", "0006_alter_example_upload_name"),
]
operations = [
migrations.AddField(
model_name="example",
name="score",
field=models.FloatField(default=100),
),
]

1
backend/examples/models.py

@ -18,6 +18,7 @@ class Example(models.Model):
project = models.ForeignKey(to=Project, on_delete=models.CASCADE, related_name="examples")
annotations_approved_by = models.ForeignKey(to=User, on_delete=models.SET_NULL, null=True, blank=True)
text = models.TextField(null=True, blank=True)
score = models.FloatField(default=100)
created_at = models.DateTimeField(auto_now_add=True, db_index=True)
updated_at = models.DateTimeField(auto_now=True)

1
backend/examples/serializers.py

@ -45,6 +45,7 @@ class ExampleSerializer(serializers.ModelSerializer):
"text",
"is_confirmed",
"upload_name",
"score",
]
read_only_fields = ["filename", "is_confirmed", "upload_name"]

Loading…
Cancel
Save