[PATCH 1/3] Add additional data to projects

Simo Sorce idra at samba.org
Sat Oct 27 09:51:42 EST 2012


This allows us to display friendly links to the project website,
web SCM UI and SCM URL.

For example for the patchwork project these could be set to:
website: http://jk.ozlabs.org/projects/patchwork/
webscm: http://git.ozlabs.org/?p=patchwork;a=tree
scmurl: git://ozlabs.org/home/jk/git/patchwork

Signed-off-by: Simo Sorce <idra at samba.org>
---
 apps/patchwork/models.py                      |  3 +++
 lib/sql/migration/012-project-add-columns.sql |  5 +++++
 templates/patchwork/project.html              | 18 ++++++++++++++++++
 3 files changed, 26 insertions(+)
 create mode 100644 lib/sql/migration/012-project-add-columns.sql

diff --git a/apps/patchwork/models.py b/apps/patchwork/models.py
index bbfe827aec551d41bdc75a8f0dde6315b74a09d5..ee2549d6a60de0b06437f1e5a6359ec1713b6f75 100644
--- a/apps/patchwork/models.py
+++ b/apps/patchwork/models.py
@@ -64,6 +64,9 @@ class Project(models.Model):
     name = models.CharField(max_length=255, unique=True)
     listid = models.CharField(max_length=255, unique=True)
     listemail = models.CharField(max_length=200)
+    website = models.CharField(max_length=2000, blank=True)
+    webscm = models.CharField(max_length=2000, blank=True)
+    scmurl = models.CharField(max_length=2000, blank=True)
     send_notifications = models.BooleanField()
 
     def __unicode__(self):
diff --git a/lib/sql/migration/012-project-add-columns.sql b/lib/sql/migration/012-project-add-columns.sql
new file mode 100644
index 0000000000000000000000000000000000000000..54f4db2b7ca9a2048e4b16086f4f0b74aa479947
--- /dev/null
+++ b/lib/sql/migration/012-project-add-columns.sql
@@ -0,0 +1,5 @@
+BEGIN;
+ALTER TABLE "patchwork_project" ADD COLUMN "website" varchar(2000);
+ALTER TABLE "patchwork_project" ADD COLUMN "webscm" varchar(2000);
+ALTER TABLE "patchwork_project" ADD COLUMN "scmurl" varchar(2000);
+COMMIT;
diff --git a/templates/patchwork/project.html b/templates/patchwork/project.html
index 2d63d1d86c8cdb42f49010c0230db9dce0ca7e9b..df94920ab68e930dd4cfd99088c7b51f41700c77 100644
--- a/templates/patchwork/project.html
+++ b/templates/patchwork/project.html
@@ -28,6 +28,24 @@
   <th>Patch count</th>
   <td>{{n_patches}} (+ {{n_archived_patches}} archived)</td>
  </tr>
+{% if project.website %}
+ <tr>
+  <th>Website</th>
+  <td><a href="{{project.website}}">{{project.website}}</a></td>
+ </tr>
+{% endif %}
+{% if project.webscm %}
+ <tr>
+  <th>Source Code Web Interface</th>
+  <td><a href="{{project.webscm}}">{{project.webscm}}</a></td>
+ </tr>
+{% endif %}
+{% if project.scmurl %}
+ <tr>
+  <th>Source Code Manager URL</th>
+  <td><a href="{{project.scmurl}}">{{project.scmurl}}</a></td>
+ </tr>
+{% endif %}
 </table>
 
 {% if settings.ENABLE_XMLRPC %}
-- 
1.7.11.4



More information about the Patchwork mailing list