-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
182 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,39 @@ | ||
from adminsortable2.admin import SortableInlineAdminMixin | ||
from modeltranslation.admin import TranslationStackedInline | ||
from modeltranslation.admin import TranslationAdmin, TranslationStackedInline | ||
|
||
from django.contrib import admin | ||
|
||
from sledilnik.utils import TranslationAdmin | ||
|
||
from . import models | ||
|
||
|
||
class MediaMixin: | ||
|
||
js = ( | ||
'https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js', | ||
'https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js', | ||
'modeltranslation/js/tabbed_translation_fields.js', | ||
) | ||
css = { | ||
'screen': ( | ||
'modeltranslation/css/tabbed_translation_fields.css', | ||
'faq/admin/easymde.css', | ||
), | ||
} | ||
|
||
|
||
class FaqInline(SortableInlineAdminMixin, TranslationStackedInline): | ||
model = models.Faq | ||
extra = 0 | ||
|
||
|
||
class GlossaryTermInline(SortableInlineAdminMixin, TranslationStackedInline): | ||
model = models.GlossaryTerm | ||
extra = 0 | ||
|
||
|
||
@admin.register(models.Project) | ||
class ProjectAdmin(TranslationAdmin): | ||
inlines = [FaqInline] | ||
inlines = [FaqInline, GlossaryTermInline] | ||
|
||
class Media(MediaMixin): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Generated by Django 3.1.7 on 2021-11-25 14:14 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
import sledilnik.easymde.models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('faq', '0004_auto_20211124_1515'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Glossary', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('position', models.PositiveIntegerField(default=0, verbose_name='Position')), | ||
('slug', models.SlugField(help_text='Used to reference the term in the text: <span data-term="slug">some term</span>', max_length=100, verbose_name='Slug')), | ||
('term', models.CharField(max_length=100, verbose_name='Term')), | ||
('definition', sledilnik.easymde.models.MarkdownField(verbose_name='Definition')), | ||
], | ||
options={ | ||
'ordering': ['position'], | ||
}, | ||
), | ||
migrations.AddConstraint( | ||
model_name='faq', | ||
constraint=models.UniqueConstraint(fields=('project', 'question'), name='unique_question_per_project'), | ||
), | ||
migrations.AddField( | ||
model_name='glossary', | ||
name='project', | ||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='glossary', to='faq.project', verbose_name='Project'), | ||
), | ||
migrations.AddConstraint( | ||
model_name='glossary', | ||
constraint=models.UniqueConstraint(fields=('project', 'slug'), name='unique_slug_per_project'), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Generated by Django 3.1.7 on 2021-11-25 14:15 | ||
|
||
from django.db import migrations, models | ||
import sledilnik.easymde.models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('faq', '0005_auto_20211125_1514'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='glossary', | ||
name='definition_en', | ||
field=sledilnik.easymde.models.MarkdownField(null=True, verbose_name='Definition'), | ||
), | ||
migrations.AddField( | ||
model_name='glossary', | ||
name='definition_sl', | ||
field=sledilnik.easymde.models.MarkdownField(null=True, verbose_name='Definition'), | ||
), | ||
migrations.AddField( | ||
model_name='glossary', | ||
name='term_en', | ||
field=models.CharField(max_length=100, null=True, verbose_name='Term'), | ||
), | ||
migrations.AddField( | ||
model_name='glossary', | ||
name='term_sl', | ||
field=models.CharField(max_length=100, null=True, verbose_name='Term'), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Generated by Django 3.1.7 on 2021-11-25 14:16 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('faq', '0006_auto_20211125_1515'), | ||
] | ||
|
||
operations = [ | ||
migrations.RenameModel( | ||
old_name='Glossary', | ||
new_name='GlossaryTerm', | ||
), | ||
migrations.AlterModelOptions( | ||
name='glossaryterm', | ||
options={'ordering': ['position'], 'verbose_name': 'Glossary term', 'verbose_name_plural': 'Glossary terms'}, | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 3.1.7 on 2021-11-25 14:19 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('faq', '0007_auto_20211125_1516'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='glossaryterm', | ||
name='slug', | ||
field=models.SlugField(help_text='Used to reference the glossary term in the FAQ text: <span data-term="slug">some term</span>', max_length=100, verbose_name='Slug'), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.CodeMirror-scroll { | ||
min-height: 3rem !important; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters