Define Database models 89/37289/2
authorakhilbatra898 <akhil.batra@research.iiit.ac.in>
Thu, 13 Jul 2017 02:34:17 +0000 (08:04 +0530)
committerakhilbatra898 <akhil.batra@research.iiit.ac.in>
Thu, 13 Jul 2017 02:49:56 +0000 (08:19 +0530)
 - Add dbfile to gitignore
 - Add models Repo and Task
 - Register models for Django Admin

Change-Id: I46f23b0cb4deba2efc874cceb93251010ebb2860
Signed-off-by: akhilbatra898 <akhil.batra@research.iiit.ac.in>
.gitignore
qtip/web/bench/admin.py
qtip/web/bench/migrations/0001_initial.py [new file with mode: 0644]
qtip/web/bench/migrations/0002_auto_20170713_0210.py [new file with mode: 0644]
qtip/web/bench/migrations/0003_auto_20170713_0225.py [new file with mode: 0644]
qtip/web/bench/models.py
qtip/web/web/settings.py

index f2849f1..9df6dcc 100644 (file)
@@ -54,6 +54,7 @@ data/my_key.pem
 
 # Django stuff:
 *.log
+*.sqlite3
 
 # Sphinx documentation
 docs/_build/
index a3846a1..1e678ad 100644 (file)
@@ -1,6 +1,22 @@
+##############################################################################
+# Copyright (c) 2017 akhil.batra@research.iiit.ac.in and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
 # -*- coding: utf-8 -*-
+
 from __future__ import unicode_literals
 
-# from django.contrib import admin
+from django.contrib import admin
+
+import models
 
 # Register your models here.
+
+
+admin.site.register(models.Repo)
+admin.site.register(models.Task)
diff --git a/qtip/web/bench/migrations/0001_initial.py b/qtip/web/bench/migrations/0001_initial.py
new file mode 100644 (file)
index 0000000..0473667
--- /dev/null
@@ -0,0 +1,36 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.3 on 2017-07-13 01:36
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+    initial = True
+
+    dependencies = [
+    ]
+
+    operations = [
+        migrations.CreateModel(
+            name='Repo',
+            fields=[
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+                ('name', models.CharField(max_length=200)),
+                ('github_link', models.URLField()),
+            ],
+        ),
+        migrations.CreateModel(
+            name='Task',
+            fields=[
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+                ('start_time', models.DateTimeField(auto_now_add=True)),
+                ('end_time', models.DateTimeField()),
+                ('run_time', models.DurationField()),
+                ('log', models.TextField()),
+                ('repo', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='bench.Repo')),
+            ],
+        ),
+    ]
diff --git a/qtip/web/bench/migrations/0002_auto_20170713_0210.py b/qtip/web/bench/migrations/0002_auto_20170713_0210.py
new file mode 100644 (file)
index 0000000..30c0cd6
--- /dev/null
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.3 on 2017-07-13 02:10
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('bench', '0001_initial'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='repo',
+            name='github_link',
+            field=models.URLField(unique=True),
+        ),
+    ]
diff --git a/qtip/web/bench/migrations/0003_auto_20170713_0225.py b/qtip/web/bench/migrations/0003_auto_20170713_0225.py
new file mode 100644 (file)
index 0000000..fec4234
--- /dev/null
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.3 on 2017-07-13 02:25
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('bench', '0002_auto_20170713_0210'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='repo',
+            name='name',
+            field=models.CharField(max_length=20),
+        ),
+    ]
index 1e8e4e1..0594dbd 100644 (file)
@@ -1,6 +1,28 @@
+##############################################################################
+# Copyright (c) 2017 akhil.batra@research.iiit.ac.in and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
 # -*- coding: utf-8 -*-
 from __future__ import unicode_literals
 
-from django.db import models
+from django.db import models
 
 # Create your models here.
+
+
+class Repo(models.Model):
+    name = models.CharField(max_length=200, blank=False)
+    github_link = models.URLField(unique=True)
+
+
+class Task(models.Model):
+    start_time = models.DateTimeField(auto_now_add=True)
+    end_time = models.DateTimeField()
+    run_time = models.DurationField()
+    repo = models.ForeignKey('Repo', on_delete=models.DO_NOTHING)
+    log = models.TextField()
index bc3ef99..30bb6e3 100644 (file)
@@ -37,6 +37,7 @@ INSTALLED_APPS = [
     'django.contrib.sessions',
     'django.contrib.messages',
     'django.contrib.staticfiles',
+    'bench.apps.BenchConfig',
 ]
 
 MIDDLEWARE = [