tweak log format

This commit is contained in:
neodb dev 2023-12-24 18:04:55 -05:00 committed by Henri Dickson
parent 362ab9cd65
commit 819e8ffda4
5 changed files with 4 additions and 34 deletions

View file

@ -241,7 +241,7 @@ class Content(Piece):
remote_id = models.CharField(max_length=200, null=True, default=None)
def __str__(self):
return f"{self.uuid}@{self.item}"
return f"{self.__class__.__name__}:{self.uuid}@{self.item}"
class Meta:
abstract = True

View file

@ -164,4 +164,4 @@ class ListMember(Piece):
abstract = True
def __str__(self):
return f"{self.id}:{self.position} ({self.item})"
return f"{self.__class__.__name__}:{self.id}@{self.position}:{self.item}"

View file

@ -193,7 +193,7 @@ class ShelfLogEntry(models.Model):
]
def __str__(self):
return f"{self.owner}:{self.shelf_type}:{self.item.uuid}:{self.timestamp}"
return f"LOG:{self.owner}:{self.shelf_type}:{self.item.uuid}:{self.timestamp}"
@property
def action_label(self):

View file

@ -1,30 +0,0 @@
from django.conf import settings
from django.core.management.base import BaseCommand
from loguru import logger
from tqdm import tqdm
from takahe.utils import Takahe
from users.models import APIdentity, User
class Command(BaseCommand):
help = "Manage import tasks"
def add_arguments(self, parser):
parser.add_argument(
"--reset",
action="store_true",
)
def handle(self, *args, **options):
count = 0
for identity in tqdm(APIdentity.objects.filter(local=True)):
if (
identity.is_active
and not identity.takahe_identity.profile_uri.startswith("http")
):
identity.takahe_identity.profile_uri = identity.user.absolute_url
identity.takahe_identity.save(update_fields=["profile_uri"])
Takahe.update_state(identity.takahe_identity, "edited")
count += 1
self.stdout.write(self.style.SUCCESS(f"{count} user(s) fixed"))

View file

@ -207,7 +207,7 @@ class User(AbstractUser):
return settings.SITE_INFO["site_url"] + self.url
def __str__(self):
return f'{self.pk}:{self.username or ""}:{self.mastodon_acct}'
return f'USER:{self.pk}:{self.username or "<missing>"}:{self.mastodon_acct or self.email}'
@property
def registration_complete(self):