Skip to content

Commit

Permalink
feat: notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
Shavkatjon-O committed Aug 30, 2024
1 parent eb652e9 commit f80495b
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 2 deletions.
7 changes: 6 additions & 1 deletion apps/notifications/admin.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
from django.contrib import admin
from apps.notifications.models import Notification
from core.mixins import TabbedTranslationAdmin

# Register your models here.

@admin.register(Notification)
class NotificationAdmin(TabbedTranslationAdmin):
pass
26 changes: 26 additions & 0 deletions apps/notifications/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Generated by Django 5.0.7 on 2024-08-30 14:57

from django.db import migrations, models


class Migration(migrations.Migration):

initial = True

dependencies = [
]

operations = [
migrations.CreateModel(
name='Notification',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
('message', models.CharField(max_length=256)),
],
options={
'abstract': False,
},
),
]
8 changes: 7 additions & 1 deletion apps/notifications/models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
from django.db import models
from apps.common.models import BaseModel

# Create your models here.

class Notification(BaseModel):
message = models.CharField(max_length=256)

def __str__(self):
return self.message
7 changes: 7 additions & 0 deletions apps/notifications/translations.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from modeltranslation.translator import TranslationOptions, register
from apps.notifications.models import Notification


@register(Notification)
class NotificationTranslationOptions(TranslationOptions):
fields = ("message",)

0 comments on commit f80495b

Please sign in to comment.