From c8e216f428be2b665a8ce24f92c980f1df69344e Mon Sep 17 00:00:00 2001 From: Mukhtar Date: Wed, 27 Jul 2016 19:45:41 +0300 Subject: [PATCH] #ARC-18 add reserve models --- api/urls.py | 2 + api/views.py | 18 +-- archilance/settings/base.py | 1 + assets/css/extra.css | 4 + chat/filters.py | 12 +- chat/serializers.py | 17 ++- chat/templates/chat_contractor.html | 124 ++++++------------ chat/templates/chat_customer.html | 113 ++++++++-------- .../migrations/0005_auto_20160726_1957.py | 22 ++++ .../migrations/0006_auto_20160727_1835.py | 27 ++++ .../migrations/0007_auto_20160727_1835.py | 21 +++ projects/models.py | 3 +- users/serializers.py | 2 +- users/templates/contractor_profile.html | 34 ++++- users/templates/portfolio_create_form.html | 20 ++- users/templates/worksell_create_form.html | 8 +- wallets/__init__.py | 0 wallets/admin.py | 5 + wallets/apps.py | 5 + wallets/migrations/0001_initial.py | 36 +++++ wallets/migrations/0002_auto_20160727_1835.py | 22 ++++ wallets/migrations/__init__.py | 0 wallets/models.py | 26 ++++ wallets/tests.py | 3 + wallets/views.py | 3 + work_sell/serialize.py | 1 + 26 files changed, 361 insertions(+), 168 deletions(-) create mode 100644 projects/migrations/0005_auto_20160726_1957.py create mode 100644 projects/migrations/0006_auto_20160727_1835.py create mode 100644 projects/migrations/0007_auto_20160727_1835.py create mode 100644 wallets/__init__.py create mode 100644 wallets/admin.py create mode 100644 wallets/apps.py create mode 100644 wallets/migrations/0001_initial.py create mode 100644 wallets/migrations/0002_auto_20160727_1835.py create mode 100644 wallets/migrations/__init__.py create mode 100644 wallets/models.py create mode 100644 wallets/tests.py create mode 100644 wallets/views.py diff --git a/api/urls.py b/api/urls.py index 81f751d..a414824 100755 --- a/api/urls.py +++ b/api/urls.py @@ -8,6 +8,7 @@ from .views import ( UserViewSet, MessageViewSet, StageViewSet, + NoteViewSet, ) @@ -20,5 +21,6 @@ router.register(r'realties', RealtyViewSet) router.register(r'specializations', SpecializationViewSet) router.register(r'users', UserViewSet) router.register(r'message', MessageViewSet) +router.register(r'note', NoteViewSet) urlpatterns = router.urls diff --git a/api/views.py b/api/views.py index a8d358d..11abebe 100755 --- a/api/views.py +++ b/api/views.py @@ -18,9 +18,9 @@ from common.models import Location from common.serializers import LocationSerializer from common.filters import LocationFilterSet -from chat.models import Message -from chat.serializers import MessageSerializer -from chat.filters import MessageFilterSet +from chat.models import Message, Notes +from chat.serializers import MessageSerializer, NoteSerializer +from chat.filters import MessageFilterSet, NoteFilterSet class StageViewSet(ModelViewSet): @@ -29,10 +29,6 @@ class StageViewSet(ModelViewSet): filter_class = StageFilterSet permission_classes = (permissions.IsAuthenticatedOrReadOnly,) - # def put(self, request, *args, **kwargs): - # # import code; code.interact(local=dict(globals(), **locals())) - # return super().update(request, *args, **kwargs) - class ProjectViewSet(ModelViewSet): queryset = Project.objects.all() @@ -40,6 +36,12 @@ class ProjectViewSet(ModelViewSet): filter_class = ProjectFilterSet +class NoteViewSet(ModelViewSet): + queryset = Notes.objects.all() + serializer_class = NoteSerializer + filter_class = NoteFilterSet + + class MessageViewSet(ModelViewSet): queryset = Message.objects.all() serializer_class = MessageSerializer @@ -57,14 +59,12 @@ class MessageViewSet(ModelViewSet): return queryset - class RealtyViewSet(ModelViewSet): queryset = Realty.objects.all() serializer_class = RealtySerializer filter_class = RealtyFilterSet - class SpecializationViewSet(ModelViewSet): queryset = Specialization.objects.root_nodes()[0].get_descendants() # queryset = Specialization.objects # Migrate with this enabled diff --git a/archilance/settings/base.py b/archilance/settings/base.py index 79509db..2c61f25 100644 --- a/archilance/settings/base.py +++ b/archilance/settings/base.py @@ -52,6 +52,7 @@ LOCAL_APPS = [ 'users', 'reviews', 'chat', + 'wallets', ] INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS diff --git a/assets/css/extra.css b/assets/css/extra.css index 96bebd4..b058932 100644 --- a/assets/css/extra.css +++ b/assets/css/extra.css @@ -64,3 +64,7 @@ background-color: #00bb7b; font-size: 17px; } + +.textAreaBlock2 input[type="text"] { + margin: 0; +} diff --git a/chat/filters.py b/chat/filters.py index 63c24e0..727b598 100644 --- a/chat/filters.py +++ b/chat/filters.py @@ -1,6 +1,6 @@ from rest_framework_filters import FilterSet, RelatedFilter, AllLookupsFilter -from .models import Message +from .models import Message, Notes class MessageFilterSet(FilterSet): @@ -12,3 +12,13 @@ class MessageFilterSet(FilterSet): class Meta: model = Message + + +class NoteFilterSet(FilterSet): + text = AllLookupsFilter() + created = AllLookupsFilter() + sender = RelatedFilter('users.filters.UserFilterSet') + recipent = RelatedFilter('users.filters.UserFilterSet') + + class Meta: + model = Notes diff --git a/chat/serializers.py b/chat/serializers.py index e3b6146..3397e72 100644 --- a/chat/serializers.py +++ b/chat/serializers.py @@ -20,7 +20,16 @@ class MessageSerializer(ModelSerializer): ) -# class NotesSerializer(ModelSerializer): -# -# class Meta: -# model = Notes +class NoteSerializer(ModelSerializer): + + class Meta: + model = Notes + + fields = ( + 'text', + 'created', + 'order', + 'sender', + 'recipent', + ) + diff --git a/chat/templates/chat_contractor.html b/chat/templates/chat_contractor.html index 679a396..abaa9fb 100644 --- a/chat/templates/chat_contractor.html +++ b/chat/templates/chat_contractor.html @@ -8,6 +8,7 @@

Чат {{ request.user }} {{ request.user.pk }}

+
@@ -29,7 +30,9 @@
+
+
@@ -56,102 +59,46 @@
-
-
-
+
+
-

Прикрепить файл

- - Не более 10 файлов с общим объемом 500мб - + Не более 10 файлов с общим объемом 500мб
- отправить -
-
-
-
-

Контакты

- -
-
-
- Начало: - Срок сдачи: -
-
- 13.0.2016 - 13.0.2016 -
-
-
-

Входящие документы

-
    -
  • - Архитерурное 2.jpg - 7мб -
    -
  • -
- - Распечатать с помощью ресурса - -
+
+ + +

Заказы

{% for order in orders %} -
+
-

- {{ order }} -

+

{{ order }}

-

- Испонитель: {{ request.user.get_full_name }} -

-

- Чаты: Иванов, Петров, Пенкин -

+

Испонитель: {{ request.user.get_full_name }}

+

Чаты: Иванов, Петров

Полное описание заказа @@ -163,27 +110,24 @@
-
+
+

Этапы работы

1 / Согласование условий

@@ -193,16 +137,20 @@
+ +

Для заметок

сохранить
-
+ + +
@@ -272,6 +220,7 @@
+
{% include 'partials/footer.html' %}
@@ -282,10 +231,6 @@ {% block js_block %} {# #}