|
|
|
|
@ -9,7 +9,7 @@ from django.db.models import Q, F |
|
|
|
|
from django.http import HttpResponseForbidden, HttpResponseRedirect, HttpResponse, Http404 |
|
|
|
|
from django.shortcuts import render, get_object_or_404, redirect |
|
|
|
|
from django.views.generic import ListView, DetailView, CreateView, DeleteView, View, UpdateView, TemplateView, FormView |
|
|
|
|
from django.views.generic.base import ContextMixin |
|
|
|
|
|
|
|
|
|
from hitcount.models import HitCount |
|
|
|
|
from hitcount.views import HitCountMixin |
|
|
|
|
from pprint import pprint, pformat |
|
|
|
|
@ -644,8 +644,28 @@ class OfferOrderView(View): |
|
|
|
|
template_name = 'chattest.html' |
|
|
|
|
|
|
|
|
|
def post(self, request, *args, **kwargs): |
|
|
|
|
print("Add chat") |
|
|
|
|
return HttpResponseRedirect(reverse('chat:chat-user')) |
|
|
|
|
project_id = kwargs.get('project_id') |
|
|
|
|
answer_id = kwargs.get('answer_id') |
|
|
|
|
try: |
|
|
|
|
project = Project.objects.get(pk=project_id) |
|
|
|
|
except Project.DoesNotExist: |
|
|
|
|
project = None |
|
|
|
|
try: |
|
|
|
|
answer = Answer.objects.get(pk=answer_id) |
|
|
|
|
except Answer.DoesNotExist: |
|
|
|
|
answer = None |
|
|
|
|
|
|
|
|
|
order = project.order |
|
|
|
|
if not order.contractor and not order.team: |
|
|
|
|
if isinstance(answer.author, User): |
|
|
|
|
order.contractor = answer.author |
|
|
|
|
order.save() |
|
|
|
|
elif isinstance(answer.author, Team): |
|
|
|
|
order.team = answer.author |
|
|
|
|
order.save() |
|
|
|
|
|
|
|
|
|
redirect_url = reverse('chat:chat-user') + '?order_id=' + str(order.pk) |
|
|
|
|
return HttpResponseRedirect(redirect_url) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def contractor_portfolio_create(request): |
|
|
|
|
|