diff --git a/readthedocs/projects/forms.py b/readthedocs/projects/forms.py index 075c3c3fa58..0747078c399 100644 --- a/readthedocs/projects/forms.py +++ b/readthedocs/projects/forms.py @@ -433,7 +433,7 @@ class ProjectRelationshipForm(forms.ModelForm): class Meta: model = ProjectRelationship - fields = '__all__' + fields = "__all__" def __init__(self, *args, **kwargs): self.project = kwargs.pop('project') diff --git a/readthedocs/projects/migrations/0094_auto_20221221_1045.py b/readthedocs/projects/migrations/0094_auto_20221221_1045.py new file mode 100644 index 00000000000..07bfe2da0bd --- /dev/null +++ b/readthedocs/projects/migrations/0094_auto_20221221_1045.py @@ -0,0 +1,34 @@ +# Generated by Django 3.2.16 on 2022-12-21 10:45 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("projects", "0093_migrate_null_fields"), + ] + + operations = [ + migrations.AlterField( + model_name="projectrelationship", + name="child", + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="superprojects", + to="projects.project", + verbose_name="Subproject", + ), + ), + migrations.AlterField( + model_name="projectrelationship", + name="parent", + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="subprojects", + to="projects.project", + verbose_name="Main project", + ), + ), + ] diff --git a/readthedocs/projects/models.py b/readthedocs/projects/models.py index 2b14553a2e7..c05d9eb4388 100644 --- a/readthedocs/projects/models.py +++ b/readthedocs/projects/models.py @@ -73,19 +73,22 @@ class ProjectRelationship(models.Model): """ Project to project relationship. - This is used for subprojects + This is used for subprojects. + + Terminology: We should say main project and subproject. + Saying "child" and "parent" only has internal, technical value. """ parent = models.ForeignKey( - 'projects.Project', - verbose_name=_('Parent'), - related_name='subprojects', + "projects.Project", + verbose_name=_("Main project"), + related_name="subprojects", on_delete=models.CASCADE, ) child = models.ForeignKey( - 'projects.Project', - verbose_name=_('Child'), - related_name='superprojects', + "projects.Project", + verbose_name=_("Subproject"), + related_name="superprojects", on_delete=models.CASCADE, ) alias = models.SlugField( diff --git a/readthedocs/templates/projects/projectrelationship_form.html b/readthedocs/templates/projects/projectrelationship_form.html index 566b5fde8d0..5c8f7f17845 100644 --- a/readthedocs/templates/projects/projectrelationship_form.html +++ b/readthedocs/templates/projects/projectrelationship_form.html @@ -12,6 +12,12 @@ {% block project_edit_content_header %}{% trans "Subprojects" %}{% endblock %} {% block project_edit_content %} +
+ {% blocktrans trimmed %} + Using subprojects allows you to serve multiple projects from the same domain as your main project. Learn more. + {% endblocktrans %} +
+ {% if object %} {% endif %} + {% endblock %}