diff --git a/archilance/settings/base.py b/archilance/settings/base.py index 13c9b8e..bb5c56e 100644 --- a/archilance/settings/base.py +++ b/archilance/settings/base.py @@ -1,5 +1,7 @@ +from django.core.files.storage import FileSystemStorage import os + # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) ROOT_DIR = os.path.dirname(BASE_DIR) @@ -286,3 +288,15 @@ else: 'shop_id': 0, 'scid': 0, }) + + +# class ASCIIFileSystemStorage(FileSystemStorage): +# def get_valid_name(self, name): +# symbols = (u"абвгдеёжзийклмнопрстуфхцчшщъыьэюяАБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ", +# u"abvgdeejzijklmnoprstufhzcss_y_euaABVGDEEJZIJKLMNOPRSTUFHZCSS_Y_EUA") +# +# tr = {ord(a):ord(b) for a, b in zip(*symbols)} +# name = name.translate(tr) +# return super().get_valid_name(name) +# +# DEFAULT_FILE_STORAGE = ASCIIFileSystemStorage diff --git a/projects/models.py b/projects/models.py index f7273d1..7c1e158 100644 --- a/projects/models.py +++ b/projects/models.py @@ -269,6 +269,7 @@ class Portfolio(models.Model): budget = models.DecimalField(max_digits=10, decimal_places=0, default=0, null=True, blank=True) building_classification = models.ForeignKey(BuildingClassfication, related_name='portfolios', null=True, blank=True) construction_type = models.ForeignKey(ConstructionType, related_name='portfolios', null=True, blank=True) + created = models.DateTimeField(default=timezone.now) currency = models.CharField(max_length=20, default='rur', choices=CURRENCIES, null=True, blank=True) description = models.TextField() location = TreeForeignKey('common.Location', related_name='portfolios', null=True, blank=True) @@ -278,7 +279,6 @@ class Portfolio(models.Model): term_type = models.CharField(max_length=20, choices=TERMS, default='hour', null=True, blank=True) user = models.ForeignKey(User, related_name='portfolios', null=True, blank=True) worksell = models.BooleanField(default=False) - created = models.DateTimeField(default=timezone.now) def __str__(self): return self.name @@ -302,8 +302,7 @@ class Portfolio(models.Model): def get_cover(self): photo = self.photos.first() - return photo and photo.img - + return photo and photo.img # WTF? We could at leat return a URL, not an object class PortfolioPhoto(models.Model): diff --git a/projects/templates/project_filter.html b/projects/templates/project_filter.html index b012e46..154f280 100644 --- a/projects/templates/project_filter.html +++ b/projects/templates/project_filter.html @@ -180,11 +180,13 @@ {{ project.name }}
-{{ project.text|linebreaksbr|truncatechars:300 }}
diff --git a/ratings/models.py b/ratings/models.py index 375907b..a231776 100644 --- a/ratings/models.py +++ b/ratings/models.py @@ -22,7 +22,7 @@ class HistoryRating(models.Model): class SpecializationRating(models.Model): user = models.ForeignKey(User, related_name='specialization_rating', null=True, blank=True) team = models.ForeignKey(Team, related_name='specialization_rating', null=True, blank=True) - specialization = models.ForeignKey(Specialization, related_name='specialization_rating') + specialization = models.ForeignKey(Specialization, related_name='specialization_rating') # TODO: Pluralize related name position = models.PositiveIntegerField(default=0) def __str__(self): @@ -31,5 +31,3 @@ class SpecializationRating(models.Model): class Meta: verbose_name = 'Рейтинг специализаций' verbose_name_plural = 'Рейтинги специализаций' - - diff --git a/users/models.py b/users/models.py index 13bbfab..432e1f2 100644 --- a/users/models.py +++ b/users/models.py @@ -195,6 +195,10 @@ class User(AbstractBaseUser, PermissionsMixin): def is_owner_team(self): return Team.objects.filter(owner=self.pk).exists() + + def get_popular_specialization(self): + from ratings.models import SpecializationRating + return SpecializationRating.objects.filter(user=self).order_by('position').first().specialization.name class Team(models.Model): diff --git a/users/templates/contractor_filter.html b/users/templates/contractor_filter.html index 32817e4..9bf6121 100644 --- a/users/templates/contractor_filter.html +++ b/users/templates/contractor_filter.html @@ -196,7 +196,9 @@