Skip to content

Commit

Permalink
Label for subproject select renamed "Child" => "Subproject" + help te…
Browse files Browse the repository at this point in the history
…xt added (#9829)

* Changes label from "Child" to "Subproject"

* Adds a link to the documentation about subprojects

* Apply "subproject" and "main project" terminology to model

* Remove labels from the form again
  • Loading branch information
benjaoming authored Dec 22, 2022
1 parent 0aa6e2c commit ae91a51
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 8 deletions.
2 changes: 1 addition & 1 deletion readthedocs/projects/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
34 changes: 34 additions & 0 deletions readthedocs/projects/migrations/0094_auto_20221221_1045.py
Original file line number Diff line number Diff line change
@@ -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",
),
),
]
17 changes: 10 additions & 7 deletions readthedocs/projects/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
7 changes: 7 additions & 0 deletions readthedocs/templates/projects/projectrelationship_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
{% block project_edit_content_header %}{% trans "Subprojects" %}{% endblock %}

{% block project_edit_content %}
<p class="help_text">
{% blocktrans trimmed %}
Using subprojects allows you to serve multiple projects from the same domain as your main project. <a href="https://docs.readthedocs.io/en/stable/subprojects.html">Learn more</a>.
{% endblocktrans %}
</p>

{% if object %}
<form
method="post"
Expand All @@ -38,4 +44,5 @@
<input type="submit" value="{% trans "Add subproject" %}">
</form>
{% endif %}

{% endblock %}

0 comments on commit ae91a51

Please sign in to comment.