From a44a7e4da981a5b41b795cf20a1b903ca7050781 Mon Sep 17 00:00:00 2001 From: Mukhtar Date: Fri, 12 Aug 2016 12:11:38 +0300 Subject: [PATCH] #ARC-27 make migrate --- users/migrations/0008_auto_20160812_1151.py | 25 +++++++++++++ users/templates/contractor_profile.html | 36 +++++++++++++++++-- users/templates/worksell_create_form.html | 2 +- work_sell/forms.py | 23 ++++++++---- .../migrations/0003_auto_20160812_1151.py | 21 +++++++++++ work_sell/urls.py | 4 +-- 6 files changed, 100 insertions(+), 11 deletions(-) create mode 100644 users/migrations/0008_auto_20160812_1151.py create mode 100644 work_sell/migrations/0003_auto_20160812_1151.py diff --git a/users/migrations/0008_auto_20160812_1151.py b/users/migrations/0008_auto_20160812_1151.py new file mode 100644 index 0000000..26fda63 --- /dev/null +++ b/users/migrations/0008_auto_20160812_1151.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-08-12 08:51 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('users', '0007_auto_20160808_1557'), + ] + + operations = [ + migrations.AlterField( + model_name='contractorresumefiles', + name='title', + field=models.CharField(blank=True, max_length=255), + ), + migrations.AlterField( + model_name='contractorresumefiles', + name='type', + field=models.CharField(choices=[('diplom', 'Дипломы/Сертификаты'), ('cro', 'Допуск CPO')], default='diplom', max_length=50), + ), + ] diff --git a/users/templates/contractor_profile.html b/users/templates/contractor_profile.html index 29b7f5e..b77f72a 100644 --- a/users/templates/contractor_profile.html +++ b/users/templates/contractor_profile.html @@ -249,10 +249,14 @@
+
+
- + +

Загрузить резюме

+
{#w#}
@@ -504,7 +508,7 @@ e.preventDefault(); var dataSerializer = $(this).serialize(); $.ajax({ - url: '/work_sell/test/', + url: '/work_sell/create/', method: 'POST', data: dataSerializer, dataType: 'json', @@ -512,9 +516,11 @@ if (data.status == 'ok') { location.reload(); } + }, error: function (jqXHR, exception) { console.log(jqXHR.statusCode); + console.log(jqXHR); } }) @@ -524,6 +530,7 @@ $('#portfolio-add-form').on('submit', function (e) { e.preventDefault(); var dataSerializer = $(this).serialize(); + $.ajax({ url: '/projects/portfolio/create/', method: 'POST', @@ -549,6 +556,31 @@ var url = '/work_sell/basic/'; var csrftoken = $.cookie('csrftoken'); + $("#upload-resume").on('change',function(e){ + var formData = new FormData($(this).closest("form")); + formData.append('resume_file', e.target.files[0]); + console.log(formData); + console.log(e.target.files[0]); + $.ajax({ + url:'/api/contractorresume/{{ contractor.contractor_resume.pk }}/', + method:'PUT', + beforeSend: function (xhr) { + xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken')); + }, + data: formData, + cache: false, + dataType: 'json', + processData: false, + contentType: false, + success: function(data){ + console.log(data); + }, + error: function(jqXHR){ + console.log(jqXHR); + } + }); + }); + $('#fileupload').fileupload({ url: url, crossDomain: false, diff --git a/users/templates/worksell_create_form.html b/users/templates/worksell_create_form.html index bfd400d..ac4cf2f 100644 --- a/users/templates/worksell_create_form.html +++ b/users/templates/worksell_create_form.html @@ -76,7 +76,7 @@
- +
diff --git a/work_sell/forms.py b/work_sell/forms.py index 57a4012..40887ca 100644 --- a/work_sell/forms.py +++ b/work_sell/forms.py @@ -15,16 +15,27 @@ class ContractorWorkSellTrashForm(forms.Form): class WorkSellForm(forms.ModelForm): - class Meta: model = WorkSell - fields = '__all__' + fields = ( + 'budget', + 'building_classification', + 'construction_type', + 'contractor', + 'currency', + 'description', + 'location', + 'name', + 'specialization', + 'term', + 'term_type', + ) widgets = { - 'construction_type': forms.Select(attrs={'class':'selectpicker'}), - 'building_classification': forms.Select(attrs={'class':'selectpicker'}), - 'currency': forms.Select(attrs={'class':'selectpicker'}), - 'term_type': forms.Select(attrs={'class':'selectpicker'}), + 'construction_type': forms.Select(attrs={'class': 'selectpicker'}), + 'building_classification': forms.Select(attrs={'class': 'selectpicker'}), + 'currency': forms.Select(attrs={'class': 'selectpicker'}), + 'term_type': forms.Select(attrs={'class': 'selectpicker'}), } def __init__(self, *args, **kwargs): diff --git a/work_sell/migrations/0003_auto_20160812_1151.py b/work_sell/migrations/0003_auto_20160812_1151.py new file mode 100644 index 0000000..b59345e --- /dev/null +++ b/work_sell/migrations/0003_auto_20160812_1151.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-08-12 08:51 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.utils.timezone + + +class Migration(migrations.Migration): + + dependencies = [ + ('work_sell', '0002_auto_20160805_1736'), + ] + + operations = [ + migrations.AlterField( + model_name='worksell', + name='created', + field=models.DateTimeField(default=django.utils.timezone.now), + ), + ] diff --git a/work_sell/urls.py b/work_sell/urls.py index b6ecdb8..90a7d6d 100644 --- a/work_sell/urls.py +++ b/work_sell/urls.py @@ -18,12 +18,12 @@ app_name = 'work_sell' urlpatterns = [ urls.url(r'^$', WorkSellsView.as_view(), name='list'), - urls.url(r'^create/$', WorkSellCreateView.as_view(), name='create'), + # urls.url(r'^create/$', WorkSellCreateView.as_view(), name='create'), urls.url(r'^upload/$', UploadView.as_view(), name='upload'), urls.url(r'^(?P\d+)/edit/$',WorkSellUpdateView.as_view(), name='edit'), urls.url(r'^(?P\d+)/delete/$',WorkSellDeleteView.as_view(), name='delete'), urls.url(r'^(?P\d+)/trash/$', ContractorWorkSellTrashView.as_view(), name='contractor-worksell-trash'), - urls.url(r'^test/$', work_sell_create, name='test'), + urls.url(r'^create/$', work_sell_create, name='create'), urls.url(r'^basic/$', BasicCreateView.as_view(), name='upload-basic'), urls.url(r'^new/$', PictureCreateView.as_view(), name='upload-new'), urls.url(r'^(?P\d+)/$', WorkSellDetail.as_view(), name='detail'),