Compare commits
No commits in common. "a69e436da5c1572cddd3ab1ae5d3174e6bb05bb8" and "9d77a7d232e8d2712ecc9290b5746d4623fac39e" have entirely different histories.
a69e436da5
...
9d77a7d232
|
|
@ -24,6 +24,3 @@ dist/
|
||||||
# Installer logs
|
# Installer logs
|
||||||
pip-log.txt
|
pip-log.txt
|
||||||
pip-delete-this-directory.txt
|
pip-delete-this-directory.txt
|
||||||
|
|
||||||
# IDE stuff
|
|
||||||
.idea/
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
from .models import Issue
|
from .models import Project, Issue
|
||||||
|
|
||||||
|
admin.site.register(Project)
|
||||||
admin.site.register(Issue)
|
admin.site.register(Issue)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
# Generated by Django 2.2.1 on 2019-05-27 12:56
|
# Generated by Django 2.1.7 on 2019-03-20 22:34
|
||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
|
@ -10,7 +10,6 @@ class Migration(migrations.Migration):
|
||||||
initial = True
|
initial = True
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('projects', '0001_initial'),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
@ -21,7 +20,20 @@ class Migration(migrations.Migration):
|
||||||
('title', models.CharField(max_length=200)),
|
('title', models.CharField(max_length=200)),
|
||||||
('text', models.TextField(blank=True)),
|
('text', models.TextField(blank=True)),
|
||||||
('create_date', models.DateTimeField(default=django.utils.timezone.now)),
|
('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'),
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,14 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
|
||||||
from projects.models import Project
|
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
class Issue(models.Model):
|
class Issue(models.Model):
|
||||||
|
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
<h2>#{{ issue.id }}: {{ issue.title }}</h2>
|
|
||||||
<p>
|
|
||||||
<b>Project:</b> {{ issue.project }}<br/>
|
|
||||||
<b>Created:</b> {{ issue.create_date }}
|
|
||||||
</p>
|
|
||||||
<p>{{ issue.text }}</p>
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
{% if issue_list %}
|
|
||||||
<ul>
|
|
||||||
{% for issue in issue_list %}
|
|
||||||
<li>
|
|
||||||
<a href="{% url 'issues:detail' issue.id %}">{{ issue.title }}</a>
|
|
||||||
</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
{% else %}
|
|
||||||
<p>No issues.</p>
|
|
||||||
{% endif %}
|
|
||||||
|
|
@ -2,8 +2,6 @@ from django.urls import path
|
||||||
|
|
||||||
from . import views
|
from . import views
|
||||||
|
|
||||||
app_name = 'issues'
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('', views.index, name='index'),
|
path('', views.index, name='index')
|
||||||
path('<int:issue_id>/', views.detail, name='detail'),
|
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,6 @@
|
||||||
from django.shortcuts import get_object_or_404, render
|
# from django.shortcuts import render
|
||||||
|
from django.http import HttpResponse
|
||||||
from .models import Issue
|
|
||||||
|
|
||||||
|
|
||||||
def index(request):
|
def index(request):
|
||||||
issue_list = Issue.objects.order_by('create_date')
|
return HttpResponse('Hello Tofu.')
|
||||||
return render(request, 'issues/index.html', {
|
|
||||||
'issue_list': issue_list,
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
def detail(request, issue_id):
|
|
||||||
issue = get_object_or_404(Issue, pk=issue_id)
|
|
||||||
return render(request, 'issues/detail.html', {
|
|
||||||
'issue': issue,
|
|
||||||
})
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
from django.contrib import admin
|
|
||||||
|
|
||||||
from .models import Project
|
|
||||||
|
|
||||||
admin.site.register(Project)
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
from django.apps import AppConfig
|
|
||||||
|
|
||||||
|
|
||||||
class ProjectsConfig(AppConfig):
|
|
||||||
name = 'projects'
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
# 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)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
]
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
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
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
{% if project_list %}
|
|
||||||
<ul>
|
|
||||||
{% for project in project_list %}
|
|
||||||
<li>
|
|
||||||
<a href="{% url 'projects:view' project.project_key %}">{{ project.project_key }}: {{ project.name }}</a>
|
|
||||||
</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
{% else %}
|
|
||||||
<p>No projects.</p>
|
|
||||||
{% endif %}
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
<h2>{{ project.project_key }} - {{ project.name }}</h2>
|
|
||||||
<p>{{ project.description }}</p>
|
|
||||||
|
|
||||||
<h3>Issues</h3>
|
|
||||||
{% if issue_list %}
|
|
||||||
<ul>
|
|
||||||
{% for issue in issue_list %}
|
|
||||||
<li>
|
|
||||||
<a href="{% url 'issues:detail' issue.id %}">{{ issue.title }}</a>
|
|
||||||
</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
{% else %}
|
|
||||||
<p>This project has no issues yet.</p>
|
|
||||||
{% endif %}
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
from django.test import TestCase
|
|
||||||
|
|
||||||
# Create your tests here.
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
from django.urls import path
|
|
||||||
|
|
||||||
from . import views
|
|
||||||
|
|
||||||
app_name = 'projects'
|
|
||||||
urlpatterns = [
|
|
||||||
path('', views.index, name='index'),
|
|
||||||
path('<str:project_key>/', views.view, name='view'),
|
|
||||||
]
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
from django.shortcuts import get_object_or_404, render
|
|
||||||
|
|
||||||
from .models import Project
|
|
||||||
from issues.models import Issue
|
|
||||||
|
|
||||||
|
|
||||||
def index(request):
|
|
||||||
project_list = Project.objects.order_by('project_key')
|
|
||||||
return render(request, 'projects/index.html', {
|
|
||||||
'project_list': project_list,
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
def view(request, project_key):
|
|
||||||
project = get_object_or_404(Project, project_key=project_key)
|
|
||||||
issue_list = Issue.objects.filter(project=project.id).order_by('create_date')
|
|
||||||
return render(request, 'projects/view.html', {
|
|
||||||
'project': project,
|
|
||||||
'issue_list': issue_list,
|
|
||||||
})
|
|
||||||
|
|
@ -32,7 +32,6 @@ ALLOWED_HOSTS = []
|
||||||
|
|
||||||
INSTALLED_APPS = [
|
INSTALLED_APPS = [
|
||||||
'issues.apps.IssuesConfig',
|
'issues.apps.IssuesConfig',
|
||||||
'projects.apps.ProjectsConfig',
|
|
||||||
'django.contrib.admin',
|
'django.contrib.admin',
|
||||||
'django.contrib.auth',
|
'django.contrib.auth',
|
||||||
'django.contrib.contenttypes',
|
'django.contrib.contenttypes',
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,5 @@ from django.urls import include, path
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('issues/', include('issues.urls')),
|
path('issues/', include('issues.urls')),
|
||||||
path('projects/', include('projects.urls')),
|
|
||||||
path('admin/', admin.site.urls),
|
path('admin/', admin.site.urls),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
Reference in New Issue