Skip to content

Commit

Permalink
feat: [ACI-275] new CredlyOrganization model
Browse files Browse the repository at this point in the history
  • Loading branch information
kyrylo-kh committed Jan 16, 2024
1 parent 3d6a8c1 commit f071554
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 2 deletions.
14 changes: 12 additions & 2 deletions credentials/apps/badges/distribution/credly_badges/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,18 @@
Admin section configuration for credly badges.
"""

from django.contrib import admin

from .toggles import is_credly_badges_enabled
from .models import CredlyOrganization


class CredlyOrganizationAdmin(admin.ModelAdmin):
"""
Credly organization admin setup.
"""
list_display = ("name", "uuid", "api_key",)


if is_credly_badges_enabled():
# TODO: Define registering admin classes here `admin.site.register(...)`
pass
admin.site.register(CredlyOrganization, CredlyOrganizationAdmin)
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Generated by Django 4.2.9 on 2024-01-16 12:03

from django.db import migrations, models
import django_extensions.db.fields


class Migration(migrations.Migration):
initial = True

dependencies = []

operations = [
migrations.CreateModel(
name="CredlyOrganization",
fields=[
("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
(
"created",
django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, verbose_name="created"),
),
(
"modified",
django_extensions.db.fields.ModificationDateTimeField(auto_now=True, verbose_name="modified"),
),
("uuid", models.UUIDField(help_text="Unique credly organization ID.", unique=True)),
("name", models.CharField(help_text="Name of credly organization.", max_length=255)),
("api_key", models.CharField(help_text="Credly organization API bearer secret.", max_length=255)),
],
options={
"get_latest_by": "modified",
"abstract": False,
},
),
]
Empty file.
13 changes: 13 additions & 0 deletions credentials/apps/badges/distribution/credly_badges/models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
"""
Credly badges DB models.
"""

from django.db import models
from django_extensions.db.models import TimeStampedModel
from django.utils.translation import gettext_lazy as _


class CredlyOrganization(TimeStampedModel):
"""
A single Credly organization.
"""
uuid = models.UUIDField(unique=True, help_text=_('Unique credly organization ID.'))
name = models.CharField(max_length=255, help_text=_('Name of credly organization.'))
api_key = models.CharField(max_length=255, help_text=_('Credly organization API bearer secret.'))

0 comments on commit f071554

Please sign in to comment.