remotes/origin/setup
ArturBaybulatov 10 years ago
parent 381a06b87a
commit becf37b629
  1. 8
      api/views.py
  2. 11
      archilance/settings/base.py
  3. 1
      archilance/urls.py
  4. 14
      archilance/util.py
  5. 20
      common/templatetags/common_tags.py
  6. 16
      projects/forms.py
  7. 4
      projects/models.py
  8. 1
      requirements/base.txt
  9. 19
      reviews/migrations/0002_remove_review_is_secured.py
  10. 1
      reviews/models.py
  11. 4
      specializations/views.py
  12. 8
      users/forms.py
  13. 5
      users/templates/contractor_financical_info_edit.html
  14. 2
      users/templates/contractor_profile.html
  15. 7
      users/templates/contractor_profile_edit.html
  16. 2
      users/templates/customer_profile_current_projects.html
  17. 3
      users/templates/customer_profile_edit.html
  18. 1
      users/templates/customer_profile_open_projects.html
  19. 33
      users/templates/customer_profile_reviews.html
  20. 30
      users/views.py
  21. 4
      work_sell/forms.py

@ -55,8 +55,8 @@ class RealtyViewSet(ModelViewSet):
class SpecializationViewSet(ModelViewSet):
# queryset = Specialization.objects.root_nodes()[0].get_descendants()
queryset = Specialization.objects # TODO: Tmp
queryset = Specialization.objects.root_nodes()[0].get_descendants()
# queryset = Specialization.objects # Migrate with this enabled
serializer_class = SpecializationSerializer
filter_class = SpecializationFilterSet
@ -68,7 +68,7 @@ class UserViewSet(ModelViewSet):
class LocationViewSet(ModelViewSet):
# queryset = Location.objects.root_nodes()[0].get_descendants()
queryset = Location.objects # TODO: Tmp
queryset = Location.objects.root_nodes()[0].get_descendants()
# queryset = Location.objects # Migrate with this enabled
serializer_class = LocationSerializer
filter_class = LocationFilterSet

@ -39,6 +39,7 @@ THIRD_PARTY_APPS = [
'sorl.thumbnail',
'compressor',
'password_reset',
'mathfilters', # Basic math operations in templates; https://pypi.python.org/pypi/django-mathfilters
]
LOCAL_APPS = [
@ -74,6 +75,7 @@ TEMPLATES = [
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(ROOT_DIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
@ -81,6 +83,15 @@ TEMPLATES = [
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
# Load these templatetags by default:
'builtins': [
'django.templatetags.static',
'mathfilters.templatetags.mathfilters',
'common.templatetags.common_tags',
],
},
},
]

@ -7,6 +7,7 @@ from django.views.generic import TemplateView
from .views import HomeTemplateView, TestChatTemplateView
urlpatterns = [
url(r'^$', HomeTemplateView.as_view()),
url('', include('social.apps.django_app.urls', namespace='social')),

@ -49,3 +49,17 @@ def model_fields(model, width=200):
'Blank? %s' % f.blank if not f.is_relation else '(relation)',
'Hidden? %s' % (f.is_hidden() if hasattr(f, 'is_hidden') else False),
) for f in model._meta.get_fields(include_hidden=True)], width=width)
def lorem(sentences=5):
words = _.split((
'a ac adipiscing amet ante arcu at auctor augue bibendum commodo condimentum consectetur consequat convallis curabitur'
'cursus diam dictum dignissim dolor donec duis efficitur eget eleifend elit enim erat et eu ex facilisis faucibus feugiat'
'finibus gravida iaculis id imperdiet in integer ipsum lacinia lacus laoreet lectus leo libero ligula lobortis lorem'
'luctus maecenas mauris metus mi mollis morbi nam nec neque nisi non nulla nullam nunc odio orci ornare pellentesque'
'pharetra phasellus porta porttitor posuere pretium proin pulvinar purus quam quis rhoncus rutrum sapien sed sem semper'
'sit sollicitudin tempor tempus tincidunt tortor turpis ullamcorper ultricies ut varius vehicula vel velit vestibulum'
'vitae viverra volutpat vulputate'
), ' ')
return _.join(_.times(lambda i_: _.capitalize(_.join(_.sample(words, _.random(5, 30)), ' ')), sentences), '. ')

@ -2,15 +2,17 @@ from django import template
from pprint import pprint, pformat
import os
register = template.Library()
from archilance import util
register = template.Library()
# @register.inclusion_tag('templatetags/inspect.html', takes_context=True)
# def inspect(context, obj):
# return {'obj': pformat(obj.__dict__)}
@register.filter('inspect')
@register.filter
def inspect(obj):
return pformat(obj.__dict__)
@ -30,7 +32,12 @@ def to_str(val):
return str(val)
@register.filter('class_name')
@register.filter('range')
def to_range(num):
return range(num)
@register.filter
def class_name(val):
return type(val).__name__
@ -40,9 +47,14 @@ def multiply(string, times):
return string * times
@register.filter('basename')
@register.filter
def basename(val):
return os.path.basename(val)
@register.simple_tag
def lorem(*args, **kwargs):
return util.lorem(*args, **kwargs)
# import code; code.interact(local=dict(globals(), **locals()))

@ -46,8 +46,8 @@ class ProjectFilterForm(forms.ModelForm):
self.fields['specialization'].required = False
# self.fields['specialization'].queryset = Specialization.objects.root_nodes()[0].get_descendants()
self.fields['specialization'].queryset = Specialization.objects # TODO: Tmp
self.fields['specialization'].queryset = Specialization.objects.root_nodes()[0].get_descendants()
# self.fields['specialization'].queryset = Specialization.objects # Migrate with this enabled
class ProjectFilterRealtyForm(forms.ModelForm):
@ -75,8 +75,8 @@ class ProjectFilterRealtyForm(forms.ModelForm):
self.fields['construction_type'].empty_label = ''
self.fields['construction_type'].required = False
# self.fields['location'].queryset = Location.objects.root_nodes()[0].get_descendants()
self.fields['location'].queryset = Location.objects # TODO: Tmp
self.fields['location'].queryset = Location.objects.root_nodes()[0].get_descendants()
# self.fields['location'].queryset = Location.objects # Migrate with this enabled
class CustomerProjectEditForm(forms.ModelForm):
@ -117,8 +117,8 @@ class CustomerProjectEditForm(forms.ModelForm):
self.fields['realty'].empty_label = 'Создать новый'
# self.fields['specialization'].queryset = Specialization.objects.root_nodes()[0].get_descendants()
self.fields['specialization'].queryset = Specialization.objects # TODO: Tmp
self.fields['specialization'].queryset = Specialization.objects.root_nodes()[0].get_descendants()
# self.fields['specialization'].queryset = Specialization.objects # Migrate with this enabled
if self.instance.pk:
self.fields['files'].queryset = self.instance.files
@ -144,8 +144,8 @@ class RealtyForm(forms.ModelForm):
self.request = kwargs.pop('request')
super().__init__(*args, **kwargs)
# self.fields['location'].queryset = Location.objects.root_nodes()[0].get_descendants()
self.fields['location'].queryset = Location.objects # TODO: Tmp
self.fields['location'].queryset = Location.objects.root_nodes()[0].get_descendants()
# self.fields['location'].queryset = Location.objects # Migrate with this enabled
class Realty1Form(forms.Form):

@ -65,8 +65,8 @@ class Project(models.Model):
)
DEAL_TYPES = (
('secure_deal', 'Безопасная сделка (с резервированием бюджета) '),
('direct_payment', 'Прямая оплата Исполнителю на его кошелек/счет'),
('secure_deal', 'Безопасная сделка'), # "Безопасная сделка (с резервированием бюджета)"
('direct_payment', 'Прямая оплата'), # "Прямая оплата Исполнителю на его кошелек/счет"
)
STATES = (

@ -37,3 +37,4 @@ sorl-thumbnail==12.3
sqlparse==0.1.19
tornado==4.3
natsort
django-mathfilters

@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-07-24 12:51
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('reviews', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='review',
name='is_secured',
),
]

@ -2,7 +2,6 @@ from django.db import models
from django.core.validators import MaxValueValidator, MinValueValidator
class Review(models.Model):
is_secured = models.BooleanField(default=False)
project = models.ForeignKey('projects.Project', related_name='reviews')
stars = models.IntegerField(validators=[MinValueValidator(1), MaxValueValidator(5)])
text = models.TextField()

@ -15,8 +15,8 @@ class SpecListView(ListView):
context['root'] = root
context['children'] = root.get_children()
# context['roots'] = Specialization.objects.root_nodes()
context['roots'] = Specialization.objects.filter(name='_root') # TODO: Tmp
context['roots'] = Specialization.objects.root_nodes()
# context['roots'] = Specialization.objects.filter(name='_root') # Migrate with this enabled
return context

@ -62,14 +62,14 @@ class ContractorFilterForm(forms.Form):
reverse_order = forms.BooleanField(required=False)
specialization = forms.ModelChoiceField(
# queryset=Specialization.objects.root_nodes()[0].get_descendants(),
queryset=Specialization.objects, # TODO: Tmp,
queryset=Specialization.objects.root_nodes()[0].get_descendants(),
# queryset=Specialization.objects, # Migrate with this enabled
required=False,
)
location = forms.ModelChoiceField(
# queryset=Location.objects.root_nodes()[0].get_descendants(),
queryset=Location.objects, # TODO: Tmp
queryset=Location.objects.root_nodes()[0].get_descendants(),
# queryset=Location.objects, # Migrate with this enabled
required=False,
)

@ -1,7 +1,11 @@
{% extends 'partials/base.html' %}
{% load staticfiles %}
{% block content %}
{% include 'partials/header.html' %}
<div class="container mainScore">
<div class="row">
<div class="projectsBlock disTab">
@ -185,6 +189,7 @@
</div>
</div>
</form>
{% include 'partials/footer.html' %}
</div>
</div>

@ -2,6 +2,8 @@
{% load staticfiles %}
{% load thumbnail %}
{% block content %}
{% include 'partials/header.html' %}

@ -1,8 +1,12 @@
{% extends 'partials/base.html' %}
{% load staticfiles %}
{% load common_tags %}
{% block content %}
{% include 'partials/header.html' %}
{% include 'partials/header.html' %}
<div class="container mainScore">
<div class="row">
<form method="post" enctype="multipart/form-data">{% csrf_token %}
@ -127,6 +131,7 @@
</div>
</div>
{% endblock %}
{% block js_block %}
<script type="text/javascript">
$(function(){

@ -2,6 +2,8 @@
{% load user_tags %}
{% load staticfiles %}
{% block content %}
{% include 'partials/header.html' %}

@ -1,6 +1,9 @@
{% extends 'partials/base.html' %}
{% load staticfiles %}
{% load thumbnail %}
{% block content %}
{% include 'partials/header.html' %}
<div class="container mainScore">

@ -1,4 +1,5 @@
{% extends 'partials/base.html' %}
{% load staticfiles %}
{% block content %}

@ -1,5 +1,6 @@
{% extends 'partials/base.html' %}
{% block content %}
{% include 'partials/header.html' %}
@ -7,7 +8,37 @@
<div class="row">
{% include 'partials/customer_profile_info_block.html' %}
<h1>{{ customer }}</h1>
{% for review in reviews %}
<div class="new-comm-44">
<div class="col-lg-12">
<p class="nameComm">
<a href="#">{{ review.from_contractor.get_full_name }}</a>
</p>
<span class="dateComm44">
{{ review.project.get_deal_type_display }}
</span>
<div class="stars box-sizing">
{% for star in review.stars|range %}
<span class="glyphicon glyphicon-star starAct" aria-hidden="true"></span>
{% endfor %}
{% for filler_star in 5|sub:review.stars|range %}
<span class="glyphicon glyphicon-star" aria-hidden="true"></span>
{% endfor %}
{% if review.stars < 3 %}
<a href="#" onclick="return false" style="color: red">отрицательный отзыв</a>
{% else %}
<a href="#" onclick="return false">положительный отзыв</a>
{% endif %}
</div>
<p class="textComm44"><b>{{ review.text }}</b>{% if TEMPLATE_DEBUG %}. {% lorem %}{% endif %}</p>
</div>
</div>
{% endfor %}
{% include 'partials/footer.html' %}
</div>

@ -19,6 +19,7 @@ from .models import User, Team, ContractorFinancialInfo
from archilance.mixins import BaseMixin
from common.utils import get_or_none
from projects.forms import PortfolioForm
from reviews.models import Review
from specializations.models import Specialization
from work_sell.forms import WorkSellForm
@ -224,10 +225,16 @@ class ContractorProfileDetailView(DetailView):
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['worksell_form'] = self.worksell_form_class
context['portfolio_form'] = self.portfolio_form_class
context['resume_diploms'] = self.object.contractor_resume.resume_files.filter(type='diplom')
context['resume_cro'] = self.object.contractor_resume.resume_files.filter(type='cro')
resume = self.object.contractor_resume
if resume:
context['resume_diploms'] = resume.resume_files.filter(type='diplom')
context['resume_cro'] = resume.resume_files.filter(type='cro')
return context
@ -265,10 +272,23 @@ class CustomerProfileCurrentProjectsView(BaseMixin, DetailView):
context_object_name = 'customer'
class CustomerProfileReviewsView(BaseMixin, DetailView):
model = User
class CustomerProfileReviewsView(BaseMixin, View):
template_name = 'customer_profile_reviews.html'
context_object_name = 'customer'
def get(self, request, *args, **kwargs):
context = self.get_context_data(**_.merge({}, self.request.GET, kwargs))
customer = get_object_or_404(User.customer_objects, pk=self.kwargs['pk'])
reviews = Review.objects.filter(target_customer=customer)
# import code; code.interact(local=dict(globals(), **locals()))
context.update({
'reviews': reviews,
'customer': customer,
})
return render(request, self.template_name, context)
class CustomerProfileEditView(CheckForUserMixin, View):

@ -21,5 +21,5 @@ class WorkSellForm(forms.ModelForm):
# self.request = kwargs.pop('request')
super().__init__(*args, **kwargs)
# self.fields['location'].queryset = Location.objects.root_nodes()[0].get_descendants()
self.fields['location'].queryset = Location.objects # TODO: Tmp
self.fields['location'].queryset = Location.objects.root_nodes()[0].get_descendants()
# self.fields['location'].queryset = Location.objects # Migrate with this enabled

Loading…
Cancel
Save