File tree 3 files changed +24
-1
lines changed
3 files changed +24
-1
lines changed Original file line number Diff line number Diff line change 1
1
"""chat admin
2
2
"""
3
+ from csv import list_dialects
3
4
from datetime import datetime
4
5
from django .contrib import admin
5
6
from django .utils .html import format_html
6
- from .models import Message , Chat
7
+ from .models import Message , Chat , Customize
7
8
8
9
9
10
class MessageAdmin (admin .ModelAdmin ):
@@ -47,5 +48,10 @@ def time(self, model: Chat):
47
48
messages .short_description = "تعداد پیام ها"
48
49
49
50
51
+ class CustomizeAdmin (admin .ModelAdmin ):
52
+ list_display = ("name" , "color" )
53
+
54
+
50
55
admin .site .register (Message , MessageAdmin )
51
56
admin .site .register (Chat , ChatAdmin )
57
+ admin .site .register (Customize , CustomizeAdmin )
Original file line number Diff line number Diff line change 6
6
from django .db import models
7
7
from django .contrib .auth .models import User
8
8
from django .utils .crypto import get_random_string
9
+ from colorfield .fields import ColorField
9
10
10
11
11
12
def unique_string ():
@@ -154,3 +155,18 @@ def __str__(self):
154
155
class Meta :
155
156
verbose_name_plural = "پیام ها"
156
157
verbose_name = "پیام"
158
+
159
+
160
+ class Customize (models .Model ):
161
+ name = models .CharField (
162
+ max_length = 128 ,
163
+ null = False , blank = False ,
164
+ verbose_name = "قسمت" )
165
+ color = ColorField (default = "#27ae60" )
166
+
167
+ def __str__ (self ):
168
+ return self .name
169
+
170
+ class Meta :
171
+ verbose_name_plural = "شخصی سازی"
172
+ verbose_name = "بخش"
Original file line number Diff line number Diff line change 49
49
'auth' ,
50
50
'channels' ,
51
51
'rest_framework' ,
52
+ 'colorfield' ,
52
53
]
53
54
54
55
MIDDLEWARE = [
You can’t perform that action at this time.
0 commit comments