From cd990e4e2f3fc7372b55ea37f9e52f968745e48a Mon Sep 17 00:00:00 2001 From: Danielle McLean Date: Thu, 10 Aug 2023 16:50:35 +1000 Subject: [PATCH] Rename Key to PgpKey, so other keys can fit too --- users/admin.py | 8 ++++---- users/migrations/0017_rename_key_pgpkey.py | 17 +++++++++++++++++ users/models.py | 2 +- 3 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 users/migrations/0017_rename_key_pgpkey.py diff --git a/users/admin.py b/users/admin.py index c5f11c4..23755e2 100644 --- a/users/admin.py +++ b/users/admin.py @@ -1,14 +1,14 @@ from django.contrib import admin from django.contrib.auth.admin import UserAdmin as BaseUserAdmin -from .models import Key, Profile, Site, User +from .models import PgpKey, Profile, Site, User class SiteAdmin(admin.ModelAdmin): list_display = ('name', 'icon', 'domain', 'url_template') -class KeyInline(admin.TabularInline): - model = Key +class PgpKeyInline(admin.TabularInline): + model = PgpKey extra = 1 @@ -22,7 +22,7 @@ class UserAdmin(BaseUserAdmin): ('Profile', {'fields': ('avatar', 'xmpp', 'note')}), ) inlines = ( - KeyInline, + PgpKeyInline, ProfileInline, ) diff --git a/users/migrations/0017_rename_key_pgpkey.py b/users/migrations/0017_rename_key_pgpkey.py new file mode 100644 index 0000000..9d12dc6 --- /dev/null +++ b/users/migrations/0017_rename_key_pgpkey.py @@ -0,0 +1,17 @@ +# Generated by Django 3.2.20 on 2023-08-10 06:37 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('users', '0016_alter_user_first_name'), + ] + + operations = [ + migrations.RenameModel( + old_name='Key', + new_name='PgpKey', + ), + ] diff --git a/users/models.py b/users/models.py index f8bfdee..274b82c 100644 --- a/users/models.py +++ b/users/models.py @@ -197,7 +197,7 @@ class Profile(models.Model): ordering = ('site', 'username') -class Key(models.Model): +class PgpKey(models.Model): """ Represents a PGP key that belongs to a particular :model:`users.User`. Each key will be added to the user's h-card with rel="pgpkey", a format