diff mbox series

[v2,1/7] models, templates: Add project list archive URL field

Message ID 20190822071303.17395-1-ajd@linux.ibm.com
State Accepted
Headers show
Series [v2,1/7] models, templates: Add project list archive URL field | expand

Commit Message

Andrew Donnellan Aug. 22, 2019, 7:12 a.m. UTC
Add a field to link to a project's mailing list archive, and display it on
the project info page.

Add the new field to the patchwork project in the supplied example fixture.

Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com>

---
v1->v2:
 - add field to fixtures (Daniel)
---
 patchwork/fixtures/default_projects.xml       |  1 +
 .../0034_project_list_archive_url.py          | 20 +++++++++++++++++++
 patchwork/models.py                           |  1 +
 patchwork/templates/patchwork/project.html    |  6 ++++++
 4 files changed, 28 insertions(+)
 create mode 100644 patchwork/migrations/0034_project_list_archive_url.py

Comments

Daniel Axtens Aug. 22, 2019, 11:12 a.m. UTC | #1
Series applied, thanks.

Andrew Donnellan <ajd@linux.ibm.com> writes:

> Add a field to link to a project's mailing list archive, and display it on
> the project info page.
>
> Add the new field to the patchwork project in the supplied example fixture.
>
> Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com>
>
> ---
> v1->v2:
>  - add field to fixtures (Daniel)
> ---
>  patchwork/fixtures/default_projects.xml       |  1 +
>  .../0034_project_list_archive_url.py          | 20 +++++++++++++++++++
>  patchwork/models.py                           |  1 +
>  patchwork/templates/patchwork/project.html    |  6 ++++++
>  4 files changed, 28 insertions(+)
>  create mode 100644 patchwork/migrations/0034_project_list_archive_url.py
>
> diff --git a/patchwork/fixtures/default_projects.xml b/patchwork/fixtures/default_projects.xml
> index 30d346127234..39d269836394 100644
> --- a/patchwork/fixtures/default_projects.xml
> +++ b/patchwork/fixtures/default_projects.xml
> @@ -5,5 +5,6 @@
>      <field type="CharField" name="name">Patchwork</field>
>      <field type="CharField" name="listid">patchwork.ozlabs.org</field>
>      <field type="CharField" name="listemail">patchwork@lists.ozlabs.org</field>
> +    <field type="CharField" name="list_archive_url">https://lists.ozlabs.org/pipermail/patchwork/</field>
>    </object>
>  </django-objects>
> diff --git a/patchwork/migrations/0034_project_list_archive_url.py b/patchwork/migrations/0034_project_list_archive_url.py
> new file mode 100644
> index 000000000000..70d1b2bf8542
> --- /dev/null
> +++ b/patchwork/migrations/0034_project_list_archive_url.py
> @@ -0,0 +1,20 @@
> +# -*- coding: utf-8 -*-
> +# Generated by Django 1.11.21 on 2019-07-01 12:30
> +from __future__ import unicode_literals
> +
> +from django.db import migrations, models
> +
> +
> +class Migration(migrations.Migration):
> +
> +    dependencies = [
> +        ('patchwork', '0033_remove_patch_series_model'),
> +    ]
> +
> +    operations = [
> +        migrations.AddField(
> +            model_name='project',
> +            name='list_archive_url',
> +            field=models.CharField(blank=True, max_length=2000),
> +        ),
> +    ]
> diff --git a/patchwork/models.py b/patchwork/models.py
> index a7eee4dbad9a..e43b062b6f89 100644
> --- a/patchwork/models.py
> +++ b/patchwork/models.py
> @@ -77,6 +77,7 @@ class Project(models.Model):
>      web_url = models.CharField(max_length=2000, blank=True)
>      scm_url = models.CharField(max_length=2000, blank=True)
>      webscm_url = models.CharField(max_length=2000, blank=True)
> +    list_archive_url = models.CharField(max_length=2000, blank=True)
>  
>      # configuration options
>  
> diff --git a/patchwork/templates/patchwork/project.html b/patchwork/templates/patchwork/project.html
> index 99e36ff79d6a..bd9d20e263d8 100644
> --- a/patchwork/templates/patchwork/project.html
> +++ b/patchwork/templates/patchwork/project.html
> @@ -15,6 +15,12 @@
>    <th>List address</th>
>    <td>{{project.listemail}}</td>
>   </tr>
> +{% if project.list_archive_url %}
> + <tr>
> +  <th>List archive</th>
> +  <td><a href="{{ project.list_archive_url }}">{{ project.list_archive_url }}</a></td>
> + </tr>
> +{% endif %}
>   <tr>
>    <th>Maintainer{{maintainers|length|pluralize}}</th>
>    <td>
> -- 
> 2.20.1
>
> _______________________________________________
> Patchwork mailing list
> Patchwork@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/patchwork
diff mbox series

Patch

diff --git a/patchwork/fixtures/default_projects.xml b/patchwork/fixtures/default_projects.xml
index 30d346127234..39d269836394 100644
--- a/patchwork/fixtures/default_projects.xml
+++ b/patchwork/fixtures/default_projects.xml
@@ -5,5 +5,6 @@ 
     <field type="CharField" name="name">Patchwork</field>
     <field type="CharField" name="listid">patchwork.ozlabs.org</field>
     <field type="CharField" name="listemail">patchwork@lists.ozlabs.org</field>
+    <field type="CharField" name="list_archive_url">https://lists.ozlabs.org/pipermail/patchwork/</field>
   </object>
 </django-objects>
diff --git a/patchwork/migrations/0034_project_list_archive_url.py b/patchwork/migrations/0034_project_list_archive_url.py
new file mode 100644
index 000000000000..70d1b2bf8542
--- /dev/null
+++ b/patchwork/migrations/0034_project_list_archive_url.py
@@ -0,0 +1,20 @@ 
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.21 on 2019-07-01 12:30
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('patchwork', '0033_remove_patch_series_model'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='project',
+            name='list_archive_url',
+            field=models.CharField(blank=True, max_length=2000),
+        ),
+    ]
diff --git a/patchwork/models.py b/patchwork/models.py
index a7eee4dbad9a..e43b062b6f89 100644
--- a/patchwork/models.py
+++ b/patchwork/models.py
@@ -77,6 +77,7 @@  class Project(models.Model):
     web_url = models.CharField(max_length=2000, blank=True)
     scm_url = models.CharField(max_length=2000, blank=True)
     webscm_url = models.CharField(max_length=2000, blank=True)
+    list_archive_url = models.CharField(max_length=2000, blank=True)
 
     # configuration options
 
diff --git a/patchwork/templates/patchwork/project.html b/patchwork/templates/patchwork/project.html
index 99e36ff79d6a..bd9d20e263d8 100644
--- a/patchwork/templates/patchwork/project.html
+++ b/patchwork/templates/patchwork/project.html
@@ -15,6 +15,12 @@ 
   <th>List address</th>
   <td>{{project.listemail}}</td>
  </tr>
+{% if project.list_archive_url %}
+ <tr>
+  <th>List archive</th>
+  <td><a href="{{ project.list_archive_url }}">{{ project.list_archive_url }}</a></td>
+ </tr>
+{% endif %}
  <tr>
   <th>Maintainer{{maintainers|length|pluralize}}</th>
   <td>