fix API notification
This commit is contained in:
parent
cffbdc0f32
commit
9d3274b523
2 changed files with 7 additions and 1 deletions
|
@ -67,7 +67,8 @@ class BillingProjectSerializer(serializers.ModelSerializer):
|
|||
|
||||
class NotificationSerializer(serializers.ModelSerializer):
|
||||
project = BillingProjectSerializer()
|
||||
recipient = serializers.CharField()
|
||||
|
||||
class Meta:
|
||||
model = Notification
|
||||
fields = ['id', 'project', 'title', 'short_description', 'content', 'sent_status', 'is_read']
|
||||
fields = ['id', 'project', 'title', 'short_description', 'content', 'sent_status', 'is_read', 'created_at', 'recipient']
|
||||
|
|
|
@ -264,6 +264,11 @@ class Notification(BaseModel, TimestampMixin):
|
|||
sent_status = models.BooleanField()
|
||||
is_read = models.BooleanField()
|
||||
|
||||
def recipient(self):
|
||||
if self.project:
|
||||
return self.project.email_notification
|
||||
return 'Admin'
|
||||
|
||||
def send(self):
|
||||
from core.utils.dynamic_setting import get_dynamic_setting, EMAIL_ADMIN
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue