Skip to content

Commit

Permalink
refactor: avoid confusion between Credential and User Credential
Browse files Browse the repository at this point in the history
  • Loading branch information
wowkalucky committed Apr 16, 2024
1 parent d22a50f commit d5e76d9
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 6 deletions.
18 changes: 13 additions & 5 deletions credentials/apps/badges/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ class BadgeProgressAdmin(admin.ModelAdmin):
"issued",
)
exclude = [
"credential",
"user_credential",
]

@admin.display(boolean=True)
Expand All @@ -321,7 +321,7 @@ def issued(self, obj):
"""
Identifies if user credential exists (regardless its current status).
"""
return bool(obj.credential)
return bool(obj.user_credential)


class CredlyBadgeAdmin(admin.ModelAdmin):
Expand All @@ -330,18 +330,26 @@ class CredlyBadgeAdmin(admin.ModelAdmin):
"""

list_display = (
"uuid",
"username",
"credential",
"status",
"state",
"uuid",
"external_uuid",
)
list_filter = ("state",)
list_filter = ("status", "state",)
search_fields = (
"username",
"uuid",
"external_uuid",
)
readonly_fields = (
"credential_id",
"credential_content_type",
"username",
"download_url",
"state",
"uuid",
"external_uuid",
)


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.2.20 on 2024-04-16 16:01

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('badges', '0015_credlybadge_external_uuid'),
]

operations = [
migrations.RenameField(
model_name='badgeprogress',
old_name='credential',
new_name='user_credential',
),
]
2 changes: 1 addition & 1 deletion credentials/apps/badges/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ class BadgeProgress(models.Model):
- user-centric;
"""

credential = models.OneToOneField(
user_credential = models.OneToOneField(
UserCredential,
models.SET_NULL,
blank=True,
Expand Down

0 comments on commit d5e76d9

Please sign in to comment.