add section and documentation
This commit is contained in:
parent
b6195b4dcd
commit
623bff7f35
|
@ -39,6 +39,7 @@ INSTALLED_APPS = [
|
|||
'django.contrib.staticfiles',
|
||||
'evolus',
|
||||
'jci',
|
||||
'crispy_forms',
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
|
|
|
@ -21,6 +21,6 @@ from jci.views import jci_list
|
|||
|
||||
urlpatterns = [
|
||||
url(r'^admin/', admin.site.urls),
|
||||
url(r'^search', documents_list),
|
||||
url(r'^docs/search', documents_list),
|
||||
url(r'^jci/list', jci_list)
|
||||
]
|
||||
|
|
BIN
db.sqlite3
BIN
db.sqlite3
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,20 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.5 on 2017-09-19 14:19
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('evolus', '0011_auto_20170918_1544'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='document',
|
||||
name='standards',
|
||||
field=models.ManyToManyField(related_name='documents', to='jci.Standard'),
|
||||
),
|
||||
]
|
|
@ -1,14 +1,16 @@
|
|||
from django.contrib import admin
|
||||
|
||||
from .models import Goal, Standard
|
||||
from .models import Goal, Section, Standard
|
||||
|
||||
|
||||
class GoalAdmin(admin.ModelAdmin):
|
||||
list_display = ('__str__', 'acronym', 'order')
|
||||
|
||||
|
||||
class StandardAdmin(admin.ModelAdmin):
|
||||
list_display = ('goal_acronym', 'structure', '__str__')
|
||||
|
||||
|
||||
admin.site.register(Goal, GoalAdmin)
|
||||
admin.site.register(Standard, StandardAdmin)
|
||||
admin.site.register(Section)
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.5 on 2017-09-19 14:19
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('jci', '0008_goal_acronym'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Section',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=255)),
|
||||
],
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='goal',
|
||||
name='name',
|
||||
field=models.CharField(max_length=255, unique=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='goal',
|
||||
name='section',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='jci.Section'),
|
||||
),
|
||||
]
|
|
@ -2,12 +2,23 @@ from django.db import models
|
|||
from closuretree.models import ClosureModel
|
||||
|
||||
|
||||
class Section(models.Model):
|
||||
name = models.CharField(max_length=255)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
class Meta:
|
||||
ordering = ('name',)
|
||||
|
||||
|
||||
class Goal(ClosureModel):
|
||||
name = models.CharField(max_length=50, unique=True)
|
||||
name = models.CharField(max_length=255, unique=True)
|
||||
parent = models.ForeignKey('self', related_name='children', null=True, blank=True)
|
||||
acronym = models.CharField(max_length=10, blank=True, null=True)
|
||||
overview = models.TextField(max_length=2000, null=True, blank=True)
|
||||
order = models.IntegerField(blank=True, null=True)
|
||||
section = models.ForeignKey(Section, null=True, blank=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
django<1.12
|
||||
django-closuretree<1.2
|
||||
django-filter==1.0.4
|
||||
django-crispy-forms==1.6.1
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
{% load crispy_forms_tags %}
|
||||
|
||||
<form action="" method="get">
|
||||
{{ filter.form.as_p }}
|
||||
<input type="submit" />
|
||||
|
|
Loading…
Reference in New Issue