diff --git a/.github/workflows/feature-branch-deploy.yml b/.github/workflows/feature-branch-deploy.yml index 68546ba46..69b2b6a2b 100644 --- a/.github/workflows/feature-branch-deploy.yml +++ b/.github/workflows/feature-branch-deploy.yml @@ -84,7 +84,7 @@ jobs: - name: Build, tag and push docker images ECR env: REGISTRY: ${{ steps.login-ecr.outputs.registry }} - IMAGE_TAG: ${{ vars.IMAGE_TAG }} + IMAGE_TAG: ${{ secrets.IMAGE_TAG }} CLUSTER: ${{ secrets.CLUSTER_TEST }} TARGET_SERVICE: ${{ secrets.TARGET_SERVICE }} run: | diff --git a/concordia/admin/forms.py b/concordia/admin/forms.py index 9a07fb959..770c89ec2 100644 --- a/concordia/admin/forms.py +++ b/concordia/admin/forms.py @@ -37,6 +37,10 @@ class AdminProjectBulkImportForm(forms.Form): label="Spreadsheet containing the campaigns, projects, and items to import", ) + redownload = forms.BooleanField( + required=False, label="Should existing items be redownloaded?" + ) + class AdminRedownloadImagesForm(forms.Form): spreadsheet_file = forms.FileField( diff --git a/concordia/admin/views.py b/concordia/admin/views.py index d514f6c84..bd15b06a9 100644 --- a/concordia/admin/views.py +++ b/concordia/admin/views.py @@ -132,7 +132,7 @@ def project_level_export(request): form = AdminProjectBulkImportForm() context["campaigns"] = all_campaigns = [] context["projects"] = all_projects = [] - id = request.GET.get("id") + idx = request.GET.get("id") if request.method == "POST": project_list = request.POST.getlist("project_name") @@ -179,15 +179,15 @@ def project_level_export(request): ) as export_base_dir: return do_bagit_export(assets, export_base_dir, export_filename_base) - if id is not None: + if idx is not None: context["campaigns"] = [] form = AdminProjectBulkImportForm() - projects = Project.objects.filter(campaign_id=int(id)) + projects = Project.objects.filter(campaign_id=int(idx)) for project in projects: proj_dict = {} proj_dict["title"] = project.title proj_dict["id"] = project.pk - proj_dict["campaign_id"] = id + proj_dict["campaign_id"] = idx all_projects.append(proj_dict) else: @@ -223,11 +223,11 @@ def celery_task_review(request): } celery = Celery("concordia") celery.config_from_object("django.conf:settings", namespace="CELERY") - id = request.GET.get("id") + idx = request.GET.get("id") - if id is not None: + if idx is not None: form = AdminProjectBulkImportForm() - projects = Project.objects.filter(campaign_id=int(id)) + projects = Project.objects.filter(campaign_id=int(idx)) for project in projects: asset_successful = 0 asset_failure = 0 @@ -236,7 +236,7 @@ def celery_task_review(request): proj_dict = {} proj_dict["title"] = project.title proj_dict["id"] = project.pk - proj_dict["campaign_id"] = id + proj_dict["campaign_id"] = idx messages.info(request, f"{project.title}") importjobs = ImportJob.objects.filter(project_id=project.pk).order_by( "-created" @@ -398,7 +398,7 @@ def admin_bulk_import_review(request): ) all_urls.append(urls) - for i, val in enumerate(all_urls): + for _i, val in enumerate(all_urls): return_result = fetch_all_urls(val) for res in return_result[0]: messages.info(request, f"{res}") @@ -437,6 +437,7 @@ def admin_bulk_import_view(request): if form.is_valid(): context["import_jobs"] = import_jobs = [] + redownload = form.cleaned_data.get("redownload", False) rows = slurp_excel(request.FILES["spreadsheet_file"]) required_fields = [ @@ -545,7 +546,7 @@ def admin_bulk_import_view(request): try: import_jobs.append( import_items_into_project_from_url( - request.user, project, url + request.user, project, url, redownload ) ) diff --git a/concordia/models.py b/concordia/models.py index e38a335a5..9cd0e7d99 100644 --- a/concordia/models.py +++ b/concordia/models.py @@ -873,3 +873,30 @@ class CampaignRetirementProgress(models.Model): def __str__(self): return f"Removal progress for {self.campaign}" + + +class Card(models.Model): + image = models.ImageField(upload_to="card_images", blank=True, null=True) + title = models.CharField(max_length=80) + body_text = models.TextField(blank=True) + + class Meta: + abstract = True + + +class CardFamily(models.Model): + slug = models.SlugField(max_length=80, unique=True, allow_unicode=True) + default = models.BooleanField(default=False) + cards = models.ManyToManyField(Card, through="TutorialCard") + + class Meta: + abstract = True + + +class TutorialCard(models.Model): + card = models.ForeignKey(Card, on_delete=models.CASCADE) + tutorial = models.ForeignKey(CardFamily, on_delete=models.CASCADE) + order = models.IntegerField(default=0) + + class Meta: + abstract = True diff --git a/concordia/templates/admin/bulk_import.html b/concordia/templates/admin/bulk_import.html index 870e95eb2..6682ecae4 100644 --- a/concordia/templates/admin/bulk_import.html +++ b/concordia/templates/admin/bulk_import.html @@ -55,6 +55,7 @@