From b830b24841777886cee92fed997fa4370ea29c4d Mon Sep 17 00:00:00 2001 From: guoshijiang Date: Sun, 17 Mar 2024 17:12:39 +0800 Subject: [PATCH] update api info --- airdrop/admin.py | 2 +- ...eward_name_periodreward_period_and_more.py | 32 +++++++++++++++++++ airdrop/models.py | 25 +++++++++++++-- 3 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 airdrop/migrations/0005_remove_periodreward_name_periodreward_period_and_more.py diff --git a/airdrop/admin.py b/airdrop/admin.py index 9f036be..b2bdd79 100644 --- a/airdrop/admin.py +++ b/airdrop/admin.py @@ -32,4 +32,4 @@ class ChainAdmin(admin.ModelAdmin): @admin.register(PeriodReward) class ChainAdmin(admin.ModelAdmin): - list_display = ('id', 'name', 'address', 'amount', 'is_send') \ No newline at end of file + list_display = ('id', 'title', 'address', 'amount', 'is_send') \ No newline at end of file diff --git a/airdrop/migrations/0005_remove_periodreward_name_periodreward_period_and_more.py b/airdrop/migrations/0005_remove_periodreward_name_periodreward_period_and_more.py new file mode 100644 index 0000000..b3731c5 --- /dev/null +++ b/airdrop/migrations/0005_remove_periodreward_name_periodreward_period_and_more.py @@ -0,0 +1,32 @@ +# Generated by Django 4.1.1 on 2024-03-17 09:12 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('airdrop', '0004_periodreward'), + ] + + operations = [ + migrations.RemoveField( + model_name='periodreward', + name='name', + ), + migrations.AddField( + model_name='periodreward', + name='period', + field=models.CharField(blank=True, max_length=300, verbose_name='活动周期'), + ), + migrations.AddField( + model_name='periodreward', + name='sub_title', + field=models.CharField(default='', max_length=200, verbose_name='活动副标题'), + ), + migrations.AddField( + model_name='periodreward', + name='title', + field=models.CharField(default='', max_length=200, verbose_name='活动主题'), + ), + ] diff --git a/airdrop/models.py b/airdrop/models.py index 4bdbb34..ea4b7ef 100644 --- a/airdrop/models.py +++ b/airdrop/models.py @@ -137,7 +137,8 @@ def as_dict(self): 'id': self.id, 'name': self.address, 'type': self.type, - 'points': self.points + 'points': self.points, + 'created_at': self.created_at } @@ -262,10 +263,19 @@ def as_dict(self): class PeriodReward(BaseModel): - name = models.CharField( + title = models.CharField( + max_length=200, + unique=False, + blank=False, + default="", + verbose_name='活动主题' + ) + sub_title = models.CharField( max_length=200, unique=False, - verbose_name='中奖期数' + blank=False, + default="", + verbose_name='活动副标题' ) address = models.CharField( max_length=200, @@ -277,6 +287,12 @@ class PeriodReward(BaseModel): unique=False, verbose_name='中奖金额' ) + period = models.CharField( + max_length=300, + unique=False, + blank=True, + verbose_name='活动周期' + ) is_send = models.BooleanField( default=False ) @@ -291,7 +307,10 @@ def __str__(self): def as_dict(self): return { 'id': self.id, + 'title': self.title, + 'sub_title': self.sub_title, 'address': self.address, + 'period': self.period, 'amount': self.amount, 'is_send': self.is_send, } \ No newline at end of file