Repository: kartoza/prj.app

Issue:
We need to have link to the upstream project
When populating the project model, there should be an option to link upstream to the project page if the project owner wants to.


Discussion:

Resolving patch:
diff --git a/django_project/base/forms.py b/django_project/base/forms.py
--- a/django_project/base/forms.py
+++ b/django_project/base/forms.py
@@ -48,6 +48,7 @@ class Meta:
             'name',
             'image_file',
             'description',
+            'project_url',
             'precis',
             'gitter_room',
             'signature',
@@ -65,6 +66,7 @@ def __init__(self, *args, **kwargs):
                 Field('name', css_class="form-control"),
                 Field('image_file', css_class="form-control"),
                 Field('description', css_class="form-control"),
+                Field('project_url', css_class="form-control"),
                 Field('precis', css_class="form-control"),
                 Field('signature', css_class="form-control"),
                 Field('credit_cost', css_class="form-control"),
diff --git a/django_project/base/migrations/0007_project_project_url.py b/django_project/base/migrations/0007_project_project_url.py
new file mode 100644
--- /dev/null
+++ b/django_project/base/migrations/0007_project_project_url.py
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('base', '0006_auto_20170919_1202'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='project',
+            name='project_url',
+            field=models.URLField(help_text='Optional URL for this project\\s home page', null=True, blank=True),
+        ),
+    ]
diff --git a/django_project/base/models/project.py b/django_project/base/models/project.py
--- a/django_project/base/models/project.py
+++ b/django_project/base/models/project.py
@@ -134,6 +134,11 @@ class Project(models.Model):
         default=False
     )
 
+    project_url = models.URLField(
+        help_text=u'Optional URL for this project\s home page',
+        blank=True,
+        null=True
+    )
     owner = models.ForeignKey(User)
     slug = models.SlugField(unique=True)
     objects = models.Manager()


Test patch:
diff --git a/django_project/base/tests/test_models.py b/django_project/base/tests/test_models.py
--- a/django_project/base/tests/test_models.py
+++ b/django_project/base/tests/test_models.py
@@ -50,6 +50,7 @@ def test_Project_update(self):
             'description': u'New description',
             'approved': False,
             'private': True,
+            'project_url': u'http://foo.org',
             'slug': u'new-project-slug',
             'gitter_room': u'test/new',
         }
@@ -82,6 +83,7 @@ def test_gitter_validation(self):
             'description': u'New description',
             'approved': False,
             'private': True,
+            'project_url': u'http://foo.org',
             'slug': u'new-project-slug',
             'gitter_room': u'invalid',
         }
diff --git a/django_project/base/tests/test_views.py b/django_project/base/tests/test_views.py
--- a/django_project/base/tests/test_views.py
+++ b/django_project/base/tests/test_views.py
@@ -63,6 +63,7 @@ def test_ProjectCreate_with_login(self):
         post_data = {
             'name': u'New Test Project',
             'owner': self.user.id,
+            'project_url': 'http://foo.org',
             'screenshots-TOTAL_FORMS': 5,
             'screenshots-INITIAL_FORMS': 0
         }