|
|
|
@ -11,7 +11,10 @@ from django.views.generic import ListView, DetailView, CreateView, View, UpdateV |
|
|
|
from django.views.generic.base import ContextMixin |
|
|
|
from django.views.generic.base import ContextMixin |
|
|
|
from pprint import pprint, pformat |
|
|
|
from pprint import pprint, pformat |
|
|
|
import json |
|
|
|
import json |
|
|
|
import pydash as _; _.map = _.map_; _.filter = _.filter_ |
|
|
|
import pydash as _; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_.map = _.map_; |
|
|
|
|
|
|
|
_.filter = _.filter_ |
|
|
|
import re |
|
|
|
import re |
|
|
|
|
|
|
|
|
|
|
|
from .mixins import LastAccessMixin |
|
|
|
from .mixins import LastAccessMixin |
|
|
|
@ -57,8 +60,10 @@ class ProjectDetailWithContractorAnswerView(BaseMixin, View): |
|
|
|
team = None |
|
|
|
team = None |
|
|
|
answer = None |
|
|
|
answer = None |
|
|
|
|
|
|
|
|
|
|
|
try: team = contractor.team |
|
|
|
try: |
|
|
|
except Team.DoesNotExist: pass |
|
|
|
team = contractor.team |
|
|
|
|
|
|
|
except Team.DoesNotExist: |
|
|
|
|
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
if team: |
|
|
|
if team: |
|
|
|
answer = team.answers.first() |
|
|
|
answer = team.answers.first() |
|
|
|
@ -255,7 +260,8 @@ class CustomerProjectCreateView(BaseMixin, View): |
|
|
|
return render(request, self.template_name, context) |
|
|
|
return render(request, self.template_name, context) |
|
|
|
|
|
|
|
|
|
|
|
def post(self, request, *args, **kwargs): |
|
|
|
def post(self, request, *args, **kwargs): |
|
|
|
form = self.form_class(request.POST, request=request) # Passing `request.FILES` seems unnecessary here. Files are added manually below |
|
|
|
form = self.form_class(request.POST, |
|
|
|
|
|
|
|
request=request) # Passing `request.FILES` seems unnecessary here. Files are added manually below |
|
|
|
|
|
|
|
|
|
|
|
form.is_valid() |
|
|
|
form.is_valid() |
|
|
|
realty = form.cleaned_data.get('realty') |
|
|
|
realty = form.cleaned_data.get('realty') |
|
|
|
@ -350,7 +356,8 @@ class CustomerProjectEditView(BaseMixin, View): |
|
|
|
if form.is_valid() and realty_form.is_valid(): |
|
|
|
if form.is_valid() and realty_form.is_valid(): |
|
|
|
project = form.save(commit=False) |
|
|
|
project = form.save(commit=False) |
|
|
|
project.customer = request.user |
|
|
|
project.customer = request.user |
|
|
|
project.files = form.cleaned_data.get('files') # TODO: Should we somehow get rid of this explicit assignment? |
|
|
|
project.files = form.cleaned_data.get( |
|
|
|
|
|
|
|
'files') # TODO: Should we somehow get rid of this explicit assignment? |
|
|
|
project.save() |
|
|
|
project.save() |
|
|
|
form.save_m2m() |
|
|
|
form.save_m2m() |
|
|
|
|
|
|
|
|
|
|
|
@ -496,6 +503,22 @@ def add_candidate(request, answer_id, project_id): |
|
|
|
return HttpResponseRedirect(reverse('projects:detail', args=[project_id])) |
|
|
|
return HttpResponseRedirect(reverse('projects:detail', args=[project_id])) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def sort_candidates(request): |
|
|
|
|
|
|
|
if request.is_ajax(): |
|
|
|
|
|
|
|
items = request.POST.getlist('items[]') |
|
|
|
|
|
|
|
i = 1 |
|
|
|
|
|
|
|
for item in items: |
|
|
|
|
|
|
|
candidate = Candidate.objects.get(pk=item) |
|
|
|
|
|
|
|
candidate.position = i |
|
|
|
|
|
|
|
candidate.save() |
|
|
|
|
|
|
|
i += 1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data = { |
|
|
|
|
|
|
|
'success': 'ok', |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return HttpResponse(json.dumps(data), content_type='application/json') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class OfferOrderView(View): |
|
|
|
class OfferOrderView(View): |
|
|
|
template_name = 'chattest.html' |
|
|
|
template_name = 'chattest.html' |
|
|
|
|
|
|
|
|
|
|
|
@ -537,9 +560,10 @@ class ContractorPortfolioUpdateView(UpdateView): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from django.views.generic import DeleteView |
|
|
|
from django.views.generic import DeleteView |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class PortfolioDelete(DeleteView): |
|
|
|
class PortfolioDelete(DeleteView): |
|
|
|
model = Portfolio |
|
|
|
model = Portfolio |
|
|
|
success_url = reverse_lazy('users:contractor-profile') |
|
|
|
success_url = reverse_lazy('users:contractor-profile') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# import code; code.interact(local=dict(globals(), **locals())) |
|
|
|
# import code; code.interact(local=dict(globals(), **locals())) |
|
|
|
|