Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Label for subproject select renamed "Child" => "Subproject" + help text added #9829

Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion readthedocs/projects/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,8 @@ class ProjectRelationshipForm(forms.ModelForm):

class Meta:
model = ProjectRelationship
fields = '__all__'
fields = "__all__"
labels = {"child": _("Subproject")}
benjaoming marked this conversation as resolved.
Show resolved Hide resolved
benjaoming marked this conversation as resolved.
Show resolved Hide resolved

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
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 %}