diff --git a/archivebox/api/models.py b/archivebox/api/models.py index 177b275f..d8598002 100644 --- a/archivebox/api/models.py +++ b/archivebox/api/models.py @@ -56,6 +56,7 @@ class APIToken(ABIDModel): return { "TYPE": "APIToken", "uuid": str(self.id), + "ulid": str(self.ulid), "abid": str(self.get_abid()), "user_id": str(self.user.id), "user_username": self.user.username, @@ -64,6 +65,10 @@ class APIToken(ABIDModel): "expires": self.expires_as_iso8601, } + @property + def ulid(self): + return self.get_abid().ulid + @property def expires_as_iso8601(self): """Returns the expiry date of the token in ISO 8601 format or a date 100 years in the future if none.""" diff --git a/archivebox/core/admin.py b/archivebox/core/admin.py index 4bcbc222..7e1aa7f9 100644 --- a/archivebox/core/admin.py +++ b/archivebox/core/admin.py @@ -168,26 +168,30 @@ def get_abid_info(self, obj): return format_html( # URL Hash: {}
''' -     ABID:  {}
-     TS:                  {} ({})
-     URI:                 {} ({})
-     SUBTYPE:       {} ({})
-     RAND:              {} ({})

-     ABID AS UUID:  {}    

- -     .uuid:                 {}    
-     .id:                      {}    
-     .pk:                     {}    

+     DB ID:      {}
+        .id:                      {}    
+        .uuid:                  {}    
+
+
+     ABID:       {}
+         TS:                  {} ({})
+         URI:                 {} ({})
+         SUBTYPE:       {} ({})     +         RAND:              {} ({})

+         as ULID:               {}
+         as UUID:              {}

+
''', + obj.pk, + obj.id, + obj.uuid, obj.abid, obj.ABID.ts, obj.abid_values['ts'].isoformat() if isinstance(obj.abid_values['ts'], datetime) else obj.abid_values['ts'], obj.ABID.uri, str(obj.abid_values['uri']), obj.ABID.subtype, str(obj.abid_values['subtype']), obj.ABID.rand, str(obj.abid_values['rand'])[-7:], + obj.ABID.ulid, obj.ABID.uuid, - obj.uuid, - obj.id, - obj.pk, ) diff --git a/archivebox/core/models.py b/archivebox/core/models.py index 1b896217..2c9a9969 100644 --- a/archivebox/core/models.py +++ b/archivebox/core/models.py @@ -326,8 +326,8 @@ class ArchiveResult(ABIDModel): abid_rand_src = 'self.uuid' EXTRACTOR_CHOICES = EXTRACTOR_CHOICES + id = models.AutoField(primary_key=True, serialize=False, verbose_name='ID') # legacy pk TODO: move to UUIDField # id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) - id = models.AutoField(primary_key=True, serialize=False, verbose_name='ID') # legacy pk uuid = models.UUIDField(blank=True, null=True, editable=True, unique=True) abid = ABIDField(prefix=abid_prefix)