A src/wiki/migrations/0004_article_inherited_from.py => src/wiki/migrations/0004_article_inherited_from.py +19 -0
@@ 0,0 1,19 @@
+# Generated by Django 2.2.12 on 2020-05-15 12:59
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('wiki', '0003_article_search_vector'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='article',
+ name='inherited_from',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='inherit_children', to='wiki.Article'),
+ ),
+ ]
M src/wiki/models/article.py => src/wiki/models/article.py +5 -0
@@ 77,6 77,11 @@ class Article(models.Model):
search_vector = SearchVectorField(null=True)
+ inherited_from = models.ForeignKey(
+ 'self', related_name='inherit_children',
+ null=True, blank=True, on_delete=models.SET_NULL,
+ )
+
# PERMISSIONS
def can_read(self, user):
return permissions.can_read(self, user)