Add Intents class
Remove `see_also` links from measurables elements (this will be change to a markdown editor with dynamic links) Update db through ipsg 2.2
This commit is contained in:
parent
0d837d5fa8
commit
1e6b35bec5
BIN
db.sqlite3
BIN
db.sqlite3
Binary file not shown.
11
jci/admin.py
11
jci/admin.py
|
@ -1,6 +1,6 @@
|
|||
from django.contrib import admin
|
||||
|
||||
from .models import Chapter, Section, Standard, Measurable
|
||||
from .models import Chapter, Section, Standard, Measurable, Intent
|
||||
|
||||
|
||||
class InlineStandard(admin.StackedInline):
|
||||
|
@ -14,11 +14,16 @@ class ChapterAdmin(admin.ModelAdmin):
|
|||
|
||||
|
||||
class StandardAdmin(admin.ModelAdmin):
|
||||
list_display = ('__str__', 'name', 'parent')
|
||||
list_display = ('__str__', 'name', 'require_written_procedure')
|
||||
list_filter = ('headline__acronym',)
|
||||
|
||||
|
||||
class IntentAdmin(admin.ModelAdmin):
|
||||
list_display = ('__str__',)
|
||||
|
||||
|
||||
admin.site.register(Intent, IntentAdmin)
|
||||
admin.site.register(Chapter, ChapterAdmin)
|
||||
admin.site.register(Standard, StandardAdmin)
|
||||
admin.site.register(Section)
|
||||
admin.site.register(Measurable)
|
||||
admin.site.register(Measurable)
|
|
@ -0,0 +1,24 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.5 on 2017-10-19 18:28
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('jci', '0019_measurable_content'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='measurable',
|
||||
name='linked_standards',
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='measurable',
|
||||
name='see_also',
|
||||
field=models.ManyToManyField(related_name='_measurable_see_also_+', to='jci.Measurable'),
|
||||
),
|
||||
]
|
|
@ -0,0 +1,33 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.5 on 2017-10-19 18:42
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('jci', '0020_auto_20171019_1828'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Intent',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('content', models.TextField(max_length=4000)),
|
||||
],
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='measurable',
|
||||
name='see_also',
|
||||
field=models.ManyToManyField(blank=True, related_name='_measurable_see_also_+', to='jci.Measurable'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='standard',
|
||||
name='intent',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='jci.Intent'),
|
||||
),
|
||||
]
|
|
@ -0,0 +1,24 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.5 on 2017-10-19 18:50
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('jci', '0021_auto_20171019_1842'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='measurable',
|
||||
name='see_also',
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='measurable',
|
||||
name='content',
|
||||
field=models.TextField(max_length=255),
|
||||
),
|
||||
]
|
|
@ -0,0 +1,24 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.5 on 2017-10-19 19:00
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('jci', '0022_auto_20171019_1850'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name='measurable',
|
||||
options={'ordering': ('standard__headline__acronym', 'standard__order', 'order')},
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='intent',
|
||||
name='content',
|
||||
field=models.TextField(max_length=16000),
|
||||
),
|
||||
]
|
|
@ -32,12 +32,22 @@ class Chapter(models.Model):
|
|||
ordering = ('name',)
|
||||
|
||||
|
||||
class Intent(models.Model):
|
||||
content = models.TextField(max_length=16000)
|
||||
|
||||
def __str__(self):
|
||||
if len(self.content) > 50:
|
||||
return self.content[0:50] + '...'
|
||||
return None
|
||||
|
||||
|
||||
class Standard(models.Model):
|
||||
name = models.CharField(max_length=255)
|
||||
headline = models.ForeignKey(Chapter, related_name='standards')
|
||||
order = models.CharField(max_length=50)
|
||||
parent = models.ForeignKey('self', null=True, blank=True)
|
||||
require_written_procedure = models.BooleanField(default=False)
|
||||
intent = models.ForeignKey(Intent, null=True, blank=True)
|
||||
|
||||
@property
|
||||
def structure(self):
|
||||
|
@ -52,9 +62,12 @@ class Standard(models.Model):
|
|||
|
||||
class Measurable(models.Model):
|
||||
standard = models.ForeignKey(Standard, related_name='measurables')
|
||||
see_also = models.ManyToManyField('self')
|
||||
order = models.IntegerField()
|
||||
content = models.CharField(max_length=255)
|
||||
content = models.TextField(max_length=255)
|
||||
|
||||
def __str__(self):
|
||||
return '{} ME {}'.format(self.standard, self.order)
|
||||
|
||||
class Meta:
|
||||
unique_together = ('standard', 'order')
|
||||
ordering = ('standard__headline__acronym', 'standard__order', 'order')
|
||||
|
|
Loading…
Reference in New Issue