Skip to content

Commit

Permalink
Merge pull request #1 from ProdByGodfather/main
Browse files Browse the repository at this point in the history
Pull All Changes
  • Loading branch information
ProdByGodfather authored Dec 28, 2023
2 parents d1392f7 + 3ef170b commit 13e83d2
Show file tree
Hide file tree
Showing 49 changed files with 11,243 additions and 70 deletions.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

163 changes: 151 additions & 12 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,27 @@ Channels support Django's native asynchronous view and allow Django projects to
Now the django_channels architecture allows us to use websockets.
Protocols that provide the possibility of sending requests from both the server and the client side.

<center><img src="static/images/websocket.webp" width="70%"></center>

<center><img src="static/img/readme.png" width="100%"></center>

According to the picture, when a message is sent from the `mahdi` user, the message is sent to the server through websocket.
The server saves the message once in the database and sends the same message again to the mahdi user and other users without the need for a request.
All messages are received in the form of json through the client, and the main part of designing and displaying the messages is the responsibility of the client.

`django channels` is designed in the form of a messenger application whose client is javascript and its back-end has created a websocket-based connection with django.

<hr>



## Performance

> [!NOTE]
> It is better to use the **virtualenvironment** when installing libraries and running the project.

> [!WARNING]
> Have **redis** installed on the system before running
> Have **redis** installed on the system before running. <br>
> download and install [redis for windows](https://github.com/tporadowski/redis/releases) and to `cmd` type `redis-server` to run the redis.
**To install required libraries:**
```
Expand Down
16 changes: 14 additions & 2 deletions chat/admin.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
from django.contrib import admin
from chat import models

# Register your models here.
class ChatAdmin(admin.ModelAdmin):
list_display = ('roomname','createtime')
search_fields = ("roomname",)
list_filter = ('createtime',)
date_hierarchy = 'createtime'


admin.site.register(models.Message)
class RoomAdmin(admin.ModelAdmin):
list_display = ('author','timestamp','related_chat')
list_filter = ('timestamp',)
search_fields = ('author',)
date_hierarchy = 'timestamp'

# Register The models here.
admin.site.register(models.Chat,ChatAdmin)
admin.site.register(models.Message,RoomAdmin)
Loading

0 comments on commit 13e83d2

Please sign in to comment.