\d+)/$',
15 | ProductDetail.as_view(), name='product_detail'),
16 | url(r'^brands/$', BrandList.as_view(), name='brand_list'),
17 | url(r'^categorys/$', CategoryList.as_view(), name='category_list'),
18 |
19 | url(r'^person/add/$', PersonCreate.as_view(), name='person_add'),
20 | url(r'^occupation/add/$', OccupationCreate.as_view(),
21 | name='occupation_add'),
22 | url(r'^address/add/$', AddressCreate.as_view(), name='address_add'),
23 | url(r'^phone/add/$', PhoneCreate.as_view(), name='phone_add'),
24 | url(r'^product/add/$', ProductCreate.as_view(), name='product_add'),
25 | url(r'^brand/add/$', BrandCreate.as_view(), name='brand_add'),
26 | url(r'^category/add/$', CategoryCreate.as_view(), name='category_add'),
27 |
28 | url(r'^download/$', 'download', name='download'),
29 | url(r'^about/$', 'about', name='about'),
30 | url(r'^contact/$', 'contact', name='contact'),
31 | url(r'^admin/', include(admin.site.urls), name='admin'),
32 | )
33 |
--------------------------------------------------------------------------------
/myproject/fixtures/limbo/gen_random_json.py:
--------------------------------------------------------------------------------
1 | #!python3
2 | import io
3 | import sys
4 | import datetime
5 | import names
6 | from gen_random_values import *
7 |
8 | lista = []
9 | repeat = 100
10 | with io.open('fixtures.json', 'wt') as f:
11 | for i in range(repeat):
12 | date = datetime.datetime.now().isoformat(" ")
13 | fname = names.get_first_name()
14 | lname = names.get_last_name()
15 | email = fname[0].lower() + '.' + lname.lower() + '@email.com'
16 | b = random.choice(['true', 'false'])
17 | # pk, first_name, last_name, cpf, birthday, email, phone, blocked,
18 | # created_at, modified_at
19 | lista.append(
20 | (i + 1, fname, lname, gen_cpf(), gen_timestamp(), email, gen_phone(), b, date, date))
21 | f.write('[\n')
22 | for l in lista:
23 | s = "{\n" + \
24 | str(' "pk": ') + str(l[0]) + ",\n" + \
25 | str(' "model": "core.person",\n') + \
26 | str(' "fields": {\n') + \
27 | str(' "first_name": "') + l[1] + str('",\n') + \
28 | str(' "last_name": "') + l[2] + str('",\n') + \
29 | str(' "cpf": "') + l[3] + str('",\n') + \
30 | str(' "birthday": "') + l[4] + str('",\n') + \
31 | str(' "email": "') + l[5] + str('",\n') + \
32 | str(' "phone": "') + l[6] + str('",\n') + \
33 | str(' "blocked": ') + l[7] + str(',\n') + \
34 | str(' "created_at": "') + l[8] + str('",\n') + \
35 | str(' "modified_at": "') + l[9] + str('"\n') + \
36 | " }\n"
37 | if l[0] == repeat:
38 | s = s + "}\n"
39 | else:
40 | s = s + "},\n"
41 | f.write(str(s))
42 | f.write(']\n')
43 |
--------------------------------------------------------------------------------
/modelagem/tables.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz]{standalone}
2 | \usepackage[utf8]{inputenc}
3 | \usepackage[T1]{fontenc}
4 | \usepackage{tikz-uml}
5 | \usepackage[pdfpagelayout=SinglePage]{hyperref}
6 |
7 | \begin{document}
8 |
9 | \begin{tikzpicture}
10 | \umlclass[x=0,y=0]{Person}{
11 | - id \\
12 | - gender \\
13 | - treatment \\
14 | - first\_name \\
15 | - last\_name \\
16 | - cpf \\
17 | - birthday \\
18 | - email \\
19 | + \color{blue}{occupation\_id} \\
20 | - blocked \\
21 | - created\_at \\
22 | - modified\_at \\
23 | }{}
24 | \umlclass[x=-5,y=5]{Address}{
25 | - id \\
26 | - type\_address \\
27 | - address \\
28 | - address\_number \\
29 | - complement \\
30 | - district \\
31 | - city \\
32 | - uf \\
33 | - cep \\
34 | + \color{blue}{person\_id} \\
35 | }{}
36 | \umlclass[x=-5,y=0]{Occupation}{
37 | - id \\
38 | - occupation \\
39 | }{}
40 | \umlclass[x=-5,y=-5]{Phone}{
41 | - id \\
42 | - phone \\
43 | - type\_phone \\
44 | + \color{blue}{person\_id} \\
45 | }{}
46 | \umlclass[x=5,y=0,fill=green!20]{Product}{
47 | - id \\
48 | - imported \\
49 | - outofline \\
50 | - ncm \\
51 | + \color{blue}{category\_id} \\
52 | + \color{blue}{brand\_id} \\
53 | - product \\
54 | - cost \\
55 | - icms \\
56 | - ipi \\
57 | - stock \\
58 | - stock\_min \\
59 | - created\_at \\
60 | - modified\_at \\
61 | }{}
62 | \umlclass[x=10,y=2,fill=green!20]{Category}{
63 | - id \\
64 | - category \\
65 | }{}
66 | \umlclass[x=10,y=-2,fill=green!20]{Brand}{
67 | - id \\
68 | - brand \\
69 | }{}
70 |
71 | \umlassoc{Person}{Address}
72 | \umlassoc{Person}{Occupation}
73 | \umlassoc{Person}{Phone}
74 | \umlassoc{Product}{Category}
75 | \umlassoc{Product}{Brand}
76 | \end{tikzpicture}
77 |
78 | \end{document}
--------------------------------------------------------------------------------
/myproject/core/applib/lists.py:
--------------------------------------------------------------------------------
1 | """ List of values for use in choices in models. """
2 |
3 | gender_list = [('M', 'masculino'), ('F', 'feminino')]
4 |
5 | treatment_list = (
6 | ('a', 'Arq.'),
7 | ('aa', 'Arqa.'),
8 | ('d', 'Dona'),
9 | ('dr', 'Dr.'),
10 | ('dra', 'Dra.'),
11 | ('e', 'Eng.'),
12 | ('ea', u'Engª.'),
13 | ('p', 'Prof.'),
14 | ('pa', 'Profa.'),
15 | ('sr', 'Sr.'),
16 | ('sra', 'Sra.'),
17 | ('srta', 'Srta.'),
18 | )
19 |
20 | type_address_list = (
21 | ('i', 'indefinido'),
22 | ('c', 'comercial'),
23 | ('r', 'residencial'),
24 | ('o', 'outros'),
25 | )
26 |
27 | uf_list = (
28 | ('AC', 'Acre'),
29 | ('AL', 'Alagoas'),
30 | ('AM', 'Amazonas'),
31 | ('AP', u'Amapá'),
32 | ('BA', 'Bahia'),
33 | ('CE', u'Ceará'),
34 | ('DF', u'Brasília'),
35 | ('ES', u'Espírito Santo'),
36 | ('GO', u'Goiás'),
37 | ('MA', u'Maranhão'),
38 | ('MG', 'Minas Gerais'),
39 | ('MS', 'Mato Grosso do Sul'),
40 | ('MT', 'Mato Grosso'),
41 | ('PA', u'Pará'),
42 | ('PB', u'Paraíba'),
43 | ('PE', 'Pernambuco'),
44 | ('PI', u'Piauí'),
45 | ('PR', u'Paraná'),
46 | ('RJ', 'Rio de Janeiro'),
47 | ('RN', 'Rio Grande do Norte'),
48 | ('RO', u'Rondônia'),
49 | ('RR', 'Roraima'),
50 | ('RS', 'Rio Grande do Sul'),
51 | ('SC', 'Santa Catarina'),
52 | ('SE', 'Sergipe'),
53 | ('SP', u'São Paulo'),
54 | ('TO', 'Tocantins'),
55 | )
56 |
57 | type_phone_list = (
58 | ('pri', 'principal'),
59 | ('com', 'comercial'),
60 | ('res', 'residencial'),
61 | ('cel', 'celular'),
62 | ('cl', 'Claro'),
63 | ('oi', 'Oi'),
64 | ('t', 'Tim'),
65 | ('v', 'Vivo'),
66 | ('n', 'Nextel'),
67 | ('fax', 'fax'),
68 | ('o', 'outros'),
69 | )
70 |
--------------------------------------------------------------------------------
/modelagem/tabelas.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz]{standalone}
2 | \usepackage[utf8]{inputenc}
3 | \usepackage[T1]{fontenc}
4 | \usepackage{tikz-uml}
5 | \usepackage[pdfpagelayout=SinglePage]{hyperref}
6 |
7 | \begin{document}
8 |
9 | \begin{tikzpicture}
10 | \umlclass[x=0,y=0]{Pessoa}{
11 | - id \\
12 | - genero \\
13 | - tratamento \\
14 | - nome \\
15 | - sobrenome \\
16 | - cpf \\
17 | - aniversario \\
18 | - email \\
19 | + \color{blue}{cargo\_id} \\
20 | - bloqueado \\
21 | - criado\_em \\
22 | - modificado\_em \\
23 | }{}
24 | \umlclass[x=-5,y=5]{Endereço}{
25 | - id \\
26 | - tipo\_endereco \\
27 | - endereco \\
28 | - num\_endereco \\
29 | - complemento \\
30 | - bairro \\
31 | - cidade \\
32 | - uf \\
33 | - cep \\
34 | + \color{blue}{pessoa\_id} \\
35 | }{}
36 | \umlclass[x=-5,y=0]{Cargo}{
37 | - id \\
38 | - cargo \\
39 | }{}
40 | \umlclass[x=-5,y=-5]{Telefone}{
41 | - id \\
42 | - telefone \\
43 | - tipo\_telefone \\
44 | + \color{blue}{pessoa\_id} \\
45 | }{}
46 | \umlclass[x=5,y=0,fill=green!20]{Produto}{
47 | - id \\
48 | - importado \\
49 | - fora\_de\_linha \\
50 | - ncm \\
51 | + \color{blue}{categoria\_id} \\
52 | + \color{blue}{marca\_id} \\
53 | - produto \\
54 | - custo \\
55 | - icms \\
56 | - ipi \\
57 | - estoque \\
58 | - estoque\_minimo \\
59 | - criado\_em \\
60 | - modificado\_em \\
61 | }{}
62 | \umlclass[x=10,y=2,fill=green!20]{Categoria}{
63 | - id \\
64 | - categoria \\
65 | }{}
66 | \umlclass[x=10,y=-2,fill=green!20]{Marca}{
67 | - id \\
68 | - marca \\
69 | }{}
70 |
71 | \umlassoc{Pessoa}{Endereço}
72 | \umlassoc{Pessoa}{Cargo}
73 | \umlassoc{Pessoa}{Telefone}
74 | \umlassoc{Produto}{Categoria}
75 | \umlassoc{Produto}{Marca}
76 | \end{tikzpicture}
77 |
78 | \end{document}
--------------------------------------------------------------------------------
/myproject/core/templates/core/person/occupation_list.html:
--------------------------------------------------------------------------------
1 | {% extends "base.html" %}
2 |
3 | {% block title %}
4 | Occupation List
5 | {% endblock title %}
6 |
7 | {% block content %}
8 |
19 |
20 | Lista de {{ name_plural.capitalize }}
21 |
22 |
23 | {% if occupation_list %}
24 |
25 |
26 |
27 | | Profissão |
28 |
29 |
30 |
31 | {% for occupation in occupation_list %}
32 |
33 | | {{ occupation.occupation }} |
34 |
35 | {% endfor %}
36 |
37 |
38 | {% else %}
39 |
Sem itens na lista.
40 | {% endif %}
41 |
42 |
43 |
44 |
45 |
Total: {{ count }}
46 | {% if count <= 1 %}
47 | {{ name }}
48 | {% else %}
49 | {{ name_plural }}
50 | {% endif %}
51 |
52 |
53 |
54 |
55 | {% include "pagination.html" %}
56 |
57 | {% endblock content %}
--------------------------------------------------------------------------------
/myproject/core/tests/test_list_product.py:
--------------------------------------------------------------------------------
1 | from django.test import TestCase
2 | from django.core.urlresolvers import reverse as r
3 |
4 |
5 | class ProductListTest(TestCase):
6 |
7 | def setUp(self):
8 | self.resp = self.client.get(r('product_list'))
9 |
10 | def test_get(self):
11 | 'GET /products/ must return status code 200.'
12 | self.assertEqual(200, self.resp.status_code)
13 |
14 | def test_template(self):
15 | 'Response should be a rendered template.'
16 | self.assertTemplateUsed(
17 | self.resp, 'core/product/product_list.html')
18 |
19 | def test_html(self):
20 | 'Html must contain input controls.'
21 | self.assertContains(self.resp, '', 8)
22 |
23 |
24 | class BrandListTest(TestCase):
25 |
26 | def setUp(self):
27 | self.resp = self.client.get(r('brand_list'))
28 |
29 | def test_get(self):
30 | 'GET /brands/ must return status code 200.'
31 | self.assertEqual(200, self.resp.status_code)
32 |
33 | def test_template(self):
34 | 'Response should be a rendered template.'
35 | self.assertTemplateUsed(
36 | self.resp, 'core/product/brand_list.html')
37 |
38 | def test_html(self):
39 | 'Html must contain input controls.'
40 | self.assertContains(self.resp, '', 1)
41 |
42 |
43 | class CategoryListTest(TestCase):
44 |
45 | def setUp(self):
46 | self.resp = self.client.get(r('category_list'))
47 |
48 | def test_get(self):
49 | 'GET /categorys/ must return status code 200.'
50 | self.assertEqual(200, self.resp.status_code)
51 |
52 | def test_template(self):
53 | 'Response should be a rendered template.'
54 | self.assertTemplateUsed(
55 | self.resp, 'core/product/category_list.html')
56 |
57 | def test_html(self):
58 | 'Html must contain input controls.'
59 | self.assertContains(self.resp, '', 1)
60 |
--------------------------------------------------------------------------------
/myproject/fixtures/gen_products_csv.py:
--------------------------------------------------------------------------------
1 | #!python3
2 | import io
3 | import sys
4 | import datetime
5 | import names
6 | from gen_random_values import *
7 |
8 | product_list = []
9 | repeat = 100
10 | with io.open('fixtures/produtos.csv', 'wt') as f:
11 | f.write(
12 | 'id,imported,outofline,ncm,category,brand,product,cost,icms,ipi,stock,stock_min,created_at,modified_at\n')
13 | for i in range(repeat):
14 | imported = random.choice(['True', 'False'])
15 | outofline = random.choice(['True', 'False'])
16 | ncm = gen_ncm()
17 | category = random.randint(1, 23)
18 | brand = random.randint(1, 20)
19 | # le uma lista de produtos.
20 | p = io.open('fixtures/produtos1.csv', 'rt', encoding='utf-8')
21 | linelist = p.readlines()
22 |
23 | product = linelist[i].split('\n')[0]
24 | cost = gen_decimal(4, 2)
25 |
26 | ipi = 0
27 | # para o ipi ficar abaixo de 0.5
28 | if imported == 'True':
29 | ipi = float(gen_ipi())
30 | if ipi > 0.5:
31 | ipi = ipi - 0.5
32 |
33 | icms = gen_ipi()
34 | stock = random.randint(1, 200)
35 | stock_min = random.randint(1, 20)
36 | date = datetime.datetime.now().isoformat(" ") + "+00"
37 | # id, imported, outofline, ncm, category_id, brand_id, product, cost, icms, ipi, stock, stock_min, created_at, modified_at
38 | product_list.append(
39 | (i + 1, imported, outofline, ncm, category, brand, product, cost, icms, ipi, stock, stock_min, date, date))
40 | for l in product_list:
41 | s = str(l[0]) + "," + str(l[1]) + "," + str(l[2]) + "," + str(l[3]) \
42 | + "," + str(l[4]) + "," + str(l[5]) + "," + str(l[6]) + "," + str(l[7]) \
43 | + "," + str(l[8]) + "," + str(l[9]) + "," + \
44 | str(l[10]) + "," + str(l[11]) + "," + \
45 | str(l[12]) + "," + str(l[13]) + "\n"
46 | f.write(str(s))
47 |
--------------------------------------------------------------------------------
/myproject/templates_admin/admin/login.html:
--------------------------------------------------------------------------------
1 | {% extends "base_initial.html" %}
2 | {% load i18n admin_static %}
3 | {% load bootstrap3 %}
4 |
5 | {% block extrastyle %}{{ block.super }}{% endblock %}
6 |
7 | {% block bodyclass %}{{ block.super }} login{% endblock %}
8 |
9 | {% block title %}
10 | Login
11 | {% endblock title %}
12 |
13 | {% block content %}
14 |
15 | {% if form.errors and not form.non_field_errors %}
16 |
17 | {% if form.errors.items|length == 1 %}{% trans "Please correct the error below." %}{% else %}{% trans "Please correct the errors below." %}{% endif %}
18 |
19 | {% endif %}
20 |
21 | {% if form.non_field_errors %}
22 | {% for error in form.non_field_errors %}
23 |
24 | {{ error }}
25 |
26 | {% endfor %}
27 | {% endif %}
28 |
29 |
61 |
62 | {% endblock %}
--------------------------------------------------------------------------------
/myproject/core/templates/core/product/brand_list.html:
--------------------------------------------------------------------------------
1 | {% extends "base.html" %}
2 |
3 | {% block title %}
4 | Brand List
5 | {% endblock title %}
6 |
7 | {% block content %}
8 |
19 |
20 | Lista de {{ name_plural.capitalize }}
21 |
22 |
23 | {% if brand_list %}
24 |
25 |
26 |
27 | | Marca |
28 |
29 |
30 |
31 | {% for brand in brand_list %}
32 |
33 | | {{ brand.brand.capitalize }} |
34 |
35 | {% empty %}
36 | Sem itens na lista.
37 | {% endfor %}
38 |
39 |
40 | {% else %}
41 |
Sem itens na lista.
42 | {% endif %}
43 |
44 |
45 |
46 |
47 |
Total: {{ count }}
48 | {% if count <= 1 %}
49 | {{ name }}
50 | {% else %}
51 | {{ name_plural }}
52 | {% endif %}
53 |
54 |
55 |
56 |
57 | {% include "pagination.html" %}
58 |
59 | {% endblock content %}
--------------------------------------------------------------------------------
/myproject/core/templates/limbo/image_list.html:
--------------------------------------------------------------------------------
1 | {% extends "base.html" %}
2 |
3 | {% block title %}
4 | Product List
5 | {% endblock title %}
6 |
7 | {% block content %}
8 |
19 |
20 | Lista de Produtos (NCM fictício)
21 |
22 |
23 |
24 |
25 |
26 | | Importado |
27 | NCM |
28 | Categoria |
29 | Marca |
30 | Produto |
31 | Custo |
32 | ICMS |
33 | IPI |
34 | Estoque atual |
35 | Estoque Min. |
36 |
37 |
38 |
39 |
40 | {% for product in object_list %}
41 |
42 |
43 | {{ product.product }}
44 |
45 |
46 | {% empty %}
47 |
Sem itens na lista.
48 | {% endfor %}
49 |
50 |
51 |
52 |
53 |
54 |
55 | {% include "pagination.html" %}
56 |
57 | {% endblock content %}
--------------------------------------------------------------------------------
/myproject/core/templates/core/product/category_list.html:
--------------------------------------------------------------------------------
1 | {% extends "base.html" %}
2 |
3 | {% block title %}
4 | Category List
5 | {% endblock title %}
6 |
7 | {% block content %}
8 |
19 |
20 | Lista de {{ name_plural.capitalize }}
21 |
22 |
23 | {% if category_list %}
24 |
25 |
26 |
27 | | Categoria |
28 |
29 |
30 |
31 | {% for category in category_list %}
32 |
33 | | {{ category.category }} |
34 |
35 | {% empty %}
36 | Sem itens na lista.
37 | {% endfor %}
38 |
39 |
40 | {% else %}
41 |
Sem itens na lista.
42 | {% endif %}
43 |
44 |
45 |
46 |
47 |
Total: {{ count }}
48 | {% if count <= 1 %}
49 | {{ name }}
50 | {% else %}
51 | {{ name_plural }}
52 | {% endif %}
53 |
54 |
55 |
56 |
57 | {% include "pagination.html" %}
58 |
59 | {% endblock content %}
--------------------------------------------------------------------------------
/myproject/core/admin.py:
--------------------------------------------------------------------------------
1 | from django.contrib import admin
2 | from .models import Person, Occupation, Address, Phone, Brand, Category, Product
3 |
4 |
5 | class PersonAdmin(admin.ModelAdmin):
6 |
7 | """Customize the look of the auto-generated admin for the Person model"""
8 | ordering = ['first_name']
9 | list_display = (
10 | '__str__', 'cpf', 'email', 'occupation', 'created_at', 'active', 'blocked')
11 | date_hierarchy = 'created_at'
12 | search_fields = ('first_name', 'last_name')
13 | list_filter = ('gender', 'active', 'blocked',)
14 |
15 |
16 | class AddressAdmin(admin.ModelAdmin):
17 |
18 | """Customize the look of the auto-generated admin for the Address model"""
19 | ordering = ['person']
20 | list_display = (
21 | 'person', 'address', 'district', 'city', 'uf', 'cep', 'type_address')
22 | search_fields = (
23 | 'person__first_name', 'address', 'district', 'city', 'cep')
24 | list_filter = ('type_address', 'uf')
25 |
26 |
27 | class PhoneAdmin(admin.ModelAdmin):
28 |
29 | """Customize the look of the auto-generated admin for the Phone model"""
30 | ordering = ['person']
31 | list_display = ('person', 'phone', 'type_phone')
32 | search_fields = ('person__first_name',)
33 | list_filter = ('type_phone',)
34 |
35 |
36 | class ProductAdmin(admin.ModelAdmin):
37 |
38 | """Customize the look of the auto-generated admin for the Product model"""
39 | ordering = ['product']
40 | list_display = (
41 | 'ncm', 'imported', 'product', 'category', 'brand', 'cost', 'stock', 'outofline')
42 | date_hierarchy = 'created_at'
43 | search_fields = ('product', 'ncm')
44 | list_filter = ('imported', 'outofline', 'category', 'brand',)
45 |
46 | admin.site.register(Person, PersonAdmin) # Use the customized options
47 | admin.site.register(Occupation)
48 | admin.site.register(Address, AddressAdmin)
49 | admin.site.register(Phone, PhoneAdmin)
50 | admin.site.register(Brand)
51 | admin.site.register(Category)
52 | admin.site.register(Product, ProductAdmin)
53 |
--------------------------------------------------------------------------------
/myproject/settings.py:
--------------------------------------------------------------------------------
1 | import dj_database_url
2 | from unipath import Path
3 | BASE_DIR = Path(__file__).parent
4 |
5 | # SECURITY WARNING: keep the secret key used in production secret!
6 | SECRET_KEY = 'i-f5v($6g54-nr2nvkx%ekkson*+6qf47my1+)jmbd9dvnu@6%'
7 |
8 | # SECURITY WARNING: don't run with debug turned on in production!
9 | DEBUG = True
10 |
11 | TEMPLATE_DEBUG = True
12 |
13 | ALLOWED_HOSTS = []
14 |
15 |
16 | # Application definition
17 |
18 | INSTALLED_APPS = (
19 | 'django.contrib.admin',
20 | 'django.contrib.auth',
21 | 'django.contrib.contenttypes',
22 | 'django.contrib.sessions',
23 | 'django.contrib.messages',
24 | 'django.contrib.staticfiles',
25 | 'django_extensions',
26 | 'bootstrap3',
27 | 'myproject.core',
28 | )
29 |
30 | MIDDLEWARE_CLASSES = (
31 | 'django.contrib.sessions.middleware.SessionMiddleware',
32 | 'django.middleware.common.CommonMiddleware',
33 | 'django.middleware.csrf.CsrfViewMiddleware',
34 | 'django.contrib.auth.middleware.AuthenticationMiddleware',
35 | 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
36 | 'django.contrib.messages.middleware.MessageMiddleware',
37 | 'django.middleware.clickjacking.XFrameOptionsMiddleware',
38 | )
39 |
40 | ROOT_URLCONF = 'myproject.urls'
41 |
42 | WSGI_APPLICATION = 'myproject.wsgi.application'
43 |
44 |
45 | # Database
46 | # https://docs.djangoproject.com/en/1.7/ref/settings/#databases
47 |
48 | DATABASES = {
49 | 'default': dj_database_url.config(
50 | default='sqlite:///' + BASE_DIR.child('db.sqlite3'))
51 | }
52 |
53 | # Internationalization
54 | # https://docs.djangoproject.com/en/1.7/topics/i18n/
55 |
56 | LANGUAGE_CODE = 'pt-br'
57 |
58 | TIME_ZONE = 'UTC'
59 |
60 | USE_I18N = True
61 |
62 | USE_L10N = True
63 |
64 | USE_TZ = True
65 |
66 | USE_THOUSAND_SEPARATOR = True
67 |
68 | # Static files (CSS, JavaScript, Images)
69 | STATIC_ROOT = BASE_DIR.child('staticfiles')
70 | STATIC_URL = '/static/'
71 |
72 | TEMPLATE_DIRS = (
73 | BASE_DIR.child('templates_admin'),
74 | )
75 |
--------------------------------------------------------------------------------
/myproject/fixtures/gen_address_csv.py:
--------------------------------------------------------------------------------
1 | #!python3
2 | import io
3 | import sys
4 | import rstr
5 | import urllib.request
6 | import json
7 | from gen_random_values import *
8 | from pprint import pprint
9 |
10 |
11 | type_address_list = (
12 | ('i'),
13 | ('c'),
14 | ('r'),
15 | ('o'),
16 | )
17 |
18 |
19 | address_list = []
20 | repeat = 10
21 | print('\nwait...\n')
22 | with io.open('fixtures/enderecos.csv', 'wt') as f:
23 | f.write(
24 | 'id,type_address,address,address_number,district,city,uf,cep,person\n')
25 | for i in range(repeat):
26 | print(repeat - i)
27 | # le uma lista de ceps validos e escolhe um deles.
28 | p = io.open('fixtures/ceps.csv', 'rt', encoding='utf-8')
29 | linelist = p.readlines()
30 | l = random.randint(1, 848877)
31 | # retorna o cep no formato 00000000
32 | cep = linelist[l].split('\n')[0].strip("'")
33 | # acessa a url a seguir
34 | url = 'http://viacep.com.br/ws/' + str(cep) + '/json'
35 | resp = urllib.request.urlopen(url).read()
36 | # carrega o json
37 | data = json.loads(resp.decode('utf-8'))
38 | # pprint(data)
39 |
40 | type_address = random.choice(type_address_list)
41 | address = data['logradouro']
42 | address_number = random.randint(1, 9999)
43 | district = data['bairro']
44 | city = data['localidade']
45 | uf = data['uf']
46 | person = random.randint(1, 100) # person registrados
47 | # id, type_address, address, address_number, district, city, uf, cep, person
48 | address_list.append(
49 | (i + 1, type_address, address, address_number, district, city, uf, cep, person))
50 | print('\nbe patient...\n')
51 | for l in address_list:
52 | s = str(l[0]) + "," + str(l[1]) + "," + \
53 | str(l[2]) + "," + str(l[3]) + "," + \
54 | str(l[4]) + "," + str(l[5]) + "," + \
55 | str(l[6]) + "," + str(l[7]) + "," + \
56 | str(l[8]) + "\n"
57 | f.write(str(s))
58 |
--------------------------------------------------------------------------------
/modelagem/README.md:
--------------------------------------------------------------------------------
1 | django-example
2 | ==============
3 |
4 | # Modelo
5 |
6 | **mer.tex** é a modelagem conceitual (coloquei apenas as entidades). Para fazer este documento eu usei o [LaTeX][9] junto com o pacote [tikz-er2][10].
7 |
8 | Para compilar o documento use o comando (precisa instalar o *latexmk*)
9 |
10 | $ latexmk -pdf mer.tex && latexmk -c
11 |
12 | Para converter o **pdf** em **jpg** use o [Imagemagick][11].
13 |
14 | $ convert -density 300 mer.pdf mer.jpg
15 |
16 | 
17 |
18 | **tabelas.tex** foi feito em [LaTeX][9] junto com o pacote [tikz-uml][12].
19 |
20 | 
21 |
22 | 
23 |
24 | # Notas
25 |
26 | Para gerar **core.png** use a biblioteca [django-extensions][1] junto com
27 |
28 | $ ./manage.py graph_models -a -g -o core.png
29 |
30 | ou
31 |
32 | $ ./manage.py graph_models -e -g -l dot -o core.png core
33 |
34 | Se der **erro**, instale *pyparsing* novamente desta forma:
35 |
36 | $ pip uninstall pyparsing
37 | $ pip install -Iv https://pypi.python.org/packages/source/p/pyparsing/pyparsing-1.5.7.tar.gz#md5=9be0fcdcc595199c646ab317c1d9a709
38 | $ pip install pydot
39 | $ pip freeze > requirements.txt
40 |
41 | 
42 |
43 | Leia [django-notes][8].
44 |
45 | [0]: https://www.djangoproject.com/
46 | [1]: http://django-extensions.readthedocs.org/en/latest/
47 | [2]: https://docs.djangoproject.com/en/dev/ref/class-based-views/
48 | [3]: https://docs.djangoproject.com/en/dev/ref/class-based-views/base/#templateview
49 | [4]: https://docs.djangoproject.com/en/dev/ref/class-based-views/generic-display/#listview
50 | [5]: https://docs.djangoproject.com/en/dev/ref/class-based-views/generic-editing/#formview
51 | [8]: http://django-notes.blogspot.com.br/2012/07/vizualization.html
52 | [9]: http://latexbr.blogspot.com.br/
53 | [10]: https://bitbucket.org/pavel_calado/tikz-er2/wiki/Home
54 | [11]: http://grandeportal.blogspot.com.br/2012/06/editando-imagens-no-imagemagick.html
55 | [12]: http://perso.ensta-paristech.fr/~kielbasi/tikzuml/index.php?lang=en
56 | [13]: http://rg-vendas.herokuapp.com/
--------------------------------------------------------------------------------
/myproject/fixtures/gen_persons_csv.py:
--------------------------------------------------------------------------------
1 | #!python3
2 | import io
3 | import sys
4 | import datetime
5 | import names
6 | from gen_random_values import *
7 |
8 | """ List of values for use in choices in models. """
9 | treatment_male_list = (
10 | ('a'),
11 | ('dr'),
12 | ('e'),
13 | ('p'),
14 | ('sr'),
15 | )
16 |
17 | treatment_female_list = (
18 | ('aa'),
19 | ('d'),
20 | ('ea'),
21 | ('pa'),
22 | ('sra'),
23 | ('srta'),
24 | )
25 |
26 | person_list = []
27 | repeat = 100
28 | with io.open('fixtures/pessoas.csv', 'wt') as f:
29 | f.write(
30 | 'id,gender,treatment,first_name,last_name,cpf,birthday,email,occupation,active,blocked,created_at,modified_at\n')
31 | for i in range(repeat):
32 | g = random.choice(['M', 'F'])
33 | if g == 'M':
34 | treatment = random.choice(treatment_male_list)
35 | first_name = names.get_first_name(gender='male')
36 | else:
37 | treatment = random.choice(treatment_female_list)
38 | first_name = names.get_first_name(gender='female')
39 | last_name = names.get_last_name()
40 | cpf = gen_cpf()
41 | birthday = gen_timestamp() + '+00'
42 | email = first_name[
43 | 0].lower() + '.' + last_name.lower() + '@example.com'
44 | occupation = random.randint(1, 163) # occupation registrados
45 | active = random.choice(['True', 'False'])
46 | blocked = random.choice(['True', 'False'])
47 | date = datetime.datetime.now().isoformat(" ") + "+00"
48 | # id,gender,treatment,first_name,last_name,cpf,birthday,email,occupation,active,blocked,created_at,modified_at
49 | person_list.append(
50 | (i + 1, g, treatment, first_name, last_name, cpf, birthday, email, occupation, active, blocked, date, date))
51 | for l in person_list:
52 | s = str(l[0]) + "," + str(l[1]) + "," + str(l[2]) + "," + str(l[3]) \
53 | + "," + str(l[4]) + "," + str(l[5]) + "," + str(l[6]) + "," + str(l[7]) \
54 | + "," + str(l[8]) + "," + str(l[9]) + "," + \
55 | str(l[10]) + "," + str(l[11]) + "," + \
56 | str(l[12]) + "\n"
57 | f.write(str(s))
58 |
--------------------------------------------------------------------------------
/myproject/core/templates/core/product/product_detail.html:
--------------------------------------------------------------------------------
1 | {% extends "base.html" %}
2 |
3 | {% block title %}
4 | Product Detail
5 | {% endblock title %}
6 |
7 | {% block content %}
8 |
9 | -
10 | Produto
11 | {{ object.product }}
12 |
13 | -
14 | Importado
15 | {% if object.imported %}
16 |
17 | {% else %}
18 |
19 | {% endif %}
20 |
21 |
22 | -
23 | Fora de linha
24 | {% if object.outofline %}
25 |
26 | {% else %}
27 |
28 | {% endif %}
29 |
30 |
31 | -
32 | NCM
33 | {{ object.ncm }}
34 |
36 |
39 | -
40 | Marca
41 | {{ object.brand }}
42 | -
43 | Custo
44 | {{ object.cost }}
45 | -
46 | ICMS
47 | {{ object.get_icms }}%
48 |
49 | -
50 | IPI
51 | {% if object.get_ipi == "0" %}
52 | ---
53 | {% else %}
54 | {{ object.get_ipi }}%
55 | {% endif %}
56 |
57 | -
58 | Estoque
59 | {{ object.stock }}
60 | -
61 | Estoque Mínimo
62 | {{ object.stock_min }}
63 |
64 | {% endblock content %}
--------------------------------------------------------------------------------
/myproject/core/tests/test_forms.py:
--------------------------------------------------------------------------------
1 | from django.test import TestCase
2 | from myproject.core.forms import PersonForm, AddressForm, ProductForm
3 |
4 |
5 | class PersonFormTest(TestCase):
6 |
7 | # def test_cpf_is_digit(self):
8 | # 'CPF must only accept digits.'
9 | # form = self.make_validated_form(cpf='ABCD0000000')
10 | # self.assertItemsEqual(['cpf'], form.errors)
11 |
12 | # def test_cpf_has_11_digits(self):
13 | # 'CPF must have 11 digits.'
14 | # form = self.make_validated_form(cpf='1234')
15 | # self.assertItemsEqual(['cpf'], form.errors)
16 |
17 | def test_name_must_be_capitalized(self):
18 | 'Name must be capitalized.'
19 | form = self.make_validated_form(name='REGIS')
20 | self.assertEqual('Regis', form.cleaned_data['first_name'])
21 |
22 | def make_validated_form(self, **kwargs):
23 | data = dict(
24 | occupation=1,
25 | gender='M',
26 | treatment='sr',
27 | first_name='Regis',
28 | last_name='da Silva',
29 | cpf='11122233396',
30 | birthday='1979-05-31T00:00:00+00:00',
31 | email='r.santos@example.com',
32 | phone=1,
33 | blocked=False,
34 | )
35 | data.update(kwargs)
36 | form = PersonForm(data)
37 | form.is_valid()
38 | return form
39 |
40 |
41 | class AddressFormTest(TestCase):
42 |
43 | def make_validated_form(self, **kwargs):
44 | data = dict(
45 | person=1,
46 | type_address='c',
47 | address=u'Av. Paulista',
48 | address_number=721,
49 | complement=u'apto 313',
50 | district=u'Bela Vista',
51 | city=u'São Paulo',
52 | uf='SP',
53 | cep='01311-100',
54 | )
55 | data.update(kwargs)
56 | form = AddressForm(data)
57 | form.is_valid()
58 | return form
59 |
60 |
61 | class ProductFormTest(TestCase):
62 |
63 | def make_validated_form(self, **kwargs):
64 | data = dict(
65 | brand=1,
66 | category=1,
67 | imported=True,
68 | outofline=False,
69 | ncm='12345678',
70 | product=u'Amendoim',
71 | cost=5.75,
72 | icms=0.05,
73 | ipi=0.1,
74 | stock=100,
75 | stock_min=50,
76 | )
77 | data.update(kwargs)
78 | form = ProductForm(data)
79 | form.is_valid()
80 | return form
81 |
--------------------------------------------------------------------------------
/myproject/fixtures/gen_random_values.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | import random
3 | import rstr
4 | import datetime
5 | from decimal import Decimal
6 |
7 |
8 | def gen_age():
9 | # gera numeros inteiros entre 15 e 99
10 | return random.randint(15, 99)
11 |
12 |
13 | def gen_cpf():
14 | # gera uma string com 11 caracteres numericos
15 | return rstr.rstr('1234567890', 11)
16 |
17 |
18 | def gen_ncm():
19 | return rstr.rstr('123456789', 8)
20 |
21 |
22 | def gen_phone():
23 | # gera um telefone no formato (xx) xxxx-xxxx
24 | return '({0}) {1}-{2}'.format(
25 | rstr.rstr('1234567890', 2),
26 | rstr.rstr('1234567890', 4),
27 | rstr.rstr('1234567890', 4))
28 |
29 |
30 | def gen_timestamp(min_year=1980, max_year=1996):
31 | # gera um datetime no formato yyyy-mm-dd hh:mm:ss.000000
32 | year = random.randint(min_year, max_year)
33 | month = random.randint(11, 12)
34 | day = random.randint(1, 28)
35 | hour = random.randint(1, 23)
36 | minute = random.randint(1, 59)
37 | second = random.randint(1, 59)
38 | microsecond = random.randint(1, 999999)
39 | date = datetime.datetime(
40 | year, month, day, hour, minute, second, microsecond).isoformat(" ")
41 | return date
42 |
43 |
44 | def gen_decimal(max_digits, decimal_places):
45 | num_as_str = lambda x: ''.join(
46 | [str(random.randint(0, 9)) for i in range(x)])
47 | return Decimal("%s.%s" % (num_as_str(max_digits - decimal_places),
48 | num_as_str(decimal_places)))
49 | gen_decimal.required = ['max_digits', 'decimal_places']
50 |
51 |
52 | def gen_ipi():
53 | num_as_str = lambda x: ''.join(
54 | [str(random.randint(0, 9)) for i in range(x)])
55 | return Decimal("0.%s" % (num_as_str(2)))
56 |
57 |
58 | def gen_city():
59 | list_city = [
60 | [u'São Paulo', 'SP'],
61 | [u'Belém', 'PA'],
62 | [u'Rio de Janeiro', 'RJ'],
63 | [u'Goiânia', 'GO'],
64 | [u'Salvador', 'BA'],
65 | [u'Guarulhos', 'SP'],
66 | [u'Brasília', 'DF'],
67 | [u'Campinas', 'SP'],
68 | [u'Fortaleza', 'CE'],
69 | [u'São Luís', 'MA'],
70 | [u'Belo Horizonte', 'MG'],
71 | [u'São Gonçalo', 'RJ'],
72 | [u'Manaus', 'AM'],
73 | [u'Maceió', 'AL'],
74 | [u'Curitiba', 'PR'],
75 | [u'Duque de Caxias', 'RJ'],
76 | [u'Recife', 'PE'],
77 | [u'Natal', 'RN'],
78 | [u'Porto Alegre', 'RS'],
79 | [u'Campo Grande', 'MS']]
80 | return random.choice(list_city)
81 |
--------------------------------------------------------------------------------
/myproject/fixtures/csv2json.py:
--------------------------------------------------------------------------------
1 | # csv2json.py
2 | #
3 | # Copyright 2009 Brian Gershon -- briang at webcollective.coop
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 | # https://djangosnippets.org/snippets/1680/
17 |
18 | import sys
19 | import getopt
20 | import csv
21 | from os.path import dirname
22 | import simplejson
23 |
24 | try:
25 | script, input_file_name, model_name = sys.argv
26 | except ValueError:
27 | print("\nRun via:\n\n%s input_file_name model_name" % sys.argv[0])
28 | # print("\ne.g. %s airport.csv app_airport.Airport" % sys.argv[0])
29 | print("\ne.g. %s categorias.csv core.Category" % sys.argv[0])
30 | print(
31 | "\nNote: input_file_name should be a path relative to where this script is.")
32 | sys.exit()
33 |
34 | in_file = dirname(__file__) + input_file_name
35 | out_file = dirname(__file__) + input_file_name + ".json"
36 |
37 | print("Converting %s from CSV to JSON as %s" % (in_file, out_file))
38 |
39 | f = open(in_file, 'r')
40 | fo = open(out_file, 'w')
41 |
42 | reader = csv.reader(f)
43 |
44 | header_row = []
45 | entries = []
46 |
47 | # debugging
48 | # if model_name == 'app_airport.Airport':
49 | # import pdb ; pdb.set_trace( )
50 |
51 | for row in reader:
52 | if not header_row:
53 | header_row = row
54 | continue
55 |
56 | pk = row[0]
57 | model = model_name
58 | fields = {}
59 | for i in range(len(row) - 1):
60 | active_field = row[i + 1]
61 |
62 | # convert numeric strings into actual numbers by converting to either
63 | # int or float
64 | if active_field.isdigit():
65 | try:
66 | new_number = int(active_field)
67 | except ValueError:
68 | new_number = float(active_field)
69 | fields[header_row[i + 1]] = new_number
70 | else:
71 | fields[header_row[i + 1]] = active_field.strip()
72 |
73 | row_dict = {}
74 | row_dict["pk"] = int(pk)
75 | row_dict["model"] = model_name
76 |
77 | row_dict["fields"] = fields
78 | entries.append(row_dict)
79 |
80 | fo.write("%s" % simplejson.dumps(entries, indent=4))
81 |
82 | f.close()
83 | fo.close()
84 |
--------------------------------------------------------------------------------
/myproject/core/templates/core/person/person_detail.html:
--------------------------------------------------------------------------------
1 | {% extends "base.html" %}
2 |
3 | {% block title %}
4 | Person Detail
5 | {% endblock title %}
6 |
7 | {% block content %}
8 |
9 |
10 |
11 |
![]()
12 |
13 |
14 |
{{ object.full_name }}, {{ object.get_treatment_display }}
15 |
{{ object.occupation }}
16 |
17 |
18 |
19 |
20 |
21 |
57 |
58 | {% if phones %}
59 |
Telefones
60 |
61 |
62 |
63 | {% for phone in phones %}
64 | -
65 | {{ phone.phone }}
66 | {{ phone.get_type_phone_display }}
67 |
68 | {% endfor %}
69 |
70 |
71 | {% endif %}
72 |
73 | {% if address %}
74 |
Endereço
75 |
76 |
77 | {% for address in address %}
78 |
{{ address.get_type_address_display }}
79 |
{{ address.address }}, {{ address.address_number }}
80 |
{{ address.complement }}
81 |
Bairro: {{ address.district }}
82 |
Cidade/UF: {{ address.city }} - {{ address.uf }}
83 |
CEP: {{ address.cep }}
84 |
85 | {% endfor %}
86 | {% endif %}
87 |
88 |
89 |
90 | {% endblock content %}
--------------------------------------------------------------------------------
/myproject/core/tests/test_views_product.py:
--------------------------------------------------------------------------------
1 | from django.test import TestCase
2 | from django.core.urlresolvers import reverse as r
3 |
4 |
5 | class ProductTest(TestCase):
6 |
7 | def setUp(self):
8 | self.resp = self.client.get(r('product_add'))
9 |
10 | def test_get(self):
11 | 'GET /product/add/ must return status code 200.'
12 | self.assertEqual(200, self.resp.status_code)
13 |
14 | def test_template(self):
15 | 'Response should be a rendered template.'
16 | self.assertTemplateUsed(
17 | self.resp, 'core/product/product_create_form.html')
18 |
19 | def test_html(self):
20 | 'Html must contain input controls.'
21 | self.assertContains(self.resp, '
19 |
20 | Lista de {{ name_plural.capitalize }} (Nomes fictícios)
21 |
22 |
23 | {% if person_list %}
24 |
25 |
26 |
27 | | Nome |
28 | CPF |
29 | Email |
30 | Nascimento |
31 | Profissão |
32 | Ativo |
33 |
34 |
35 |
36 | {% for person in person_list %}
37 |
38 | | {{ person.full_name }}, {{ person.get_treatment_display }} |
39 | {{ person.cpf }} |
40 | {{ person.email }} |
41 | {{ person.birthday|date:"d/m/Y" }} |
42 | {{ person.occupation }} |
43 |
44 |
45 | {% if person.active %}
46 |
47 | {% else %}
48 |
49 | {% endif %}
50 | |
51 |
52 |
53 | {% endfor %}
54 |
55 |
56 | {% else %}
57 |
Sem itens na lista.
58 | {% endif %}
59 |
60 |
61 |
62 |
63 |
Total: {{ count }}
64 | {% if count <= 1 %}
65 | {{ name }}
66 | {% else %}
67 | {{ name_plural }}
68 | {% endif %}
69 |
70 |
71 |
72 |
73 |
74 | {% include "pagination.html" %}
75 |
76 | {% endblock content %}
--------------------------------------------------------------------------------
/myproject/core/templates/menu.html:
--------------------------------------------------------------------------------
1 |
2 |
61 |
62 |
--------------------------------------------------------------------------------
/myproject/core/templates/core/product/product_list.html:
--------------------------------------------------------------------------------
1 | {% extends "base.html" %}
2 |
3 | {% block title %}
4 | Product List
5 | {% endblock title %}
6 |
7 | {% block content %}
8 |
19 |
20 | Lista de {{ name_plural.capitalize }} (NCM fictício)
21 |
22 |
23 | {% if product_list %}
24 |
25 |
26 |
27 | | Importado |
28 | NCM |
29 | Produto |
30 | Marca |
31 | Custo |
32 | IPI |
33 | Estoque atual |
34 | Estoque Min. |
35 |
36 |
37 |
38 | {% for product in product_list %}
39 | {% if product.stoq < product.stoq_min %}
40 |
41 | {% else %}
42 |
43 | {% endif %}
44 | |
45 | {% if product.imported %}
46 |
47 | {% else %}
48 |
49 | {% endif %}
50 | |
51 | {{ product.ncm }} |
52 | {{ product.product }} |
53 | {{ product.brand }} |
54 | {{ product.get_cost }} |
55 |
56 | {% if product.get_ipi == "0" %}
57 | --- |
58 | {% else %}
59 | {{ product.get_ipi }}% |
60 | {% endif %}
61 |
62 | {{ product.stock }} |
63 | {{ product.stock_min }} |
64 |
65 | {% empty %}
66 | Sem itens na lista.
67 | {% endfor %}
68 |
69 |
70 | {% else %}
71 |
Sem itens na lista.
72 | {% endif %}
73 |
74 |
75 |
76 |
77 |
Total: {{ count }}
78 | {% if count <= 1 %}
79 | {{ name }}
80 | {% else %}
81 | {{ name_plural }}
82 | {% endif %}
83 |
84 |
85 |
86 |
87 | {% include "pagination.html" %}
88 |
89 | {% endblock content %}
--------------------------------------------------------------------------------
/myproject/fixtures/fixtures/produtos1.csv:
--------------------------------------------------------------------------------
1 | abacates frescos ou secos
2 | abacaxis frescos ou secos
3 | abajures de cabeceira ou de escritorioetc.eletricos
4 | absorventes e outs.artigos higienicosde papel
5 | acessorios moldados p/tubos de aco
6 | acessorios para tubos de aluminio
7 | acetona nao contendo outs.funcoes oxigenadas
8 | acido citrico
9 | acido formico
10 | acucar de cana
11 | agua destilada
12 | agua mineral
13 | aguardente de vinho ou de bagaco de uvas
14 | agulhas para maqs.de costura
15 | aipo fresco
16 | alarmes contra incendio ou sobreaquecimento
17 | albuns ou livros
18 | alcaparras conservadas em agua salgada
19 | alcool benzilico
20 | alcool isopropilico
21 | aldeido alfa-amilcinamico
22 | alfaces repolhudasfrescas ou refrigeradas
23 | alfinetes de segurancade ferro ou aco
24 | algas frescas refrigeradas
25 | algodao cardado ou penteado
26 | algodao simplesmente debulhado
27 | alho comum em po sem qualquer outro preparo
28 | alicates de metais comuns
29 | alimentos para caes e gatos
30 | amido de milho
31 | armas de guerra
32 | aros e raios para bicicletas e outs.ciclos
33 | arroz nao parboilizado
34 | avelas
35 | azeite de oliva virgem
36 | azeitonas conserv.com agua salgada
37 | bacalhaus (gadidae) secos
38 | baunilha
39 | bolachas e biscoitos
40 | bolas inflaveis
41 | bombas de vacuo
42 | bordados de out.materia textilem peca/tiras ou motivos
43 | cafe nao torradonao descafeinadoem grao t
44 | calcados impermeav.de borracha/plast.cobrindo joelho
45 | calcinhas de malha de algodao
46 | camisasblusasetc.de seda/desperds.de uso feminino
47 | canela e flores de caneleiranao trituradas nem em po
48 | carbosulfan ((dibutilaminotio) metilcarbamato de 2etc.
49 | carnes de bovinodesossadasfrescas ou refrigeradas
50 | cartas de jogar
51 | caseinato de sodio
52 | cavalos reprodutoresde raca pura s
53 | cera artificial de polipropilenoglicois
54 | cha preto (fermentado/parcialm.) apresent.qq.out.forma
55 | citrato de orfenadrina
56 | colchas de malha
57 | corpetes calcinhas penhoares
58 | deidrocolato de sodio
59 | encerados e toldosde outs.materias texteis
60 | escovas de dentesincl.as escovas p/dentaduras
61 | esteiras "mats" de fibras de vidronao tecidos
62 | facas/laminas cort.de metais comunsp/apars.cozinhaetc
63 | feijao adzukisecopara semeadura
64 | files de peixessecossalgadosem salmouran/defumados
65 | fotorresistores montados
66 | gel de silica (dioxido de silicio)
67 | gorduras e oleosde mamiferos marinhosrespect.fracoes
68 | grumos e semolasde milho
69 | imitacoes de perolaspedras preciosas/semide vidro
70 | isoladores de ceramica p/uso eletrico
71 | lampadascubos e semelh.de luz relampago p/fotografia
72 | ligas de aluminio em forma bruta
73 | linho trabalhado de out.formamas nao fiado
74 | macadame de escorias de altos-fornosouts.escoriasetc.
75 | materiais para suturas cirurgicasde polidiexzanona
76 | morangos frescos
77 | oculos de sol
78 | omeprazol
79 | queijo tipo mussarelafresco (nao curado)
80 | relogio de bolsosemelh.cx.met.prec.etc.func.eletr.
81 | roupoesetc.de malha de fibra sint/artif.uso masculino
82 | selos postaisfiscaisetc.n/obliteradosc/curso legal
83 | soroalbumina preparado como medicamento
84 | tachaspregosetc.de cobre/ferro/acoc/cabeca de cobre
85 | teares p/tapetesl>30cms/lancadeirade pincas
86 | tecido de fios alta tenac.de nailonetc.c/fio borracha
87 | teobrominaseus derivados e sais
88 | titanato de chumbo
89 | trimetoprima
90 | tubos e perfis ocosde ferro fundido
91 | uvas frescas
92 | uvas secas
93 | vaselina
94 | vestuario e acess.calcadosetc.de amianto/das misturas
95 | vidro para relogios
96 | vitamina a1 alcool (retinol)
97 | vitamina b12 (cianocobalamina)nao misturada
98 | vitamina b2 (riboflavina)nao misturada
99 | vodca
100 | xampus para os cabelos
--------------------------------------------------------------------------------
/myproject/fixtures/fixtures/profissoes.csv:
--------------------------------------------------------------------------------
1 | id,occupation
2 | 1,acougueiro
3 | 2,acupunturista
4 | 3,advogado
5 | 4,almoxarife
6 | 5,analista financeiro
7 | 6,analista programador
8 | 7,analista programador .net
9 | 8,analista programador advpl
10 | 9,analista programador android
11 | 10,analista programador asp.net
12 | 11,analista programador c#
13 | 12,analista programador c++
14 | 13,analista programador cobol
15 | 14,analista programador delphi
16 | 15,analista programador java
17 | 16,analista programador mainframe
18 | 17,analista programador oracle
19 | 18,analista programador php
20 | 19,analista programador pl sql
21 | 20,analista programador progress
22 | 21,analista programador protheus
23 | 22,analista programador sharepoint
24 | 23,analista programador sql
25 | 24,analista programador vb6
26 | 25,analista programador web
27 | 26,analista programador websphere
28 | 27,arquiteto de informacao
29 | 28,arquiteto de interiores
30 | 29,arquiteto de sistemas
31 | 30,assistente administrativo
32 | 31,assistente comercial
33 | 32,assistente contabil
34 | 33,ator
35 | 34,azulejista
36 | 35,baba
37 | 36,back office
38 | 37,balconista
39 | 38,barista
40 | 39,barman
41 | 40,biologo
42 | 41,biomedico
43 | 42,bioquimico
44 | 43,bombeiro civil
45 | 44,cabeleireiro
46 | 45,caseiro
47 | 46,comprador
48 | 47,confeiteiro
49 | 48,contador
50 | 49,costureiro
51 | 50,cozinheiro
52 | 51,dba
53 | 52,dba oracle
54 | 53,dba sql
55 | 54,degustador
56 | 55,dentista
57 | 56,desenhista projetista
58 | 57,designer
59 | 58,eletricista
60 | 59,eletricista de veiculos
61 | 60,eletricista predial
62 | 61,encanador
63 | 62,encanador industrial
64 | 63,engenheiro ambiental
65 | 64,engenheiro civil
66 | 65,engenheiro de computacao
67 | 66,escriturario
68 | 67,fiscal de loja
69 | 68,fisico
70 | 69,fisioterapeuta
71 | 70,fonoaudiologo
72 | 71,fotografo
73 | 72,garcom
74 | 73,gastronomo
75 | 74,geografo
76 | 75,geologo
77 | 76,gerente administrativo
78 | 77,gerente comercial
79 | 78,guia de turismo
80 | 79,instalador
81 | 80,interprete de libras
82 | 81,jardineiro
83 | 82,jornalista
84 | 83,manobrista
85 | 84,marceneiro
86 | 85,matematico
87 | 86,mecanico
88 | 87,meio oficial carpinteiro
89 | 88,meio oficial de manutencao
90 | 89,mestre de obras
91 | 90,motoboy
92 | 91,motorista
93 | 92,nutricionista
94 | 93,office-boy
95 | 94,oficial de manutencao
96 | 95,orcamentista
97 | 96,padeiro
98 | 97,palestrante
99 | 98,pedreiro
100 | 99,pesquisador
101 | 100,pintor
102 | 101,pintor de moveis
103 | 102,pintor eletrostatico
104 | 103,pizzaiolo
105 | 104,podologo
106 | 105,professor
107 | 106,professor universitario
108 | 107,programador .net
109 | 108,programador abap
110 | 109,programador android
111 | 110,programador asp
112 | 111,programador asp.net
113 | 112,programador back-end
114 | 113,programador c#
115 | 114,programador c++
116 | 115,programador de banco de dados
117 | 116,programador de software
118 | 117,programador java
119 | 118,programador javascript
120 | 119,programador linux
121 | 120,programador php
122 | 121,programador python
123 | 122,programador ruby on rails
124 | 123,programador sap
125 | 124,programador soa
126 | 125,programador web
127 | 126,promotor de merchandising
128 | 127,promotor de vendas
129 | 128,psicologo
130 | 129,psicopedagogo
131 | 130,publicitario
132 | 131,quimico
133 | 132,reporter
134 | 133,repositor
135 | 134,salgadeiro
136 | 135,sapateiro
137 | 136,secretaria
138 | 137,secretaria executiva
139 | 138,seguranca
140 | 139,servente de obras
141 | 140,sindico
142 | 141,sociologo
143 | 142,soldador
144 | 143,supervisor de vendas
145 | 144,supervisor financeiro
146 | 145,suporte tecnico
147 | 146,sushiman
148 | 147,tecnico eletricista
149 | 148,tecnico eletroeletronico
150 | 149,tecnico em informatica
151 | 150,telefonista
152 | 151,telhadista
153 | 152,tesoureiro
154 | 153,tradutor
155 | 154,vendedor
156 | 155,vendedor de loja
157 | 156,vendedor externo
158 | 157,veterinario
159 | 158,vidraceiro
160 | 159,vigilante
161 | 160,web designer
162 | 161,web developer
163 | 162,webmaster
164 | 163,zelador
--------------------------------------------------------------------------------
/myproject/core/tests/test_views_person.py:
--------------------------------------------------------------------------------
1 | from django.test import TestCase
2 | from django.core.urlresolvers import reverse as r
3 |
4 |
5 | class PersonTest(TestCase):
6 |
7 | def setUp(self):
8 | self.resp = self.client.get(r('person_add'))
9 |
10 | def test_get(self):
11 | 'GET /person/add/ must return status code 200.'
12 | self.assertEqual(200, self.resp.status_code)
13 |
14 | def test_template(self):
15 | 'Response should be a rendered template.'
16 | self.assertTemplateUsed(
17 | self.resp, 'core/person/person_create_form.html')
18 |
19 | def test_html(self):
20 | 'Html must contain input controls.'
21 | self.assertContains(self.resp, '