Сохраниться

This commit is contained in:
iriska-gri committed 2023-11-21 16:59:20 +03:00
1 parent a3ed933071
commit de8afb44cc
12 files changed
+30 -51

No files matched your search

+1
View File
@@ -73,6 +73,7 @@ class CustomAuth(ModelBackend):
homeuser.set_unusable_password()
homeuser.last_login= timezone.now()
homeuser.user=user
user.is_active=homeuser.is_active
user.is_staff=homeuser.is_staff
user.last_login=homeuser.last_login.strftime('%Y-%d-%m %H:%M:%S')
+3 -2
View File
@@ -51,7 +51,7 @@ class UserManager(BaseUserManager):
class User(AbstractBaseUser, PermissionsMixin):
user = models.ForeignKey(DictEmployee, on_delete=models.PROTECT,1 verbose_name='Человек')
user = models.ForeignKey(DictEmployee, on_delete=models.PROTECT, null=True, blank=True, verbose_name='Человек')
password = models.CharField(max_length=128, null=True,blank=True)
username = models.CharField(db_index=True, max_length=255, unique=True)
# username2 = models.CharField(db_index=True, null=True, max_length=255, unique=True)
@@ -68,4 +68,5 @@ class User(AbstractBaseUser, PermissionsMixin):
return str(self.username)
def fio(self):
return DictEmployee.objects.using('user_directory').get(login=self.username).fio
return self.user.login
# return DictEmployee.objects.using('user_directory').get(login=self.username).fio
+1 -1
View File
@@ -28,7 +28,7 @@ class testView(APIView):
# a['showComment'] = False
# a['author'] = model_to_dict(DictEmployee.objects.using('user_directory').get(login=x.author.username))
a['scores'] = [{"score":y.score, "user":y.author.username} for y in x.get_news.all()]
a['comment'] = [{"author":model_to_dict(DictEmployee.objects.using('user_directory').get(login=k.author.username)),
a['comment'] = [{"author":model_to_dict(k.author.user),
"cdate":k.cdate,
"text":k.text,
"id": k.pk