diff --git a/credentials/apps/badges/accredible/api_client.py b/credentials/apps/badges/accredible/api_client.py index 5aae5d03f..1fc104749 100644 --- a/credentials/apps/badges/accredible/api_client.py +++ b/credentials/apps/badges/accredible/api_client.py @@ -119,6 +119,7 @@ def sync_groups(self, site_id: int) -> int: "description": raw_group.get("course_description"), "icon": self.fetch_design_image(raw_group.get("primary_design_id")), "created": raw_group.get("created_at"), + "state": AccredibleGroup.STATES.active, }, ) diff --git a/credentials/apps/badges/migrations/0003_alter_accredibleapiconfig_name.py b/credentials/apps/badges/migrations/0003_alter_accredibleapiconfig_name.py new file mode 100644 index 000000000..fa87b0218 --- /dev/null +++ b/credentials/apps/badges/migrations/0003_alter_accredibleapiconfig_name.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.17 on 2024-12-23 15:08 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("badges", "0002_accredibleapiconfig_accrediblebadge_and_more"), + ] + + operations = [ + migrations.AlterField( + model_name="accredibleapiconfig", + name="name", + field=models.CharField(help_text="Accredible API configuration name.", max_length=255, null=True), + ), + ] diff --git a/credentials/apps/badges/models.py b/credentials/apps/badges/models.py index 3749d00bb..90d78eb56 100644 --- a/credentials/apps/badges/models.py +++ b/credentials/apps/badges/models.py @@ -538,7 +538,7 @@ def groups(self): return { group: BadgeRequirement.is_group_fulfilled(group=group, template=self.template, username=self.username) - for group in self.template.groups + for group in getattr(self.template, "groups", []) } @property @@ -683,7 +683,7 @@ class AccredibleAPIConfig(TimeStampedModel): Accredible API configuration. """ - name = models.CharField(max_length=255, help_text=_("Accredible API configuration name."), null=True, blank=True) + name = models.CharField(max_length=255, help_text=_("Accredible API configuration name."), null=True, blank=False) api_key = models.CharField(max_length=255, help_text=_("Accredible API key.")) @classmethod @@ -693,6 +693,7 @@ def get_all_api_config_ids(cls): """ return list(cls.objects.values_list("id", flat=True)) + class AccredibleGroup(BadgeTemplate): """ Accredible badge group credential type.