Merge branch 'develop' of ssh://gl.id-east.ru:222/gm/gm-backend into develop
This commit is contained in:
commit
2151c36d92
|
|
@ -15,9 +15,8 @@ class Command(BaseCommand):
|
|||
with connections['legacy'].cursor() as cursor:
|
||||
cursor.execute('''
|
||||
select a.email, a.id as account_id, a.encrypted_password, a.locale, a.city,
|
||||
a.confirmed_at as cfd,
|
||||
case when a.confirmed_at is not null then true else false end as confirmed_at,
|
||||
case when a.confirmed_at is null then true else false end as unconfirmed_email,
|
||||
a.confirmed_at as cfd, a.unconfirmed_email,
|
||||
case when a.confirmed_at is not null then true else false end as confirmed_at,
|
||||
nickname
|
||||
from accounts as a
|
||||
where a.email is not null and a.nickname!='admin'
|
||||
|
|
|
|||
34
apps/account/migrations/0036_auto_20200205_1457.py
Normal file
34
apps/account/migrations/0036_auto_20200205_1457.py
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
# Generated by Django 2.2.7 on 2020-02-05 14:57
|
||||
|
||||
import django.contrib.postgres.indexes
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('account', '0035_userrole_for_team'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddIndex(
|
||||
model_name='user',
|
||||
index=django.contrib.postgres.indexes.GinIndex(fields=['username'], name='account_use_usernam_20b96d_gin'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='user',
|
||||
index=django.contrib.postgres.indexes.GinIndex(fields=['first_name'], name='account_use_first_n_472c42_gin'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='user',
|
||||
index=django.contrib.postgres.indexes.GinIndex(fields=['last_name'], name='account_use_last_na_595e99_gin'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='user',
|
||||
index=django.contrib.postgres.indexes.GinIndex(fields=['email'], name='account_use_email_2f1668_gin'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='user',
|
||||
index=django.contrib.postgres.indexes.GinIndex(fields=['phone'], name='account_use_phone_9593fb_gin'),
|
||||
),
|
||||
]
|
||||
|
|
@ -5,6 +5,7 @@ from typing import List
|
|||
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.models import AbstractUser, UserManager as BaseUserManager
|
||||
from django.contrib.postgres.indexes import GinIndex
|
||||
from django.contrib.postgres.search import TrigramSimilarity
|
||||
from django.core.mail import send_mail
|
||||
from django.db import models
|
||||
|
|
@ -289,6 +290,13 @@ class User(PhoneModelMixin, AbstractUser):
|
|||
"""Meta class."""
|
||||
verbose_name = _('User')
|
||||
verbose_name_plural = _('Users')
|
||||
indexes = [
|
||||
GinIndex(fields=['username']),
|
||||
GinIndex(fields=['first_name']),
|
||||
GinIndex(fields=['last_name']),
|
||||
GinIndex(fields=['email']),
|
||||
GinIndex(fields=['phone']),
|
||||
]
|
||||
|
||||
def __str__(self):
|
||||
"""String method."""
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ from establishment import models, serializers as model_serializers
|
|||
from establishment.models import ContactEmail, ContactPhone, EstablishmentEmployee
|
||||
from establishment.serializers.common import ContactPhonesSerializer
|
||||
from gallery.models import Image
|
||||
from location.serializers import AddressDetailSerializer, TranslatedField
|
||||
from location.serializers import AddressDetailSerializer, TranslatedField, AddressBaseSerializer
|
||||
from main.models import Currency
|
||||
from main.serializers import AwardSerializer
|
||||
from utils.decorators import with_base_attributes
|
||||
|
|
@ -58,6 +58,7 @@ class EstablishmentListCreateSerializer(model_serializers.EstablishmentBaseSeria
|
|||
queryset=models.Address.objects.all(),
|
||||
write_only=True
|
||||
)
|
||||
address = AddressBaseSerializer(read_only=True, allow_null=True)
|
||||
transliterated_name = serializers.CharField(
|
||||
required=False, allow_null=True, allow_blank=True
|
||||
)
|
||||
|
|
@ -98,6 +99,8 @@ class EstablishmentListCreateSerializer(model_serializers.EstablishmentBaseSeria
|
|||
'website',
|
||||
'phones',
|
||||
'contact_phones',
|
||||
'toque_number',
|
||||
'public_mark',
|
||||
'emails',
|
||||
'price_level',
|
||||
'toque_number',
|
||||
|
|
@ -116,6 +119,7 @@ class EstablishmentListCreateSerializer(model_serializers.EstablishmentBaseSeria
|
|||
'lastable_id',
|
||||
'tags',
|
||||
'tz',
|
||||
'address',
|
||||
'address_id',
|
||||
'status',
|
||||
'status_display',
|
||||
|
|
|
|||
|
|
@ -19,7 +19,8 @@ from rest_framework.reverse import reverse
|
|||
from main.models import Carousel
|
||||
from rating.models import Rating
|
||||
from utils.models import (
|
||||
BaseAttributes, FavoritesMixin, GalleryMixin, HasTagsMixin, IntermediateGalleryModelMixin, ProjectBaseMixin,
|
||||
BaseAttributes, FavoritesMixin, GalleryMixin, HasTagsMixin, IntermediateGalleryModelMixin,
|
||||
ProjectBaseMixin,
|
||||
TJSONField, TranslatedFieldsMixin, TypeDefaultImageMixin,
|
||||
)
|
||||
from utils.querysets import TranslationQuerysetMixin
|
||||
|
|
@ -252,7 +253,7 @@ class NewsQuerySet(TranslationQuerysetMixin):
|
|||
).filter(relevance__gte=0.3).order_by('-relevance')
|
||||
|
||||
def available_news(self, user, country_code: str):
|
||||
"""Return QuerySet with news that user has an access."""
|
||||
"""Return QuerySet with news that user has access."""
|
||||
return self.filter(site__country__code=country_code) if not user.is_superuser else self
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -68,6 +68,10 @@ class Report(ProjectBaseMixin):
|
|||
verbose_name = _('Report')
|
||||
verbose_name_plural = _('Reports')
|
||||
|
||||
def __str__(self):
|
||||
"""Implement `str` dunder method."""
|
||||
return f'{self.id}: {self.get_category_display()} ({self.url})'
|
||||
|
||||
def get_body_email_message(self):
|
||||
"""Prepare the body of the email message"""
|
||||
return {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user