remove obviously unnecessary field

This commit is contained in:
Kuroshini 2020-01-27 19:38:47 +03:00
parent 205e2fa996
commit 7a66559307
3 changed files with 24 additions and 1 deletions

View File

@ -0,0 +1,17 @@
# Generated by Django 2.2.7 on 2020-01-27 16:37
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('notification', '0011_auto_20200124_1351'),
]
operations = [
migrations.RemoveField(
model_name='subscribe',
name='subscribe_date',
),
]

View File

@ -187,7 +187,6 @@ class SubscribeQuerySet(models.QuerySet):
class Subscribe(ProjectBaseMixin):
"""Subscribe model."""
subscribe_date = models.DateTimeField(_('Last subscribe date'), default=now(), blank=True, null=True)
unsubscribe_date = models.DateTimeField(_('Last unsubscribe date'), blank=True, null=True, default=None)
subscriber = models.ForeignKey(Subscriber, on_delete=models.CASCADE, null=True)
@ -198,6 +197,10 @@ class Subscribe(ProjectBaseMixin):
objects = SubscribeQuerySet.as_manager()
@property
def subscribe_date(self):
return self.created
class Meta:
"""Meta class."""

View File

@ -163,6 +163,9 @@ class SubscribeObjectSerializer(serializers.ModelSerializer):
'unsubscribe_date',
'subscription_type'
)
extra_kwargs = {
'subscribe_date': {'read_only': True},
}
def get_subscription_type(self, instance):
return SubscriptionTypeSerializer(