added created by to tests

This commit is contained in:
Hubert Jankowski 2022-01-22 19:58:42 +01:00
parent a469c6708f
commit 3570522946
3 changed files with 27 additions and 1 deletions

View File

@ -4,7 +4,6 @@
{% block content %} {% block content %}
<h1>Check your tests</h1> <h1>Check your tests</h1>
{{ tests }}
{% for test in tests %} {% for test in tests %}
<div class="mainTestContainer"> <div class="mainTestContainer">
<div class="mainTestName"> <div class="mainTestName">

View File

@ -0,0 +1,21 @@
# Generated by Django 3.2.9 on 2022-01-22 18:57
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('trials', '0009_auto_20220122_1942'),
]
operations = [
migrations.AddField(
model_name='test',
name='created_by',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='tests', to=settings.AUTH_USER_MODEL),
),
]

View File

@ -12,6 +12,12 @@ class Test(models.Model):
# related_name="tests" # related_name="tests"
# ) # )
category = models.CharField(max_length=100) category = models.CharField(max_length=100)
created_by = models.ForeignKey(
"users.User",
null=True,
related_name="tests",
on_delete=models.CASCADE
)
objects = TestManager() objects = TestManager()