diff --git a/config/__pycache__/__init__.cpython-311.pyc b/config/__pycache__/__init__.cpython-311.pyc index 423a636..8399ba7 100644 Binary files a/config/__pycache__/__init__.cpython-311.pyc and b/config/__pycache__/__init__.cpython-311.pyc differ diff --git a/config/__pycache__/settings.cpython-311.pyc b/config/__pycache__/settings.cpython-311.pyc index 96bce55..58f24c6 100644 Binary files a/config/__pycache__/settings.cpython-311.pyc and b/config/__pycache__/settings.cpython-311.pyc differ diff --git a/config/__pycache__/urls.cpython-311.pyc b/config/__pycache__/urls.cpython-311.pyc index 0b85e94..7d991c0 100644 Binary files a/config/__pycache__/urls.cpython-311.pyc and b/config/__pycache__/urls.cpython-311.pyc differ diff --git a/config/__pycache__/wsgi.cpython-311.pyc b/config/__pycache__/wsgi.cpython-311.pyc index 9c49e09..c24a4d3 100644 Binary files a/config/__pycache__/wsgi.cpython-311.pyc and b/config/__pycache__/wsgi.cpython-311.pyc differ diff --git a/config/settings.py b/config/settings.py index 291d043..1d43b7c 100644 --- a/config/settings.py +++ b/config/settings.py @@ -133,9 +133,9 @@ AUTH_PASSWORD_VALIDATORS = [ # Internationalization # https://docs.djangoproject.com/en/5.2/topics/i18n/ -LANGUAGE_CODE = 'en-us' +LANGUAGE_CODE = 'zh-hans' -TIME_ZONE = 'UTC' +TIME_ZONE = 'Asia/Shanghai' USE_I18N = True diff --git a/core/__pycache__/__init__.cpython-311.pyc b/core/__pycache__/__init__.cpython-311.pyc index 74b1112..14a43fb 100644 Binary files a/core/__pycache__/__init__.cpython-311.pyc and b/core/__pycache__/__init__.cpython-311.pyc differ diff --git a/core/__pycache__/admin.cpython-311.pyc b/core/__pycache__/admin.cpython-311.pyc index a5ed392..aacc609 100644 Binary files a/core/__pycache__/admin.cpython-311.pyc and b/core/__pycache__/admin.cpython-311.pyc differ diff --git a/core/__pycache__/apps.cpython-311.pyc b/core/__pycache__/apps.cpython-311.pyc index 6f131d4..90f4748 100644 Binary files a/core/__pycache__/apps.cpython-311.pyc and b/core/__pycache__/apps.cpython-311.pyc differ diff --git a/core/__pycache__/context_processors.cpython-311.pyc b/core/__pycache__/context_processors.cpython-311.pyc index 75bf223..7103724 100644 Binary files a/core/__pycache__/context_processors.cpython-311.pyc and b/core/__pycache__/context_processors.cpython-311.pyc differ diff --git a/core/__pycache__/models.cpython-311.pyc b/core/__pycache__/models.cpython-311.pyc index e061640..3841253 100644 Binary files a/core/__pycache__/models.cpython-311.pyc and b/core/__pycache__/models.cpython-311.pyc differ diff --git a/core/__pycache__/urls.cpython-311.pyc b/core/__pycache__/urls.cpython-311.pyc index 5a69659..8eb0e5c 100644 Binary files a/core/__pycache__/urls.cpython-311.pyc and b/core/__pycache__/urls.cpython-311.pyc differ diff --git a/core/__pycache__/views.cpython-311.pyc b/core/__pycache__/views.cpython-311.pyc index 2a36fd6..ba9c763 100644 Binary files a/core/__pycache__/views.cpython-311.pyc and b/core/__pycache__/views.cpython-311.pyc differ diff --git a/core/admin.py b/core/admin.py index 8c38f3f..574821d 100644 --- a/core/admin.py +++ b/core/admin.py @@ -1,3 +1,21 @@ from django.contrib import admin +from .models import ExtractionTask, ExtractedUser -# Register your models here. +class ExtractedUserInline(admin.TabularInline): + model = ExtractedUser + extra = 0 + +@admin.register(ExtractionTask) +class ExtractionTaskAdmin(admin.ModelAdmin): + list_display = ('id', 'task_type', 'created_at', 'user_count') + list_filter = ('task_type', 'created_at') + inlines = [ExtractedUserInline] + + def user_count(self, obj): + return obj.users.count() + user_count.short_description = '用户数量' + +@admin.register(ExtractedUser) +class ExtractedUserAdmin(admin.ModelAdmin): + list_display = ('nickname', 'xhs_id', 'task', 'extracted_at') + search_fields = ('nickname', 'xhs_id', 'comment_text') \ No newline at end of file diff --git a/core/migrations/0001_initial.py b/core/migrations/0001_initial.py new file mode 100644 index 0000000..ca44b9c --- /dev/null +++ b/core/migrations/0001_initial.py @@ -0,0 +1,36 @@ +# Generated by Django 5.2.7 on 2026-02-07 08:22 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='CaptureTask', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('task_type', models.CharField(choices=[('fans', '粉丝 (Fans)'), ('following', '关注 (Following)'), ('comments', '评论 (Comments)')], max_length=20)), + ('raw_content', models.TextField()), + ('created_at', models.DateTimeField(auto_now_add=True)), + ], + ), + migrations.CreateModel( + name='CapturedUser', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('nickname', models.CharField(blank=True, max_length=255, null=True)), + ('user_id', models.CharField(blank=True, max_length=255, null=True)), + ('profile_link', models.URLField(blank=True, max_length=500, null=True)), + ('comment_text', models.TextField(blank=True, null=True)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('task', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='users', to='core.capturetask')), + ], + ), + ] diff --git a/core/migrations/0002_extractiontask_extracteduser_delete_captureduser_and_more.py b/core/migrations/0002_extractiontask_extracteduser_delete_captureduser_and_more.py new file mode 100644 index 0000000..276d216 --- /dev/null +++ b/core/migrations/0002_extractiontask_extracteduser_delete_captureduser_and_more.py @@ -0,0 +1,42 @@ +# Generated by Django 5.2.7 on 2026-02-07 08:33 + +import django.db.models.deletion +import uuid +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='ExtractionTask', + fields=[ + ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), + ('task_type', models.CharField(choices=[('fans', '粉丝 (Fans)'), ('following', '关注 (Following)'), ('comments', '评论 (Comments)')], default='fans', max_length=20)), + ('raw_text', models.TextField()), + ('created_at', models.DateTimeField(auto_now_add=True)), + ], + ), + migrations.CreateModel( + name='ExtractedUser', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('nickname', models.CharField(blank=True, max_length=255, null=True)), + ('xhs_id', models.CharField(blank=True, max_length=100, null=True)), + ('profile_url', models.URLField(blank=True, max_length=500, null=True)), + ('comment_text', models.TextField(blank=True, null=True)), + ('extracted_at', models.DateTimeField(auto_now_add=True)), + ('task', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='users', to='core.extractiontask')), + ], + ), + migrations.DeleteModel( + name='CapturedUser', + ), + migrations.DeleteModel( + name='CaptureTask', + ), + ] diff --git a/core/migrations/__pycache__/0001_initial.cpython-311.pyc b/core/migrations/__pycache__/0001_initial.cpython-311.pyc new file mode 100644 index 0000000..f8e0147 Binary files /dev/null and b/core/migrations/__pycache__/0001_initial.cpython-311.pyc differ diff --git a/core/migrations/__pycache__/0002_extractiontask_extracteduser_delete_captureduser_and_more.cpython-311.pyc b/core/migrations/__pycache__/0002_extractiontask_extracteduser_delete_captureduser_and_more.cpython-311.pyc new file mode 100644 index 0000000..78a07e9 Binary files /dev/null and b/core/migrations/__pycache__/0002_extractiontask_extracteduser_delete_captureduser_and_more.cpython-311.pyc differ diff --git a/core/migrations/__pycache__/__init__.cpython-311.pyc b/core/migrations/__pycache__/__init__.cpython-311.pyc index 9c833c8..a030389 100644 Binary files a/core/migrations/__pycache__/__init__.cpython-311.pyc and b/core/migrations/__pycache__/__init__.cpython-311.pyc differ diff --git a/core/models.py b/core/models.py index 71a8362..df130f1 100644 --- a/core/models.py +++ b/core/models.py @@ -1,3 +1,27 @@ from django.db import models +import uuid -# Create your models here. +class ExtractionTask(models.Model): + TASK_TYPES = [ + ('fans', '粉丝 (Fans)'), + ('following', '关注 (Following)'), + ('comments', '评论 (Comments)'), + ] + id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) + task_type = models.CharField(max_length=20, choices=TASK_TYPES, default='fans') + raw_text = models.TextField() + created_at = models.DateTimeField(auto_now_add=True) + + def __str__(self): + return f"{self.get_task_type_display()} - {self.created_at.strftime('%Y-%m-%d %H:%M')}" + +class ExtractedUser(models.Model): + task = models.ForeignKey(ExtractionTask, related_name='users', on_delete=models.CASCADE) + nickname = models.CharField(max_length=255, blank=True, null=True) + xhs_id = models.CharField(max_length=100, blank=True, null=True) + profile_url = models.URLField(max_length=500, blank=True, null=True) + comment_text = models.TextField(blank=True, null=True) + extracted_at = models.DateTimeField(auto_now_add=True) + + def __str__(self): + return self.nickname or self.xhs_id or "Unknown User" diff --git a/core/templates/base.html b/core/templates/base.html index 1e7e5fb..f7d9f67 100644 --- a/core/templates/base.html +++ b/core/templates/base.html @@ -1,25 +1,82 @@ - - +
- -