From 744df48a0f0e7fad25d6056d553ecaca91023950 Mon Sep 17 00:00:00 2001 From: Mukhtar Date: Mon, 1 Aug 2016 20:06:51 +0300 Subject: [PATCH] #ARC-19 Add group office page --- archilance/urls.py | 2 +- archilance/views.py | 28 +--- common/views.py | 6 +- templates/chat_test.html | 129 +++++++++++++-- templates/partials/base.html | 6 +- users/forms.py | 12 +- users/models.py | 3 + users/templates/contractor_office.html | 198 +++++++++++++++--------- users/templates/contractor_profile.html | 83 +++++++++- users/views.py | 20 ++- 10 files changed, 363 insertions(+), 124 deletions(-) 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 - - + {% endif %} + + +
@@ -63,7 +84,9 @@
- profile-image + {% thumbnail contractor.avatar "265x264" crop="center" as im %} + profile-image + {% endthumbnail %}
@@ -74,30 +97,25 @@

Состав группы

+ + {% for p in participants %}
+
- mess-image -
- -

- Иванов Петр Иванович -

- - Программист -
- -
-
- mess-image + {% thumbnail p.avatar "60x60" crop="center" as im %} + mess-image + {% endthumbnail %}
- +

- Иванов Петр Иванович + {{ p.get_full_name }}

Программист
+ + {% endfor %}
@@ -105,17 +123,18 @@

- Название группы + {{ contractor.team }}

Россия, Москва

- +{# #} + -
Label
+
Свободен
написать сообщение
@@ -167,77 +186,118 @@
+ + +
- -
-

Добавить работу

-
- -
+ +
+
+ +
+ {% for p in portfolios %}
-
-
-
-
-
-
-

- Визуализация - загородного - дома 1500m2 -

-
-
- +
+
+
+
-
- +
+

{{ p.name }}

+
+ +
+ +
+
+
+ +
+
-
+
+ {% endfor %} + +
+ + - -
-
-
-
+
+ +
+ +
+ {% for ws in work_sells %} +
+
+
+
+
+
+
+ {{ ws.budget }} +
+
+
+
+

{{ ws }}

+ +
+ {% endfor %} +
+
+ -
-

- Визуализация - загородного - дома 1500m2 +

+
+ +
+
+
+

+ Иванов Петр Иванович

-
-
- -
-
- -
+ + Безопасная сделка + + +

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean euismod bibendum + +

+
diff --git a/users/templates/contractor_profile.html b/users/templates/contractor_profile.html index 8ca7c82..7742498 100644 --- a/users/templates/contractor_profile.html +++ b/users/templates/contractor_profile.html @@ -117,12 +117,14 @@
+ {% if contractor.pk == request.user.pk %} + - + {% endif %}
{% for p in user.portfolios.all %} @@ -172,6 +174,7 @@
+ {% if contractor.pk == request.user.pk %}

Добавить проект @@ -189,6 +192,8 @@

+ {% endif %} +
{% for ws in user.work_sell.all %}
@@ -319,10 +324,10 @@

Дипломы / Сертификаты

- +

Загрузить файл

-
+