diff --git a/projects/migrations/0009_project_is_archive.py b/projects/migrations/0009_project_is_archive.py new file mode 100644 index 0000000..7868920 --- /dev/null +++ b/projects/migrations/0009_project_is_archive.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-08-16 13:58 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('projects', '0008_auto_20160815_1900'), + ] + + operations = [ + migrations.AddField( + model_name='project', + name='is_archive', + field=models.BooleanField(default=False), + ), + ] diff --git a/projects/models.py b/projects/models.py index 2abce6c..cc7065b 100644 --- a/projects/models.py +++ b/projects/models.py @@ -93,6 +93,7 @@ class Project(models.Model): term_type = models.CharField(max_length=20, choices=TERMS, default='hour') text = models.TextField(blank=True) work_type = models.IntegerField(default=1, choices=WORK_TYPES) + is_archive = models.BooleanField(default=False) def __str__(self): return self.name diff --git a/users/templates/contractor_office.html b/users/templates/contractor_office.html index f780884..23b6f9d 100644 --- a/users/templates/contractor_office.html +++ b/users/templates/contractor_office.html @@ -7,46 +7,12 @@ {% block content %} {% include 'partials/header.html' %} -
+

Личный кабинет

- -
- -
- + {% include 'partials/contractor_profile_tabs.html' with contractor_pk=request.user.pk active='groups' %}
+ +
+
+
+ {% for proj in open_projects %} +
+
+ +

+ {{ proj }} +

+
+
    +
  • + Объект "{{ proj.realty.name }}" +
  • +
  • + 0 ответ от имени группы +
  • +
+

+

+
    +
  • + {{ proj.created }} +
  • +
  • + 0 +
  • +
  • + 0 +
  • +
  • + {{ proj.customer.username }} +
  • +
+
+
+

+ {{ proj.budget }} +

+
    +
  • + + Безопасная сделка +
  • +
  • + Отказаться и перемстить + в корзину +
  • +
+
+
+ {% endfor %} +
+ + + {% include 'partials/footer.html' %} +
+
+{% endblock %} diff --git a/users/templates/partials/contractor_profile_tabs.html b/users/templates/partials/contractor_profile_tabs.html new file mode 100644 index 0000000..0c5cd24 --- /dev/null +++ b/users/templates/partials/contractor_profile_tabs.html @@ -0,0 +1,30 @@ +
+ +
diff --git a/users/urls.py b/users/urls.py index e65d542..acb7e85 100755 --- a/users/urls.py +++ b/users/urls.py @@ -16,6 +16,7 @@ from .views import ( UserProfileEditView, TeamCreateView, ContractorResumeUpdateView, + ContractorOfficeOpenProjectsView, contractor_resumefile_create, ) @@ -40,6 +41,7 @@ urlpatterns = [ urls.url(r'^contractorsresumefiles/create/$', contractor_resumefile_create, name='contractor-resume-file-create'), urls.url(r'^contractors/(?P\d+)/$', ContractorProfileDetailView.as_view(), name='contractor-profile'), urls.url(r'^contractor-office/(?P\d+)/$', ContractorOfficeDetailView.as_view(), name='contractor-office'), - + urls.url(r'^contractor-office/(?P\d+)/open-projects/$', ContractorOfficeOpenProjectsView.as_view(), name='contractor-office-open-projects'), + urls.url(r'^test/$', send_mail_test), ] diff --git a/users/views.py b/users/views.py index a6db9bb..5fe77dc 100644 --- a/users/views.py +++ b/users/views.py @@ -384,6 +384,29 @@ class ContractorOfficeDetailView(DetailView): return context +class ContractorOfficeOpenProjectsView(BaseMixin,View): + template_name = 'contractor_office_open_projects.html' + + def get(self, request, *args, **kwargs): + context = self.get_context_data(**_.merge({},request.GET, kwargs)) + contractor = get_object_or_404(User.contractor_objects,pk=kwargs.get('pk')) + owner = request.GET.get('owner') + # import code; code.interact(local=dict(globals(), **locals())) + if owner and owner == 'private': + all_project_ids = [a.project.pk for a in contractor.contractor_answers.all()] + elif owner and owner == 'teams': + all_project_ids = [a.project.pk for a in contractor.team.answers.all()] + else: + team_project_ids = [a.project.pk for a in contractor.team.answers.all()] + contractor_project_ids = [a.project.pk for a in contractor.contractor_answers.all()] + all_project_ids = contractor_project_ids + team_project_ids + + open_projects = Project.objects.filter(pk__in=all_project_ids) + context.update({ + 'open_projects': open_projects, + }) + return render(request, self.template_name, context) + class CustomerProfileOpenProjectsView(BaseMixin, View): template_name = 'customer_profile_open_projects.html' @@ -491,7 +514,6 @@ class CustomerProfileCurrentProjectsView(BaseMixin, DetailView): context_object_name = 'customer' - class TeamCreateView(View): form_class = TeamForm