aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorakhilbatra898 <akhil.batra@research.iiit.ac.in>2017-07-13 08:04:17 +0530
committerakhilbatra898 <akhil.batra@research.iiit.ac.in>2017-07-13 08:19:56 +0530
commit2e4a3dfc8b45ae6dc72aa85510ce920dbafe54ad (patch)
tree35b3060607141c93195dbecd4373f2b99b3355cd
parent80c314359380e4bf568486080e60ae0aaa25d507 (diff)
Define Database models
- 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>
-rw-r--r--.gitignore1
-rw-r--r--qtip/web/bench/admin.py18
-rw-r--r--qtip/web/bench/migrations/0001_initial.py36
-rw-r--r--qtip/web/bench/migrations/0002_auto_20170713_0210.py20
-rw-r--r--qtip/web/bench/migrations/0003_auto_20170713_0225.py20
-rw-r--r--qtip/web/bench/models.py24
-rw-r--r--qtip/web/web/settings.py1
7 files changed, 118 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index f2849f1e..9df6dccd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -54,6 +54,7 @@ data/my_key.pem
# Django stuff:
*.log
+*.sqlite3
# Sphinx documentation
docs/_build/
diff --git a/qtip/web/bench/admin.py b/qtip/web/bench/admin.py
index a3846a1b..1e678ad5 100644
--- a/qtip/web/bench/admin.py
+++ b/qtip/web/bench/admin.py
@@ -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
index 00000000..04736679
--- /dev/null
+++ b/qtip/web/bench/migrations/0001_initial.py
@@ -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
index 00000000..30c0cd63
--- /dev/null
+++ b/qtip/web/bench/migrations/0002_auto_20170713_0210.py
@@ -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
index 00000000..fec4234a
--- /dev/null
+++ b/qtip/web/bench/migrations/0003_auto_20170713_0225.py
@@ -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),
+ ),
+ ]
diff --git a/qtip/web/bench/models.py b/qtip/web/bench/models.py
index 1e8e4e1b..0594dbd9 100644
--- a/qtip/web/bench/models.py
+++ b/qtip/web/bench/models.py
@@ -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()
diff --git a/qtip/web/web/settings.py b/qtip/web/web/settings.py
index bc3ef992..30bb6e38 100644
--- a/qtip/web/web/settings.py
+++ b/qtip/web/web/settings.py
@@ -37,6 +37,7 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
+ 'bench.apps.BenchConfig',
]
MIDDLEWARE = [