Skip to content

Commit

Permalink
fix: fixed issue #1 and #2 and bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosgabarda committed Sep 12, 2023
1 parent f9924ef commit 784004b
Show file tree
Hide file tree
Showing 8 changed files with 121 additions and 97 deletions.
5 changes: 5 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
History
-------

1.3.1 (2023-09-12)
+++++++++++++++++++

* Fix: Fixed issues #1 and #2.

1.3.0 (2023-09-04)
+++++++++++++++++++

Expand Down
178 changes: 89 additions & 89 deletions poetry.lock

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "django-websocket-notifications"
version = "1.3.0"
version = "1.3.1"
description = "A Django package to handle notifications using Django Channels and WebSockets."
readme = "README.rst"
authors = ["Marcos Gabarda <[email protected]>"]
Expand All @@ -9,9 +9,9 @@ homepage = "https://github.com/marcosgabarda/django-websocket-notifications"
packages = [{ include = "websocket_notifications" }]

classifiers = [
"Environment :: Web Environment",
"Framework :: Django",
"License :: OSI Approved :: MIT License",
"Environment :: Web Environment",
"Framework :: Django",
"License :: OSI Approved :: MIT License",
]

[tool.poetry.dependencies]
Expand Down
1 change: 0 additions & 1 deletion websocket_notifications/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@
@admin.register(NotificationGroup)
class NotificationGroupAdmin(admin.ModelAdmin):
list_display = ["id", "user", "code", "created"]
autocomplete_fields = ["user"]
search_fields = ["code", "user__email"]
1 change: 1 addition & 0 deletions websocket_notifications/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
class WebsocketNotificationsAppConfig(AppConfig):
name = "websocket_notifications"
verbose_name = _("Websocket notifications")
default_auto_field = "django.db.models.BigAutoField"
4 changes: 2 additions & 2 deletions websocket_notifications/consumers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

from channels.db import database_sync_to_async
from channels.generic.websocket import AsyncWebsocketConsumer

from websocket_notifications.models import NotificationGroup
from django.apps import apps


class NotificationConsumer(AsyncWebsocketConsumer):
"""Consumer for sending notification to the client."""

@database_sync_to_async
def get_notification_group(self, code: str):
NotificationGroup = apps.get_model("websocket_notifications.NotificationGroup")
return NotificationGroup.objects.filter(code=code).first()

async def connect(self):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 4.2.5 on 2023-09-12 08:18

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("websocket_notifications", "0001_initial"),
]

operations = [
migrations.AlterField(
model_name="notificationgroup",
name="id",
field=models.BigAutoField(
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
),
),
]
2 changes: 1 addition & 1 deletion websocket_notifications/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

class NotificationGroup(TimeStampedModel):
"""This model is used to save an unique code for each user to use to connect for
listenign notifications.
listening notifications.
"""

user = models.OneToOneField(
Expand Down

0 comments on commit 784004b

Please sign in to comment.