diff --git a/archilance/urls.py b/archilance/urls.py
index a860e6a..8680ab6 100644
--- a/archilance/urls.py
+++ b/archilance/urls.py
@@ -11,7 +11,7 @@ from .views import HomeTemplateView, TestChatTemplateView
urlpatterns = [
url(r'^$', HomeTemplateView.as_view()),
url('', include('social.apps.django_app.urls', namespace='social')),
- url(r'^chattest$', TestChatTemplateView.as_view()),
+ 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'^projects/', include('projects.urls')),
diff --git a/archilance/views.py b/archilance/views.py
index b397333..f122e41 100644
--- a/archilance/views.py
+++ b/archilance/views.py
@@ -4,6 +4,7 @@ from django.template.loader import render_to_string
from projects.models import Order
from common.models import MainPage, PrintDocuments
+from users.models import ContractorResumeFiles
class HomeTemplateView(View):
@@ -18,28 +19,5 @@ class TestChatTemplateView(View):
template_name = 'chat_test.html'
def get(self, request, *args, **kwargs):
- from common.models import PrintDocuments
-
- print_documents = PrintDocuments.objects.all()
- limit_size = 10 * 1024 * 1024
- attachments = []
- link_files = []
-
- for f in print_documents:
- if f.file.size > limit_size:
- link_files.append(f.file.path)
- else:
- attachments.append(f.file.path)
-
-
- html_content = render_to_string('document_email.txt',
- {
- 'username': 'Mukhtar',
- 'phone': '89634004278',
- 'files': link_files,
- }
- )
-
- print(html_content)
-
- return render(request, 'chat_test.html', {'html_content': html_content})
+ diploms = ContractorResumeFiles.objects.all()
+ return render(request, 'chat_test.html', {'diploms': diploms})
diff --git a/common/views.py b/common/views.py
index b360bea..8460409 100644
--- a/common/views.py
+++ b/common/views.py
@@ -6,7 +6,7 @@ from django.views.generic import View
from archilance.mixins import BaseMixin
from .forms import PrintOrderForm
-from .models import PrintDocuments, PrintOrder
+from .models import PrintDocuments, PrintOrder, Settings
class PrintDocumentCreate(BaseMixin, View):
@@ -45,7 +45,9 @@ class PrintDocumentCreate(BaseMixin, View):
'files': link_files,
}
- subject, from_email, to = 'Заявка на распечатку', 'mukhtar@mukhtar', 'muhtarzubanchi05@gmail.com'
+
+ settings = Settings.objects.all().first().doc
+ subject, from_email, to = 'Заявка на распечатку', 'mukhtar@mukhtar', settings.document_send_email
text_content = render_to_string('document_email.txt', ctx_dict)
html_content = get_template('document_email.html').render(ctx_dict)
msg = EmailMultiAlternatives(subject, text_content, from_email, [to])
diff --git a/templates/chat_test.html b/templates/chat_test.html
index ac875bb..dec253b 100644
--- a/templates/chat_test.html
+++ b/templates/chat_test.html
@@ -1,17 +1,112 @@
-
-
-
-
- Title
-
-
-Демо чат
-{{ order}}
-
-
-
- {{ html_content }}
-
-
-
-
+{% extends 'partials/base.html' %}
+
+{% load thumbnail %}
+
+
+{% block content %}
+ {% include 'partials/header.html' %}
+ Test file
+
+
+
Дипломы / Сертификаты
+
+
+
+ {% for diplom in diploms %}
+
+
+ {% thumbnail diplom.img "210x334" crop="center" as im %}
+
+ {% endthumbnail %}
+
+
+
+ {{ diplom.title }}
+
+
+
+
+
+ {% endfor %}
+
+
+
+
+
+
+
+{% endblock %}
+
+
+{% block js_block %}
+
+{% endblock %}
diff --git a/templates/partials/base.html b/templates/partials/base.html
index a5fb277..cad17dc 100644
--- a/templates/partials/base.html
+++ b/templates/partials/base.html
@@ -20,7 +20,7 @@
-{# #}
+
@@ -60,8 +60,8 @@
-{##}
-{##}
+
+
diff --git a/users/forms.py b/users/forms.py
index a933c42..104b196 100644
--- a/users/forms.py
+++ b/users/forms.py
@@ -2,12 +2,22 @@ from django import forms
import itertools
import pydash as _; _.map = _.map_; _.filter = _.filter_
-from .models import User, UserFinancialInfo, GENDERS
+from .models import User, UserFinancialInfo, Team, GENDERS
from common.models import Location
from projects.models import Project, Realty, BuildingClassfication, ConstructionType
from specializations.models import Specialization
+class TeamForm(forms.ModelForm):
+
+ class Meta:
+ model = Team
+ fields = (
+ 'name',
+ 'owner',
+ )
+
+
class UserProfileEditForm(forms.ModelForm):
gender = forms.ChoiceField(
choices=GENDERS,
diff --git a/users/models.py b/users/models.py
index 3a819db..4fa1f1a 100644
--- a/users/models.py
+++ b/users/models.py
@@ -177,6 +177,9 @@ class User(AbstractBaseUser, PermissionsMixin):
def is_owner_profile(self, user_id):
pass
+ def is_owner_team(self):
+ return Team.objects.filter(owner=self.pk).exists()
+
class Team(models.Model):
created = models.DateTimeField(default=timezone.now)
diff --git a/users/templates/contractor_office.html b/users/templates/contractor_office.html
index 2123388..debb866 100644
--- a/users/templates/contractor_office.html
+++ b/users/templates/contractor_office.html
@@ -1,6 +1,7 @@
{% extends 'partials/base.html' %}
{% load staticfiles %}
+{% load thumbnail %}
{% block content %}
{% include 'partials/header.html' %}
@@ -51,11 +52,31 @@
Группа 1
7
-
-