From 17a5a2339e7efa9f962fa01bb798b335efcc3475 Mon Sep 17 00:00:00 2001 From: Mukhtar Date: Tue, 14 Jun 2016 10:18:56 +0300 Subject: [PATCH] #ARC-12 add templates for project detail and detail list --- projects/models.py | 4 ++-- .../templates/customer_project_detail.html | 8 +++----- projects/templates/projects/project_list.html | 2 +- requirements/base.txt | 2 ++ users/migrations/0012_user_status.py | 20 +++++++++++++++++++ users/migrations/0013_auto_20160610_1703.py | 20 +++++++++++++++++++ users/models.py | 10 ++++++++++ 7 files changed, 58 insertions(+), 8 deletions(-) create mode 100644 users/migrations/0012_user_status.py create mode 100644 users/migrations/0013_auto_20160610_1703.py diff --git a/projects/models.py b/projects/models.py index 9327e66..2f24027 100644 --- a/projects/models.py +++ b/projects/models.py @@ -92,8 +92,8 @@ class Project(models.Model): STATES = ( ('active', 'Активный'), - ('trash', 'В корзине'), - ('delete', 'Удален'), + ('trashed', 'В корзине'), + ('deleted', 'Удален'), ) budget = models.DecimalField(max_digits=10, decimal_places=0) diff --git a/projects/templates/customer_project_detail.html b/projects/templates/customer_project_detail.html index fd2fac9..93216ca 100644 --- a/projects/templates/customer_project_detail.html +++ b/projects/templates/customer_project_detail.html @@ -119,9 +119,9 @@ execitor-image

- {{ answer.user.get_full_name }} [ivanov_petr] + {{ answer.contractor.get_full_name }} []

- +
Свободен
@@ -187,9 +187,7 @@
-

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean euismod bibendum laoreet. Proin gravida dolor sit amet lacus accumsan et viverra justo commodo. Proin sodales pulvinar tempor. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam fermentum, nulla luctus pharetra vulputate, felis tellus mollis orci, sed rhoncus sapien nunc eget odio. -

+

Lorem ipsum dolor sit amet

diff --git a/projects/templates/projects/project_list.html b/projects/templates/projects/project_list.html index af83dba..7c77181 100644 --- a/projects/templates/projects/project_list.html +++ b/projects/templates/projects/project_list.html @@ -175,7 +175,7 @@ 0
  • - 0 + {{ proj.answers.count }}
  • {{ proj.user }} diff --git a/requirements/base.txt b/requirements/base.txt index 9c42914..ab9636b 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -1,5 +1,6 @@ Django==1.9.6 Pillow==3.2.0 +django-compressor==2.0 django-debug-toolbar==1.4 django-environ==0.4.0 django-extensions==1.6.7 @@ -14,5 +15,6 @@ psycopg2==2.6.1 pydash==3.4.3 requests==2.10.0 six==1.10.0 +sorl-thumbnail==12.3 sqlparse==0.1.19 diff --git a/users/migrations/0012_user_status.py b/users/migrations/0012_user_status.py new file mode 100644 index 0000000..57dbb7f --- /dev/null +++ b/users/migrations/0012_user_status.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.6 on 2016-06-10 13:58 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('users', '0011_user_contractor_specializations'), + ] + + operations = [ + migrations.AddField( + model_name='user', + name='status', + field=models.CharField(choices=[('free', 'Свободен'), ('busy', 'Занят')], default='free', max_length=20), + ), + ] diff --git a/users/migrations/0013_auto_20160610_1703.py b/users/migrations/0013_auto_20160610_1703.py new file mode 100644 index 0000000..f39186b --- /dev/null +++ b/users/migrations/0013_auto_20160610_1703.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.6 on 2016-06-10 14:03 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('users', '0012_user_status'), + ] + + operations = [ + migrations.RenameField( + model_name='user', + old_name='status', + new_name='contractor_status', + ), + ] diff --git a/users/models.py b/users/models.py index 9f657a5..2444a2e 100644 --- a/users/models.py +++ b/users/models.py @@ -34,6 +34,10 @@ class CustomerUserManager(models.Manager): class User(AbstractBaseUser, PermissionsMixin): + STATUSES = ( + ('free', 'Свободен'), + ('busy', 'Занят'), + ) nickname = models.CharField(max_length=50, blank=True,null=True) first_name = models.CharField(max_length=255, blank=True) last_name = models.CharField(max_length=255, blank=True) @@ -42,10 +46,16 @@ class User(AbstractBaseUser, PermissionsMixin): created = models.DateTimeField(default=timezone.now) last_time_visit = models.DateTimeField(default=timezone.now) contractor_specializations = models.ManyToManyField(Specialization, related_name='contractors', blank=True) + contractor_status = models.CharField(default='free', max_length=20, choices=STATUSES) @property def is_staff(self): return self.is_superuser + + @property + def is_free(self): + return self.contractor_status == 'free' + def __str__(self): return self.email