remotes/origin/PR-39
ArturBaybulatov 10 years ago
parent f7b25a91c4
commit 17c49e116f
  1. 14
      archilance/settings/base.py
  2. 5
      projects/models.py
  3. 12
      projects/templates/project_filter.html
  4. 4
      ratings/models.py
  5. 4
      users/models.py
  6. 4
      users/templates/contractor_filter.html
  7. 196
      users/templates/contractor_office.html
  8. 10
      users/templates/contractor_office_open_projects.html
  9. 4
      users/urls.py
  10. 26
      users/views.py
  11. 19
      work_sell/migrations/0005_remove_worksell_img.py
  12. 5
      work_sell/models.py

@ -1,5 +1,7 @@
from django.core.files.storage import FileSystemStorage
import os import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...) # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
ROOT_DIR = os.path.dirname(BASE_DIR) ROOT_DIR = os.path.dirname(BASE_DIR)
@ -286,3 +288,15 @@ else:
'shop_id': 0, 'shop_id': 0,
'scid': 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

@ -269,6 +269,7 @@ class Portfolio(models.Model):
budget = models.DecimalField(max_digits=10, decimal_places=0, default=0, null=True, blank=True) 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) building_classification = models.ForeignKey(BuildingClassfication, related_name='portfolios', null=True, blank=True)
construction_type = models.ForeignKey(ConstructionType, 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) currency = models.CharField(max_length=20, default='rur', choices=CURRENCIES, null=True, blank=True)
description = models.TextField() description = models.TextField()
location = TreeForeignKey('common.Location', related_name='portfolios', null=True, blank=True) 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) 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) user = models.ForeignKey(User, related_name='portfolios', null=True, blank=True)
worksell = models.BooleanField(default=False) worksell = models.BooleanField(default=False)
created = models.DateTimeField(default=timezone.now)
def __str__(self): def __str__(self):
return self.name return self.name
@ -302,8 +302,7 @@ class Portfolio(models.Model):
def get_cover(self): def get_cover(self):
photo = self.photos.first() 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): class PortfolioPhoto(models.Model):

@ -180,11 +180,13 @@
<a href="{% url 'projects:detail' pk=project.pk %}">{{ project.name }}</a> <a href="{% url 'projects:detail' pk=project.pk %}">{{ project.name }}</a>
</p> </p>
<ul class="desPro"> {% if project.realty %}
<li> <ul class="desPro">
Объект "{{ project.realty.name }}" <li>
</li> Объект "{{ project.realty.name }}"
</ul> </li>
</ul>
{% endif %}
<p class="textPro">{{ project.text|linebreaksbr|truncatechars:300 }}</p> <p class="textPro">{{ project.text|linebreaksbr|truncatechars:300 }}</p>

@ -22,7 +22,7 @@ class HistoryRating(models.Model):
class SpecializationRating(models.Model): class SpecializationRating(models.Model):
user = models.ForeignKey(User, related_name='specialization_rating', null=True, blank=True) user = models.ForeignKey(User, related_name='specialization_rating', null=True, blank=True)
team = models.ForeignKey(Team, 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) position = models.PositiveIntegerField(default=0)
def __str__(self): def __str__(self):
@ -31,5 +31,3 @@ class SpecializationRating(models.Model):
class Meta: class Meta:
verbose_name = 'Рейтинг специализаций' verbose_name = 'Рейтинг специализаций'
verbose_name_plural = 'Рейтинги специализаций' verbose_name_plural = 'Рейтинги специализаций'

@ -195,6 +195,10 @@ class User(AbstractBaseUser, PermissionsMixin):
def is_owner_team(self): def is_owner_team(self):
return Team.objects.filter(owner=self.pk).exists() 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): class Team(models.Model):

@ -196,7 +196,9 @@
</a> </a>
</li> </li>
<li> <li>
<a href="javascript:void(0)"> {# TODO #}
{# <a href="{% url 'chat:chat-user' %}?user_id={{ team..owner.pk }}">#}
<a href="#">
написать сообщение написать сообщение
</a> </a>
</li> </li>

@ -16,57 +16,61 @@
{% include 'partials/contractor_profile_tabs.html' %} {% include 'partials/contractor_profile_tabs.html' %}
<div class="buttonGP disTab"> <div class="buttonGP disTab">
<div class="btn-group valProject2 val-pro3" role="group" aria-label="..."> <div class="btn-group valProject2 val-pro3" role="group">
<button type="button" class="btn btn-default"> <button type="button" class="btn btn-default">
Группа 1 {{ contractor.team.name }}
<span><mark>7</mark></span> <span><mark>0</mark></span>
</button> </button>
{% if not contractor.is_owner_team %} {% if not contractor.is_owner_team %}
<button type="button" class="btn btn-default add-group" data-toggle="modal" <button type="button" class="btn btn-default add-group" data-toggle="modal" data-target="#myModal">
data-target="#myModal">
+ Добавить группу + Добавить группу
</button> </button>
{% endif %} {% endif %}
</div> </div>
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document"> <div class="modal-dialog" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span <button type="button" class="close" data-dismiss="modal" aria-label="Close">
aria-hidden="true">&times;</span></button> <span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="myModalLabel">Добавление новой группы</h4> <h4 class="modal-title" id="myModalLabel">Добавление новой группы</h4>
</div> </div>
<div class="modal-body">
<form method="post" action="{% url 'users:team-create' %}">{% csrf_token %} <form method="post" action="{% url 'users:team-create' %}">{% csrf_token %}
<div class="modal-body">
<div class="textAreaBlock2 text-nn box-sizing disTab"> <div class="textAreaBlock2 text-nn box-sizing disTab">
<p>Название <span style="color: red">{{ form_team.name.errors.as_text }}</span></p> <p>Название <span style="color: red">{{ form_team.name.errors.as_text }}</span></p>
<input type="text" class="box-sizing" name="{{ form_team.name.html_name }}"> <input type="text" class="box-sizing" name="{{ form_team.name.html_name }}">
</div> </div>
</div>
</div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Закрыть</button> <button type="button" class="btn btn-default" data-dismiss="modal">Закрыть</button>
<button type="submit" class="btn btn-primary">Сохранить</button> <button type="submit" class="btn btn-primary">Сохранить</button>
</div>
</div>
</form> </form>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
{% if contractor.is_owner_team %} {% if contractor.is_owner_team %}
<div class="projectsBlock disTab"> <div class="projectsBlock disTab">
<div class="col-lg-12"> <div class="col-lg-12">
<div class="col-lg-3 divCol3"> <div class="col-lg-3 divCol3">
<div class="avatar"> <div class="avatar">
<div class="avatarInset"> <div class="avatarInset">
{% thumbnail contractor.avatar "265x264" crop="center" as im %} {% if contractor.avatar %}
<img src="{{ im.url }}" alt="profile-image"> {% thumbnail contractor.avatar "265x264" crop="center" as im %}
{% endthumbnail %} <img src="{{ im.url }}" alt="profile-image">
{% endthumbnail %}
{% else %}
<img src="{% static 'img/profile.jpg' %}" alt="profile-image">
{% endif %}
</div> </div>
</div> </div>
@ -79,23 +83,25 @@
<p>Состав группы</p> <p>Состав группы</p>
{% for p in participants %} {% for p in participants %}
<div class="message-new"> <div class="message-new">
<div class="imgMess"> <div class="imgMess">
{% thumbnail p.avatar "60x60" crop="center" as im %} {% if p.avatar %}
<img src="{{ im.url }}" alt="mess-image"> {% thumbnail p.avatar "60x60" crop="center" as im %}
{% endthumbnail %} <img src="{{ im.url }}" alt="mess-image">
{% endthumbnail %}
{% else %}
<img src="{% static 'img/profile.jpg' %}" alt="mess-image">
{% endif %}
</div> </div>
<p class="nameMess"> <p class="nameMess" style="float: none">
<a href="{% url 'users:contractor-profile' p.pk %}">{{ p.get_full_name }}</a> <a href="{% url 'users:contractor-profile' p.pk %}">{{ p.get_full_name }}</a>
</p> </p>
<span>Программист</span> <p><span>{{ p.get_popular_specialization }}</span></p>
</div> </div>
{% empty %} {% empty %}
В группе пока нет участников В группе пока нет участников
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
@ -103,18 +109,18 @@
<div class="col-lg-9 divCol9"> <div class="col-lg-9 divCol9">
<div class="col-lg-4"> <div class="col-lg-4">
<p class="nameUser"> <p class="nameUser">{{ contractor.team.name }}</p>
{{ contractor.team }}
</p>
<p class="cityUser">Россия, Москва</p> <p class="cityUser">Россия, Москва</p>
{# <p class="navv">На сайте 8 лет и 3 месяца</p>#}
<p class="navv">На сайте {{ contractor.team.created }}</p> <p class="navv">На сайте {{ contractor.team.created }}</p>
<p class="navv"> <p class="navv">
Кол-во человек: <span>{{ participants_count }}</span> Кол-во человек: <span>{{ participants_count }}</span>
</p> </p>
<p class="navv"> <p class="navv">
Выполненных проектов: <span>0</span> Выполненных проектов: <span>0</span>
</p> </p>
<div class="statusUser st-new">Свободен</div> <div class="statusUser st-new">Свободен</div>
<a href="javascript:void(0)" class="new-prop new-prop2 new-prop3">написать сообщение</a> <a href="javascript:void(0)" class="new-prop new-prop2 new-prop3">написать сообщение</a>
</div> </div>
@ -124,20 +130,17 @@
</div> </div>
<div class="col-lg-4"> <div class="col-lg-4">
{% if contractor.team %} {% ratings_team_widget contractor.team.pk %}
{% ratings_team_widget contractor.team.pk %}
{% endif %}
{% if contractor.cro %} {% if contractor.cro %}
<div class="sroUser"> <div class="sroUser">
<div class="iconSRO"></div> <div class="iconSRO"></div>
<p>Есть допуск СРО</p> <p>Есть допуск СРО</p>
</div> </div>
{% endif %} {% endif %}
</div> </div>
</div> </div>
<div class="col-lg-9"> <div class="col-lg-9">
<div class="profileTabs2"> <div class="profileTabs2">
<ul class="nav nav-tabs nav-justified"> <ul class="nav nav-tabs nav-justified">
@ -156,55 +159,41 @@
<div class="tab-content"> <div class="tab-content">
<div id="tab11" class="tab-pane fade in active"> <div id="tab11" class="tab-pane fade in active">
<div class="galleryWork2 disTab col-lg-9"> <div class="galleryWork2 disTab col-lg-9">
{% for p in portfolios %} {% for p in portfolios %}
<div class="col-lg-4"> <div class="col-lg-4">
<div class="insetCol box-sizing disTab"> <div class="insetCol box-sizing disTab">
<div class="imgGal" <div class="imgGal" style="background:rgba(0, 0, 0, 0) url('{{ p.photos.first.img.url }}') no-repeat scroll center center / cover ;">
style="background:rgba(0, 0, 0, 0) url('{{ p.get_cover }}') no-repeat scroll center center / cover ;">
<div class="imgFigure"></div> <div class="imgFigure"></div>
</div> </div>
</div> </div>
<div class="insetCol2 box-sizing disTab"> <div class="insetCol2 box-sizing disTab text-center">
<a href="{% url 'projects:contractor-portfolio-detail' p.pk %}">{{ p }}</a> <a href="{% url 'projects:contractor-portfolio-detail' p.pk %}">{{ p.name }}</a>
<div class="buttonsImg" disTab>
<a href="{% url 'projects:contractor-portfolio-edit' p.pk %}">
<div class="insetBI insetBI1">
<i class="fa fa-pencil"></i>
</div>
</a>
<div class="insetBI insetBI2">
<i class="fa fa-times"></i>
</div>
</div>
</div> </div>
</div> </div>
{% empty %} {% empty %}
<div class="col-lg-12"> <div class="col-lg-12">
<p style="text-align: center;margin-top: 25px;">Работ в портфолио пока нет</p> <p style="text-align: center;margin-top: 25px;">Работ в портфолио пока нет</p>
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
{# TODO:#}
{# <div class="col-lg-9 col-lg-offset-3">#} <div class="col-lg-9 col-lg-offset-3">
{# <div class="linkElse">#} <div class="linkElse">
{# <a href="javascript:void(0)" class="showElse">показать еще</a>#} <a href="javascript:void(0)" class="showElse">показать еще</a>
{# </div>#} </div>
{# </div>#} </div>
</div> </div>
<div id="tab12" class="tab-pane fade"> <div id="tab12" class="tab-pane fade">
<div class="galleryWork2 disTab"> <div class="galleryWork2 disTab">
{% for ws in work_sells %} {% for ws in work_sells %}
<div class="col-lg-4"> <div class="col-lg-4">
<div class="insetCol box-sizing disTab"> <div class="insetCol box-sizing disTab">
<div class="imgGal" <div class="imgGal" style="background:rgba(0, 0, 0, 0) url('{{ ws.photos.first.img.url }}') no-repeat scroll center center / cover ;">
style="background:rgba(0, 0, 0, 0) url('/media/{{ ws.img }}') no-repeat scroll center center / cover ;">
<div class="imgFigure"></div> <div class="imgFigure"></div>
</div> </div>
<div class="cenaImg box-sizing"> <div class="cenaImg box-sizing">
<div class="cenaImgInset"> <div class="cenaImgInset">
{{ ws.budget }} <i class="fa fa-rub"></i> {{ ws.budget }} <i class="fa fa-rub"></i>
@ -212,48 +201,49 @@
</div> </div>
</div> </div>
<div class="insetCol2 box-sizing disTab"> <div class="insetCol2 box-sizing disTab">
<a href="{% url 'work_sell:detail' ws.pk %}">{{ ws }}</a> <a href="{% url 'work_sell:detail' ws.pk %}">{{ ws.name }}</a>
</div> </div>
</div> </div>
{% empty %} {% empty %}
<div class="col-lg-12"> <div class="col-lg-12">
<p style="text-align: center;margin-top: 25px;">Готовых работ пока нет</p> <p style="text-align: center;margin-top: 25px;">Готовых работ пока нет</p>
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
{# TODO#}
{# <div class="col-lg-9 col-lg-offset-3">#} <div class="col-lg-9 col-lg-offset-3">
{# <div class="linkElse">#} <div class="linkElse">
{# <a href="javascript:void(0)" class="showElse">показать еще</a>#} <a href="javascript:void(0)" class="showElse">показать еще</a>
{# </div>#} </div>
{# </div>#} </div>
</div> </div>
<div id="tab13" class="tab-pane fade"> <div id="tab13" class="tab-pane fade">
{% for review in reviews %} {% for review in reviews %}
<div class="new-comm-44"> <div class="new-comm-44">
<div class="col-lg-12"> <div class="col-lg-12">
<p class="nameComm"> <p class="nameComm">
<a href="">{{ review.get_sender }}</a> <a href="#">{{ review.get_sender }}</a>
</p> </p>
{% if review.project.deal_type == 'secure_deal' %}
<span class="dateComm44"> {% if review.project.deal_type == 'secure_deal' %}
Безопасная сделка <span class="dateComm44">Безопасная сделка</span>
</span> {% endif %}
{% endif %}
<div class="stars box-sizing"> <div class="stars box-sizing">
<a href="#">положительный отзыв</a> <a href="#">положительный отзыв</a>
</div>
<p class="textComm44">
{{ review.text|safe }}
</p>
</div> </div>
<p class="textComm44">
{{ review.text|safe }}
</p>
</div> </div>
</div> {% empty %}
{% empty %} <div class="new-comm-44">
<div class="new-comm-44"> <p style="text-align: center;">Отзывов пока нет</p>
<p style="text-align: center;">Отзывов пока нет</p> </div>
</div> {% endfor %}
{% endfor %}
</div> </div>
</div> </div>
</div> </div>

@ -26,7 +26,7 @@
<div class="btn-group valProject2" role="group"> <div class="btn-group valProject2" role="group">
<a href="#" data-param-name="archived" data-default onclick="return false" class="btn btn-default -nav"> <a href="#" data-param-name="archived" data-default onclick="return false" class="btn btn-default -nav">
Открытые проекты Открытые проекты
<span><mark>0</mark> / <span>{{ active_project_count }}</span></span> <span><mark>0</mark> / <span>{{ open_project_count }}</span></span>
</a> </a>
<a href="#" data-param-name="archived" data-param-val="on" onclick="return false" class="btn btn-default -nav"> <a href="#" data-param-name="archived" data-param-val="on" onclick="return false" class="btn btn-default -nav">
@ -44,9 +44,11 @@
<p class="titlePro">{{ project.name }}</p> <p class="titlePro">{{ project.name }}</p>
</a> </a>
<ul class="desPro"> {% if project.realty %}
<li>Объект "{{ project.realty.name }}"</li> <ul class="desPro">
</ul> <li>Объект "{{ project.realty.name }}"</li>
</ul>
{% endif %}
<p class="textPro">{{ project.text|linebreaksbr|truncatechars:300 }}</p> <p class="textPro">{{ project.text|linebreaksbr|truncatechars:300 }}</p>

@ -5,8 +5,8 @@ from django.contrib.auth.views import login, logout
from .views import ( from .views import (
contractor_resumefile_create, contractor_resumefile_create,
ContractorFilterView, ContractorFilterView,
ContractorOfficeDetailView,
ContractorOfficeProjectsView, ContractorOfficeProjectsView,
ContractorOfficeView,
ContractorProfileDetailView, ContractorProfileDetailView,
ContractorResumeUpdateView, ContractorResumeUpdateView,
CustomerProfileCurrentProjectsView, CustomerProfileCurrentProjectsView,
@ -35,6 +35,6 @@ urlpatterns = [
urls.url(r'^contractors/team/create/$', TeamCreateView.as_view(), name='team-create'), urls.url(r'^contractors/team/create/$', TeamCreateView.as_view(), name='team-create'),
urls.url(r'^contractorsresumefiles/create/$', contractor_resumefile_create, name='contractor-resume-file-create'), urls.url(r'^contractorsresumefiles/create/$', contractor_resumefile_create, name='contractor-resume-file-create'),
urls.url(r'^contractors/(?P<pk>\d+)/$', ContractorProfileDetailView.as_view(), name='contractor-profile'), urls.url(r'^contractors/(?P<pk>\d+)/$', ContractorProfileDetailView.as_view(), name='contractor-profile'),
urls.url(r'^contractor-office/(?P<pk>\d+)/$', ContractorOfficeDetailView.as_view(), name='contractor-office'), urls.url(r'^contractor-office/(?P<pk>\d+)/$', ContractorOfficeView.as_view(), name='contractor-office'),
urls.url(r'^contractor-office/(?P<pk>\d+)/open-projects/$', ContractorOfficeProjectsView.as_view(), name='contractor-office-open-projects'), urls.url(r'^contractor-office/(?P<pk>\d+)/open-projects/$', ContractorOfficeProjectsView.as_view(), name='contractor-office-open-projects'),
] ]

@ -358,26 +358,31 @@ class ContractorProfileDetailView(DetailView):
return context return context
class ContractorOfficeDetailView(DetailView): class ContractorOfficeView(DetailView):
model = User model = User
template_name = 'contractor_office.html' template_name = 'contractor_office.html'
context_object_name = 'contractor' context_object_name = 'contractor'
form_team = TeamForm form_class = TeamForm
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
context['form_team'] = TeamForm context['form_team'] = self.form_class
participants = []
if self.object.is_owner_team(): if self.object.is_owner_team():
participants = self.object.team.contractors.all() participants = self.object.team.contractors.all()
user_ids = [p.pk for p in participants]
context['participants'] = participants context['participants'] = participants
context['participants_count'] = len(participants) context['participants_count'] = len(participants)
portfolios = Portfolio.objects.filter(user__in=user_ids)
work_sells = WorkSell.objects.filter(contractor__in=user_ids) contractors = tuple(itertools.chain(participants, (self.object,)))
portfolios = Portfolio.objects.filter(user__in=contractors)
context['portfolios'] = portfolios context['portfolios'] = portfolios
work_sells = WorkSell.objects.filter(contractor__in=contractors)
context['work_sells'] = work_sells context['work_sells'] = work_sells
context['reviews'] = Review.objects.filter(target_contractor__in=user_ids)
context['reviews'] = Review.objects.filter(target_contractor__in=contractors)
return context return context
@ -385,8 +390,7 @@ class ContractorOfficeProjectsView(BaseMixin, View):
template_name = 'contractor_office_open_projects.html' template_name = 'contractor_office_open_projects.html'
def dispatch(self, request, *args, **kwargs): def dispatch(self, request, *args, **kwargs):
# if request.user.is_authenticated() and request.user.is_contractor() and request.user.pk == int(kwargs.get('pk')): if request.user.is_authenticated() and request.user.is_contractor() and request.user.pk == int(kwargs.get('pk')):
if request.user.is_authenticated():
return super().dispatch(request, *args, **kwargs) return super().dispatch(request, *args, **kwargs)
else: else:
raise PermissionDenied raise PermissionDenied
@ -397,8 +401,6 @@ class ContractorOfficeProjectsView(BaseMixin, View):
contractor = get_object_or_404(User.contractor_objects, pk=kwargs.get('pk')) contractor = get_object_or_404(User.contractor_objects, pk=kwargs.get('pk'))
context['contractor'] = contractor context['contractor'] = contractor
# TODO: Show projects only with "active" state
private_open_projects = tuple(a.project for a in contractor.contractor_answers.filter(project__state='active', rejected=False)) private_open_projects = tuple(a.project for a in contractor.contractor_answers.filter(project__state='active', rejected=False))
private_archived_projects = tuple(a.project for a in contractor.contractor_answers.filter(project__state='active', rejected=True)) private_archived_projects = tuple(a.project for a in contractor.contractor_answers.filter(project__state='active', rejected=True))

@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-08-26 12:55
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('work_sell', '0004_merge'),
]
operations = [
migrations.RemoveField(
model_name='worksell',
name='img',
),
]

@ -11,14 +11,15 @@ from specializations.models import Specialization
class WorkSell(models.Model): class WorkSell(models.Model):
# TODO: Add consistency ("work_sell" vs "worksell"):
budget = models.DecimalField(max_digits=10, decimal_places=0, default=0, null=True, blank=True) budget = models.DecimalField(max_digits=10, decimal_places=0, default=0, null=True, blank=True)
building_classification = models.ForeignKey(BuildingClassfication, related_name='worksells', null=True, blank=True) building_classification = models.ForeignKey(BuildingClassfication, related_name='worksells', null=True, blank=True)
construction_type = models.ForeignKey(ConstructionType, related_name='worksells', null=True, blank=True) construction_type = models.ForeignKey(ConstructionType, related_name='worksells', null=True, blank=True)
contractor = models.ForeignKey(User, related_name='work_sell', null=True, blank=True) contractor = models.ForeignKey(User, related_name='work_sell', null=True, blank=True) # TODO: Pluralize related name
created = models.DateTimeField(default=timezone.now) created = models.DateTimeField(default=timezone.now)
currency = models.CharField(max_length=20, default='rur', choices=CURRENCIES, null=True, blank=True) currency = models.CharField(max_length=20, default='rur', choices=CURRENCIES, null=True, blank=True)
description = models.TextField(blank=True) description = models.TextField(blank=True)
img = ImageField(upload_to='worksell/worksell', null=True, blank=True)
location = TreeForeignKey('common.Location', related_name='worksells', null=True, blank=True) location = TreeForeignKey('common.Location', related_name='worksells', null=True, blank=True)
name = models.CharField(max_length=255) name = models.CharField(max_length=255)
specialization = TreeForeignKey(Specialization, related_name='worksells', null=True, blank=True) specialization = TreeForeignKey(Specialization, related_name='worksells', null=True, blank=True)

Loading…
Cancel
Save