Repository: carpentries/amy

Issue:
Instructor Selection: Include link to curriculum
The current view shows the curriculum that the workshop is teaching.  This should be a link to the curriculum page.  This may require updating the [curriculum model here](https://test-amy.carpentries.org/yikoouxjewu5mri5wmqkufrq6ztk8i5y/workshops/curriculum/)


Discussion:


CURRICULUM | LINK
-- | --
Mix & Match | none
Don't know yet | none
Data Carpentry (Ecology with Python) | https://datacarpentry.org/lessons/#ecology-workshop
Data Carpentry (Ecology with R) | https://datacarpentry.org/lessons/#ecology-workshop
Data Carpentry (Genomics) | https://datacarpentry.org/lessons/#genomics-workshop
Data Carpentry (Geospatial) | https://datacarpentry.org/lessons/#geospatial-curriculum
Data Carpentry (other) | https://datacarpentry.org/lessons/
Data Carpentry (Social Sciences with Python) | https://datacarpentry.org/lessons/#social-science-curriculum
Data Carpentry (Social Sciences with R) | https://datacarpentry.org/lessons/#social-science-curriculum
Library Carpentry (Intro to Data, Unix Shell, Git, and/or OpenRefine) | https://librarycarpentry.org/lessons/
Library Carpentry (other) | https://librarycarpentry.org/lessons/
Software Carpentry in Spanish (shell, git, Python) | https://software-carpentry.org/lessons/
Software Carpentry in Spanish (shell, git, R) | https://software-carpentry.org/lessons/
Software Carpentry (other) | https://software-carpentry.org/lessons/
Software Carpentry (Plotting and Programming in Python) | https://software-carpentry.org/lessons/
Software Carpentry (shell, git, Python) | https://software-carpentry.org/lessons/
Software Carpentry (shell, git, R) | https://software-carpentry.org/lessons/
Software Carpentry (R for Reproducible Scientific Analysis) | https://software-carpentry.org/lessons/



Resolving patch:
diff --git a/amy/workshops/admin.py b/amy/workshops/admin.py
--- a/amy/workshops/admin.py
+++ b/amy/workshops/admin.py
@@ -31,9 +31,11 @@ class CurriculumAdmin(admin.ModelAdmin):
         "slug",
         "name",
         "description",
+        "website",
         "active",
         "other",
         "unknown",
+        "mix_match",
     )
 
 
diff --git a/amy/workshops/migrations/0253_curriculum_website.py b/amy/workshops/migrations/0253_curriculum_website.py
new file mode 100644
--- /dev/null
+++ b/amy/workshops/migrations/0253_curriculum_website.py
@@ -0,0 +1,52 @@
+# Generated by Django 3.2.14 on 2022-08-14 20:45
+
+from django.db import migrations, models
+
+
+def update_link_for_existing_curriculums(apps, schema_editor) -> None:
+    Curriculum = apps.get_model("workshops", "Curriculum")
+
+    DATA = {
+        "dc-ecology-python": "https://datacarpentry.org/lessons/#ecology-workshop",
+        "dc-ecology-r": "https://datacarpentry.org/lessons/#ecology-workshop",
+        "dc-genomics": "https://datacarpentry.org/lessons/#genomics-workshop",
+        "dc-geospatial": "https://datacarpentry.org/lessons/#geospatial-curriculum",
+        "dc-other": "https://datacarpentry.org/lessons/",
+        "dc-socsci-python": "https://datacarpentry.org/lessons/#social-science-curriculum",
+        "dc-socsci-r": "https://datacarpentry.org/lessons/#social-science-curriculum",
+        "lc": "https://librarycarpentry.org/lessons/",
+        "lc-other": "https://librarycarpentry.org/lessons/",
+        "swc-es-python": "https://software-carpentry.org/lessons/",
+        "swc-es-r": "https://software-carpentry.org/lessons/",
+        "swc-es-other": "https://software-carpentry.org/lessons/",
+        "swc-plotting": "https://software-carpentry.org/lessons/",
+        "swc-python": "https://software-carpentry.org/lessons/",
+        "swc-r": "https://software-carpentry.org/lessons/",
+        "swc-reproducible-science": "https://software-carpentry.org/lessons/",
+    }
+
+    affected_rows = 0
+    for name, website in DATA.items():
+        affected_rows += Curriculum.objects.filter(slug=name).update(website=website)
+
+    print(f"Affected rows by the migration: {affected_rows}")
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ("workshops", "0252_auto_20211231_1108"),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name="curriculum",
+            name="website",
+            field=models.URLField(
+                blank=True, default="", verbose_name="Curriculum page"
+            ),
+        ),
+        migrations.RunPython(
+            update_link_for_existing_curriculums, migrations.RunPython.noop
+        ),
+    ]
diff --git a/amy/workshops/models.py b/amy/workshops/models.py
--- a/amy/workshops/models.py
+++ b/amy/workshops/models.py
@@ -2620,6 +2620,11 @@ class Curriculum(ActiveMixin, models.Model):
         help_text="Mark this curriculum record as 'Mix & Match'."
         "There can be only one such record in the database.",
     )
+    website = models.URLField(
+        blank=True,
+        default="",
+        verbose_name="Curriculum page",
+    )
 
     objects = CurriculumManager()
 


Test patch: