Compare commits
1 Commits
9b57611b62
...
fix/evalua
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8207b750b8 |
@@ -13,7 +13,7 @@ from config.env import env
|
|||||||
|
|
||||||
|
|
||||||
def home(request):
|
def home(request):
|
||||||
return HttpResponse("OK: #4479a0c1a546a390cbe5b4cab61a7f2f996ff0f5")
|
return HttpResponse("OK: #7bcf7bdc7f8b10357921efee0415dc6211137338")
|
||||||
|
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
from django.contrib.auth import admin
|
from django.contrib.auth import admin
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django.utils.safestring import mark_safe
|
|
||||||
from unfold.admin import ModelAdmin
|
from unfold.admin import ModelAdmin
|
||||||
from unfold.forms import AdminPasswordChangeForm # UserCreationForm,
|
from unfold.forms import AdminPasswordChangeForm # UserCreationForm,
|
||||||
from unfold.forms import UserChangeForm
|
from unfold.forms import UserChangeForm
|
||||||
@@ -11,7 +10,6 @@ class CustomUserAdmin(admin.UserAdmin, ModelAdmin):
|
|||||||
# add_form = UserCreationForm
|
# add_form = UserCreationForm
|
||||||
form = UserChangeForm
|
form = UserChangeForm
|
||||||
list_display = (
|
list_display = (
|
||||||
"display_avatar",
|
|
||||||
"first_name",
|
"first_name",
|
||||||
"last_name",
|
"last_name",
|
||||||
"phone",
|
"phone",
|
||||||
@@ -19,7 +17,7 @@ class CustomUserAdmin(admin.UserAdmin, ModelAdmin):
|
|||||||
)
|
)
|
||||||
search_fields = ("phone", "first_name", "last_name", "username")
|
search_fields = ("phone", "first_name", "last_name", "username")
|
||||||
autocomplete_fields = ["groups", "user_permissions"]
|
autocomplete_fields = ["groups", "user_permissions"]
|
||||||
fieldsets = ((None, {"fields": ("phone", "avatar",)}),) + (
|
fieldsets = ((None, {"fields": ("phone",)}),) + (
|
||||||
(None, {"fields": ("username", "password")}),
|
(None, {"fields": ("username", "password")}),
|
||||||
(_("Personal info"), {"fields": ("first_name", "last_name", "email")}),
|
(_("Personal info"), {"fields": ("first_name", "last_name", "email")}),
|
||||||
(
|
(
|
||||||
@@ -38,15 +36,6 @@ class CustomUserAdmin(admin.UserAdmin, ModelAdmin):
|
|||||||
(_("Important dates"), {"fields": ("last_login", "date_joined")}),
|
(_("Important dates"), {"fields": ("last_login", "date_joined")}),
|
||||||
)
|
)
|
||||||
|
|
||||||
def display_avatar(self, obj):
|
|
||||||
if obj.avatar:
|
|
||||||
return mark_safe(
|
|
||||||
f'<img src="{obj.avatar.url}" width="35" height="35" style="border-radius: 50%; object-fit: cover;" />'
|
|
||||||
)
|
|
||||||
return _("No Image")
|
|
||||||
|
|
||||||
display_avatar.short_description = _("Avatar")
|
|
||||||
|
|
||||||
|
|
||||||
class PermissionAdmin(ModelAdmin):
|
class PermissionAdmin(ModelAdmin):
|
||||||
list_display = ("name",)
|
list_display = ("name",)
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
# Generated by Django 5.2.7 on 2026-03-17 12:32
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('accounts', '0002_alter_user_role'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AddField(
|
|
||||||
model_name='user',
|
|
||||||
name='avatar',
|
|
||||||
field=models.ImageField(blank=True, null=True, upload_to='avatars/'),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
@@ -16,7 +16,6 @@ class User(auth_models.AbstractUser):
|
|||||||
choices=RoleChoice,
|
choices=RoleChoice,
|
||||||
default=RoleChoice.USER,
|
default=RoleChoice.USER,
|
||||||
)
|
)
|
||||||
avatar = models.ImageField(upload_to="avatars/", null=True, blank=True)
|
|
||||||
|
|
||||||
USERNAME_FIELD = "phone"
|
USERNAME_FIELD = "phone"
|
||||||
objects = UserManager()
|
objects = UserManager()
|
||||||
|
|||||||
@@ -19,6 +19,5 @@ class UserUpdateSerializer(serializers.ModelSerializer):
|
|||||||
model = get_user_model()
|
model = get_user_model()
|
||||||
fields = [
|
fields = [
|
||||||
"first_name",
|
"first_name",
|
||||||
"last_name",
|
"last_name"
|
||||||
"avatar"
|
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ from django.contrib.auth import get_user_model
|
|||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django_core import exceptions
|
from django_core import exceptions
|
||||||
from drf_spectacular.utils import extend_schema
|
from drf_spectacular.utils import extend_schema
|
||||||
from rest_framework import status, throttling, request, parsers
|
from rest_framework import status, throttling, request
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from rest_framework.exceptions import PermissionDenied
|
from rest_framework.exceptions import PermissionDenied
|
||||||
from rest_framework.viewsets import GenericViewSet
|
from rest_framework.viewsets import GenericViewSet
|
||||||
@@ -160,11 +160,6 @@ class ResetPasswordView(BaseViewSetMixin, GenericViewSet, UserService):
|
|||||||
@extend_schema(tags=["me"])
|
@extend_schema(tags=["me"])
|
||||||
class MeView(BaseViewSetMixin, GenericViewSet, UserService):
|
class MeView(BaseViewSetMixin, GenericViewSet, UserService):
|
||||||
permission_classes = [IsAuthenticated]
|
permission_classes = [IsAuthenticated]
|
||||||
parser_classes = (
|
|
||||||
parsers.MultiPartParser,
|
|
||||||
parsers.FormParser,
|
|
||||||
parsers.JSONParser,
|
|
||||||
)
|
|
||||||
|
|
||||||
def get_serializer_class(self):
|
def get_serializer_class(self):
|
||||||
match self.action:
|
match self.action:
|
||||||
|
|||||||
@@ -94,9 +94,8 @@ class EvaluationrequestModel(AbstractBaseModel):
|
|||||||
choices=RequestStatus.choices,
|
choices=RequestStatus.choices,
|
||||||
default=RequestStatus.PENDING,
|
default=RequestStatus.PENDING,
|
||||||
)
|
)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"Request #{self.pk} — {self.get_rate_type_display()}"
|
return f"Requests #{self.pk} — {self.get_rate_type_display()}"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _baker(cls):
|
def _baker(cls):
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ services:
|
|||||||
max-file: "5"
|
max-file: "5"
|
||||||
|
|
||||||
web:
|
web:
|
||||||
image: husanjon/sifatbaho:47
|
image: husanjon/sifatbaho:46
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
environment:
|
environment:
|
||||||
|
|||||||
Reference in New Issue
Block a user