remove obviously unnecessary field
This commit is contained in:
parent
205e2fa996
commit
7a66559307
|
|
@ -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',
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
@ -187,7 +187,6 @@ class SubscribeQuerySet(models.QuerySet):
|
||||||
|
|
||||||
class Subscribe(ProjectBaseMixin):
|
class Subscribe(ProjectBaseMixin):
|
||||||
"""Subscribe model."""
|
"""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)
|
unsubscribe_date = models.DateTimeField(_('Last unsubscribe date'), blank=True, null=True, default=None)
|
||||||
|
|
||||||
subscriber = models.ForeignKey(Subscriber, on_delete=models.CASCADE, null=True)
|
subscriber = models.ForeignKey(Subscriber, on_delete=models.CASCADE, null=True)
|
||||||
|
|
@ -198,6 +197,10 @@ class Subscribe(ProjectBaseMixin):
|
||||||
|
|
||||||
objects = SubscribeQuerySet.as_manager()
|
objects = SubscribeQuerySet.as_manager()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def subscribe_date(self):
|
||||||
|
return self.created
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
"""Meta class."""
|
"""Meta class."""
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -163,6 +163,9 @@ class SubscribeObjectSerializer(serializers.ModelSerializer):
|
||||||
'unsubscribe_date',
|
'unsubscribe_date',
|
||||||
'subscription_type'
|
'subscription_type'
|
||||||
)
|
)
|
||||||
|
extra_kwargs = {
|
||||||
|
'subscribe_date': {'read_only': True},
|
||||||
|
}
|
||||||
|
|
||||||
def get_subscription_type(self, instance):
|
def get_subscription_type(self, instance):
|
||||||
return SubscriptionTypeSerializer(
|
return SubscriptionTypeSerializer(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user