diff --git a/issues/admin.py b/issues/admin.py index 034f76d..dfbf979 100644 --- a/issues/admin.py +++ b/issues/admin.py @@ -1,6 +1,5 @@ from django.contrib import admin -from .models import Project, Issue +from .models import Issue -admin.site.register(Project) admin.site.register(Issue) diff --git a/issues/migrations/0001_initial.py b/issues/migrations/0001_initial.py index e9e18f9..82fb950 100644 --- a/issues/migrations/0001_initial.py +++ b/issues/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 2.1.7 on 2019-03-20 22:34 +# Generated by Django 2.2.1 on 2019-05-27 12:56 from django.db import migrations, models import django.db.models.deletion @@ -10,6 +10,7 @@ class Migration(migrations.Migration): initial = True dependencies = [ + ('projects', '0001_initial'), ] operations = [ @@ -20,20 +21,7 @@ class Migration(migrations.Migration): ('title', models.CharField(max_length=200)), ('text', models.TextField(blank=True)), ('create_date', models.DateTimeField(default=django.utils.timezone.now)), + ('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='projects.Project')), ], ), - migrations.CreateModel( - name='Project', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('project_key', models.CharField(max_length=16, unique=True)), - ('name', models.CharField(max_length=200)), - ('description', models.TextField(blank=True)), - ], - ), - migrations.AddField( - model_name='issue', - name='project', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='issues.Project'), - ), ] diff --git a/issues/models.py b/issues/models.py index cc04388..180923f 100644 --- a/issues/models.py +++ b/issues/models.py @@ -1,14 +1,7 @@ from django.db import models from django.utils import timezone - -class Project(models.Model): - project_key = models.CharField(max_length=16, unique=True) - name = models.CharField(max_length=200) - description = models.TextField(blank=True) - - def __str__(self): - return self.name +from projects.models import Project class Issue(models.Model): diff --git a/projects/__init__.py b/projects/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/projects/admin.py b/projects/admin.py new file mode 100644 index 0000000..badc1bb --- /dev/null +++ b/projects/admin.py @@ -0,0 +1,5 @@ +from django.contrib import admin + +from .models import Project + +admin.site.register(Project) diff --git a/projects/apps.py b/projects/apps.py new file mode 100644 index 0000000..3ef44de --- /dev/null +++ b/projects/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class ProjectsConfig(AppConfig): + name = 'projects' diff --git a/projects/migrations/0001_initial.py b/projects/migrations/0001_initial.py new file mode 100644 index 0000000..55089c4 --- /dev/null +++ b/projects/migrations/0001_initial.py @@ -0,0 +1,23 @@ +# Generated by Django 2.2.1 on 2019-05-27 12:56 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Project', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('project_key', models.CharField(max_length=16, unique=True)), + ('name', models.CharField(max_length=200)), + ('description', models.TextField(blank=True)), + ], + ), + ] diff --git a/projects/migrations/__init__.py b/projects/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/projects/models.py b/projects/models.py new file mode 100644 index 0000000..c6ba458 --- /dev/null +++ b/projects/models.py @@ -0,0 +1,10 @@ +from django.db import models + + +class Project(models.Model): + project_key = models.CharField(max_length=16, unique=True) + name = models.CharField(max_length=200) + description = models.TextField(blank=True) + + def __str__(self): + return self.name diff --git a/projects/templates/projects/index.html b/projects/templates/projects/index.html new file mode 100644 index 0000000..b64c0da --- /dev/null +++ b/projects/templates/projects/index.html @@ -0,0 +1,11 @@ +{% if project_list %} +
No projects.
+{% endif %} \ No newline at end of file diff --git a/projects/templates/projects/view.html b/projects/templates/projects/view.html new file mode 100644 index 0000000..e38e16f --- /dev/null +++ b/projects/templates/projects/view.html @@ -0,0 +1,15 @@ +{{ project.description }}
+ +This project has no issues yet.
+{% endif %} \ No newline at end of file diff --git a/projects/tests.py b/projects/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/projects/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/projects/urls.py b/projects/urls.py new file mode 100644 index 0000000..d53296a --- /dev/null +++ b/projects/urls.py @@ -0,0 +1,9 @@ +from django.urls import path + +from . import views + +app_name = 'projects' +urlpatterns = [ + path('', views.index, name='index'), + path('