Persistent Bootstrap tabs; Delete candidates from comparison on answer rejection; Fix duplicate candidate addition bug; Fix currency symbols everywhere

remotes/origin/PR-39
ArturBaybulatov 10 years ago
parent 776d96a165
commit 925fb62ec2
  1. 3
      archilance/mixins.py
  2. 1
      archilance/settings/base.py
  3. 3
      archilance/settings/dev.py
  4. 1
      archilance/settings/prod.py
  5. 4
      archilance/urls.py
  6. 28
      archilance/views.py
  7. 9
      common/templatetags/common_tags.py
  8. 4
      projects/models.py
  9. 13
      projects/templates/comparison.html
  10. 18
      projects/templates/project_detail.html
  11. 2
      projects/templates/project_filter.html
  12. 19
      projects/views.py
  13. 48
      templates/partials/base_test.html
  14. 6
      templates/test.html
  15. 2
      users/templates/contractor_office_open_projects.html
  16. 16
      users/templates/contractor_profile.html
  17. 2
      users/templates/customer_profile_open_projects.html
  18. 2
      users/templates/customer_profile_trashed_projects.html
  19. 2
      work_sell/templates/worksell_detail.html
  20. 2
      work_sell/templates/worksells_list.html

@ -17,7 +17,8 @@ class BaseMixin(ContextMixin):
c['domain'] = Site.objects.get_current().domain
c['TEMPLATE_DEBUG'] = settings.TEMPLATE_DEBUG
c['TEMPLATE_DEBUG'] = getattr(settings, 'TEMPLATE_DEBUG', None)
c['TESTING'] = getattr(settings, 'TESTING', None)
return c

@ -14,7 +14,6 @@ SECRET_KEY = 'vb6@b9zj7^f!^+x*e8=e!oundyu1!e*&0i(3gu2xwo4%fx4h&n'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
TEMPLATE_DEBUG = True # Show debug info in templates. See `projects/templates/project_filter.html`
ALLOWED_HOSTS = []

@ -1,8 +1,5 @@
from .base import *
# AUTH_PASSWORD_VALIDATORS = []
# INSTALLED_APPS += ['debug_toolbar',]
try:
from .local import *
except ImportError:

@ -14,7 +14,6 @@ DATABASES = {
DEBUG = True
TEMPLATE_DEBUG = True
THUMBNAIL_DEBUG = True
SECRET_KEY = 'vb6@b9zj7^f!^+x*e8=e!oundyu1!e*&0i(3gu2xwo4%fx4h&n'

@ -5,7 +5,7 @@ from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.views.generic import TemplateView
from .views import HomeTemplateView, TestChatTemplateView
from .views import HomeTemplateView, TestChatTemplateView, TestView
from wallets.views import TmpCheckOrderView, TmpPaymentAvisoView
from wagtail.wagtailadmin import urls as wagtailadmin_urls
@ -17,7 +17,7 @@ urlpatterns = [
url('', include('social.apps.django_app.urls', namespace='social')),
url(r'^chattest/$', TestChatTemplateView.as_view()),
url(r'^work_sell/', include('work_sell.urls')),
url(r'^test/$', TemplateView.as_view(template_name='test.html'), name='test'),
url(r'^test/$', TestView.as_view(), name='test'),
url(r'^projects/', include('projects.urls')),
url(r'^reviews/', include('reviews.urls')),
url(r'^wallets/', include('wallets.urls')),

@ -1,9 +1,15 @@
from django.conf import settings
from django.contrib import messages
from django.core.exceptions import PermissionDenied
from django.core.files.base import ContentFile
from django.shortcuts import render
from django.template.loader import render_to_string
from django.core.urlresolvers import reverse, reverse_lazy
from django.http import HttpResponseForbidden, JsonResponse, HttpResponseRedirect, HttpResponse, Http404
from django.shortcuts import render, get_object_or_404, redirect
from django.views.generic import TemplateView, View
from pprint import pprint, pformat
import logging
from .mixins import BaseMixin
from chat.models import Documents
from common.models import MainPage, PrintDocuments
from projects.models import Order
@ -11,12 +17,16 @@ from users.models import ContractorResumeFiles
from work_sell.models import Picture
class HomeTemplateView(View):
class HomeTemplateView(BaseMixin, View):
template_name = 'home.html'
def get(self, request, *args, **kwargs):
context = self.get_context_data(**kwargs)
main_settings = MainPage.objects.get(pk=1)
return render(request, self.template_name, {'main_settings': main_settings})
context['main_settings'] = main_settings
return render(request, self.template_name, context)
class TestChatTemplateView(View):
@ -36,3 +46,13 @@ class TestChatTemplateView(View):
document.file = temp_file
document.save()
class TestView(BaseMixin, View):
template_name = 'test.html'
def get(self, request, *args, **kwargs):
# context = self.get_context_data(**kwargs)
# context['foo'] = 'bar'
# return render(request, self.template_name, context)
return redirect('projects:detail', pk=153)

@ -115,4 +115,13 @@ def morph(number, words_string):
return '%s %s' % (number, util.morph(number, words))
@register.simple_tag
def fa_currency_classes(currency):
CURRENCIES = {'rur': 'rub', 'eur': 'eur', 'usd': 'usd'}
currency_class = CURRENCIES.get(currency)
if currency_class:
return 'fa fa-%s' % currency_class
# import code; code.interact(local=dict(globals(), **locals()))

@ -270,8 +270,8 @@ class Stage(models.Model):
class Candidate(models.Model):
answer = models.ForeignKey(Answer, related_name='candidates')
project = models.ForeignKey(Project, related_name='candidates')
answer = models.ForeignKey(Answer, related_name='candidates') # TODO: Swap to "OneToOneField"
project = models.ForeignKey(Project, related_name='candidates') # TODO: Remove this redundant field at all (we've got "candidate.answer.project")
status = models.BooleanField(default=False)
position = models.PositiveIntegerField(default=0)

@ -33,14 +33,18 @@
{% for cand in object.candidates.all %}
<tr style="cursor:move;" class="items[]_{{ cand.pk }}" data-class="items[]_{{ cand.pk }}">
<td>{{ cand.position }}</td>
<td>
{{ cand.answer.author.username }}
{% if cand.answer.author|class_name == 'User' %}
{{ cand.answer.author.get_full_name }}
{% elif cand.answer.author|class_name == 'Team' %}
{{ cand.answer.author.name }}
{% endif %}
</td>
<td>{{ cand.answer.budget }} <i class="fa fa-rub"></i></td>
<td>{{ cand.answer.budget }} <i class="{% fa_currency_classes cand.answer.currency %}"></i></td>
<td>
{{ cand.answer.term }}<br> <span>
{% morph_words cand.answer.term cand.answer.get_term_type_labels %}
</span>
@ -90,8 +94,9 @@
<form method="POST" action="{% url 'projects:delete-candidate' cand.pk %}">
{% csrf_token %}<input class="btnTab btnTab3" type="submit" value="">
</form>
<a href="{% url 'users:contractor-profile' cand.answer.author.pk %}#open-contact">
<div class="btnTab btnTab4"></div>
<div class="btnTab btnTab4"></div>
</a>
</div>
</td>

@ -19,7 +19,7 @@
{% if request.user.is_contractor %}
<div class="col-lg-12 new-p">
<p>{{ project.budget|intcomma }} <i class="fa fa-rub"></i></p>
<p>{{ project.budget|intcomma }} <i class="{% fa_currency_classes project.currency %}"></i></p>
</div>
{% endif %}
@ -237,7 +237,7 @@
<p>
Цена:
<span>{{ answer.budget|intcomma }}</span>
<i class="fa fa-rub"></i>
<i class="{% fa_currency_classes answer.currency %}"></i>
</p>
<p>
Срок: <span>{{ answer.term }} {{ answer.get_currency_display }} {{ answer.get_term_type_display|decap }}</span>
@ -563,7 +563,7 @@
<p>
Цена:
<span>{{ answer.budget|intcomma }}</span>
<i class="fa fa-rub"></i>
<i class="{% fa_currency_classes answer.currency %}"></i>
</p>
<p>
Срок: <span>{{ answer.term }} {{ answer.get_currency_display }} {{ answer.get_term_type_display|decap }}</span>
@ -695,7 +695,7 @@
<div class="col-lg-3 retts">
{% if answer.author|class_name == 'User' %}
{% ratings_widget answer.author.pk 'restList2' %}
{% ratings_widget answer.author.pk 'restList2' %}
{% elif answer.author|class_name == 'Team'%}
{% ratings_team_widget answer.author.pk 'restList2' %}
{% endif %}
@ -719,7 +719,7 @@
<p>
Цена:
<span>{{ answer.budget|intcomma }}</span>
<i class="fa fa-rub"></i>
<i class="{% fa_currency_classes answer.currency %}"></i>
</p>
<p>
Срок: <span>{{ answer.term }} {{ answer.get_currency_display }} {{ answer.get_term_type_display|decap }}</span>
@ -728,6 +728,12 @@
</div>
<div class="col-lg-3 retts">
{% if TESTING %}
<a href="{% url 'projects:add-candidate' answer_id=answer.pk project_id=project.pk %}" class="candLink candLink1">
Кандидат
</a>
{% endif %}
{% if not project.order.contractor and not project.order.team %}
<form action="{% url 'projects:customer-offer-order' answer_id=answer.pk project_id=project.pk %}" method="POST" novalidate>
{% csrf_token %}
@ -867,7 +873,7 @@
<p>
Цена:
<span>{{ answer.budget|intcomma }}</span>
<i class="fa fa-rub"></i>
<i class="{% fa_currency_classes answer.currency %}"></i>
</p>
<p>
Срок: <span>{{ answer.term }} {{ answer.get_currency_display }} {{ answer.get_term_type_display|decap }}</span>

@ -214,7 +214,7 @@
</div>
<div class="col-lg-3 rightPro">
<p class="cenaPro">
{{ project.budget }} <i class="fa fa-rub"></i>
{{ project.budget }} <i class="{% fa_currency_classes project.currency %}"></i>
</p>
<ul>

@ -205,6 +205,11 @@ class RejectProjectAnswerView(BaseMixin, View):
answer.rejected = True
answer.save()
candidate = Candidate.objects.filter(answer=answer)
if candidate:
candidate.delete()
messages.info(request, 'Успешный отказ от проекта')
redirect_to = request.POST.get('next')
@ -590,18 +595,20 @@ class ProjectComparisonView(DetailView):
model = Project
template_name = 'comparison.html'
# def get(self, request, **kwargs):
# self.object = self.get_object()
def add_candidate(request, answer_id, project_id):
answer = Answer.objects.get(pk=answer_id)
project = Project.objects.get(pk=project_id)
count_answers = Candidate.objects.filter(project=project).count()
count_answers += 1
candidate = Candidate.objects.create(answer=answer, project=project, position=count_answers)
return HttpResponseRedirect(reverse('projects:detail', args=[project_id]))
candidate = Candidate.objects.filter(answer=answer).first()
if not candidate:
Candidate.objects.create(answer=answer, project=project, position=count_answers)
return redirect('projects:detail', pk=project_id)
class CandidateDeleteView(DeleteView):

@ -1,48 +0,0 @@
{% load staticfiles %}
<!doctype html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge, chrome=1'>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<!--<meta name='viewport' content='initial-scale=1.0, user-scalable=no, maximum-scale=1'>-->
<title>Archilance</title>
<link rel='stylesheet' href='{% static "css/bootstrap.css" %}'>
<link rel='stylesheet' href='{% static "lib/bootstrap-select/css/bootstrap-select.css" %}'>
<link rel='stylesheet' href='{% static "css/swiper.min.css" %}'>
<link rel='stylesheet' href='{% static "lib/jquery.fileupload/css/jquery.fileupload.css" %}'>
<link rel='stylesheet' href='{% static "css/dev-colors.css" %}'> <!-- Dev-time only, temporary!!! -->
</head>
<body>
{% if messages %}
{% for message in messages %}
<div class="c" style='padding: 10px; margin-bottom: 6px'>{{ message | safe }}</div>
{% endfor %}
{% endif %}
{% block content %}{% endblock %}
<script src='{% static "lib/lodash/lodash.js" %}'></script>
<script src='{% static "lib/lodash/lodash.fp.js" %}'></script>
<script src='{% static "js/jquery-2.2.3.min.js" %}'></script>
<script src='{% static "js/bootstrap.min.js" %}'></script>
<script src='{% static "lib/bootstrap-select/js/bootstrap-select.js" %}'></script>
<script src='{% static "lib/jquery.fileupload/js/vendor/jquery.ui.widget.js" %}'></script>
<script src='{% static "lib/jquery.fileupload/js/jquery.fileupload.js" %}'></script>
<script src='{% static "lib/jquery.fileupload/js/jquery.fileupload-process.js" %}'></script>
<script src='{% static "my-libs.js" %}'></script>
<script src='{% static "js/main.js" %}'></script> <!-- Файл верстальщика -->
<script src='{% static "index.js" %}'></script> <!-- Файл программистов -->
{% block js_block %}{% endblock %}
</body>
</html>

@ -1,6 +1,6 @@
{% extends 'partials/base_test.html' %}
{#{% extends 'partials/base.html' %}#}
{% block content %}
{#{% block content %}#}
<div class='container-fluid'>
<div class='row'>
<div class='col-xs-12' style='margin-top: 15px'>
@ -8,4 +8,4 @@
</div>
</div>
</div>
{% endblock %}
{#{% endblock %}#}

@ -78,7 +78,7 @@
<div class="col-lg-3 rightPro">
<p class="cenaPro">
{{ project.budget }} <i class="fa fa-rub"></i>
{{ project.budget }} <i class="{% fa_currency_classes project.currency %}"></i>
</p>
<ul>

@ -281,7 +281,7 @@
<div class="cenaImg box-sizing">
<div class="cenaImgInset">
{{ ws.budget }} <i class="fa fa-rub"></i>
{{ ws.budget }} <i class="{% fa_currency_classes ws.currency %}"></i>
</div>
</div>
</div>
@ -418,7 +418,7 @@
</div>
<div class="col-lg-12 wr-inset-pluss">
<div class="pluss-block" id="resume-text-out">
{{ contractor.contractor_resume.text | safe }}
{{ contractor.contractor_resume.text|safe }}
</div>
<a href="#" data-toggle="modal" data-target="#resume-text-edit">
<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
@ -562,7 +562,7 @@
{% block js_block %}
<script type="text/javascript">
;(function() {
(function() {
// Pagination ---------------------------------------------------
var $portfoliosContainer = $('.-portfolios-container').first()
@ -653,6 +653,16 @@
loadMoreWorkSells()
// Persistent Bootstrap tabs --------------------------------------
$('a[data-toggle="tab"][href="' + window.location.hash + '"]').tab('show')
$('a[data-toggle="tab"]').on('click', function($evt) { // Better handle "shown.bs.tab" event?
window.location.hash = $(this).attr('href')
})
//-----------------------------------------------------------------

@ -71,7 +71,7 @@
<div class="col-lg-3 rightPro right-pro-red">
<p class="cenaPro">
{{ proj.budget }} <i class="fa fa-rub"></i>
{{ proj.budget }} <i class="{% fa_currency_classes proj.currency %}"></i>
</p>
{% if request.user == proj.customer %}

@ -68,7 +68,7 @@
</div>
<div class="col-lg-3 rightPro right-pro-red">
<p class="cenaPro">
{{ proj.budget }} <i class="fa fa-rub"></i>
{{ proj.budget }} <i class="{% fa_currency_classes proj.currency %}"></i>
</p>
{% if request.user == proj.customer %}

@ -23,7 +23,7 @@
<div class="btnReadyBlock disTab">
<div class="triangle1"></div>
<div class="col-lg-3">
<p class="cenaReady">{{ object.budget }} <i class="fa fa-rub"></i></p>
<p class="cenaReady">{{ object.budget }} <i class="{% fa_currency_classes object.currency %}"></i></p>
</div>
{% if request.user.is_authenticated %}
<div class="col-lg-3">

@ -149,7 +149,7 @@
</a>
<div class="cenaImg box-sizing">
<div class="cenaImgInset">
{{ work.budget }}<i class="fa fa-rub"></i>
{{ work.budget }}<i class="{% fa_currency_classes work.currency %}"></i>
</div>
</div>
</div>

Loading…
Cancel
Save