Skip to content

Commit 35bca7f

Browse files
feat ListView vistas basadas en clases
Listview vistas basadas en clases START resolves: # see also:#
1 parent 5dc778c commit 35bca7f

File tree

195 files changed

+153579
-6
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

195 files changed

+153579
-6
lines changed

Creando_nuestro_primer_listado_en_django/.idea/workspace.xml

+4-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.
Binary file not shown.

ListView_vistas_basadas_en_clases/config/__init__.py

Whitespace-only changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
ASGI config for config project.
3+
4+
It exposes the ASGI callable as a module-level variable named ``application``.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/
8+
"""
9+
10+
import os
11+
12+
from django.core.asgi import get_asgi_application
13+
14+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings')
15+
16+
application = get_asgi_application()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import os
2+
3+
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
4+
5+
SQLITE = {
6+
'default': {
7+
'ENGINE': 'django.db.backends.sqlite3',
8+
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
9+
}
10+
}
11+
12+
POSTGRESQL = {
13+
'default': {
14+
'ENGINE': 'django.db.backends.postgresql_psycopg2',
15+
'NAME': 'db',
16+
'USER': 'postgres',
17+
'PASSWORD': '123',
18+
'HOST': 'localhost',
19+
'PORT': '5432'
20+
}
21+
}
22+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
"""
2+
Django settings for config project.
3+
4+
Generated by 'django-admin startproject' using Django 3.0.4.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/3.0/topics/settings/
8+
9+
For the full list of settings and their values, see
10+
https://docs.djangoproject.com/en/3.0/ref/settings/
11+
"""
12+
13+
import os
14+
15+
import config.db as db
16+
17+
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
18+
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
19+
20+
# Quick-start development settings - unsuitable for production
21+
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/
22+
23+
# SECURITY WARNING: keep the secret key used in production secret!
24+
SECRET_KEY = 'fd&a%**+le-74cq&mrlh^a0yp95!n5vf-q5u3+5f*9=6at1c2^'
25+
26+
# SECURITY WARNING: don't run with debug turned on in production!
27+
DEBUG = True
28+
29+
ALLOWED_HOSTS = []
30+
31+
# Application definition
32+
33+
INSTALLED_APPS = [
34+
'django.contrib.admin',
35+
'django.contrib.auth',
36+
'django.contrib.contenttypes',
37+
'django.contrib.sessions',
38+
'django.contrib.messages',
39+
'django.contrib.staticfiles',
40+
# Apps
41+
'core.erp'
42+
]
43+
44+
MIDDLEWARE = [
45+
'django.middleware.security.SecurityMiddleware',
46+
'django.contrib.sessions.middleware.SessionMiddleware',
47+
'django.middleware.common.CommonMiddleware',
48+
'django.middleware.csrf.CsrfViewMiddleware',
49+
'django.contrib.auth.middleware.AuthenticationMiddleware',
50+
'django.contrib.messages.middleware.MessageMiddleware',
51+
'django.middleware.clickjacking.XFrameOptionsMiddleware',
52+
]
53+
54+
ROOT_URLCONF = 'config.urls'
55+
56+
TEMPLATES = [
57+
{
58+
'BACKEND': 'django.template.backends.django.DjangoTemplates',
59+
'DIRS': [os.path.join(BASE_DIR, 'templates')],
60+
'APP_DIRS': True,
61+
'OPTIONS': {
62+
'context_processors': [
63+
'django.template.context_processors.debug',
64+
'django.template.context_processors.request',
65+
'django.contrib.auth.context_processors.auth',
66+
'django.contrib.messages.context_processors.messages',
67+
],
68+
},
69+
},
70+
]
71+
72+
WSGI_APPLICATION = 'config.wsgi.application'
73+
74+
# Database
75+
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
76+
77+
DATABASES = db.POSTGRESQL
78+
79+
# Password validation
80+
# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators
81+
82+
AUTH_PASSWORD_VALIDATORS = [
83+
{
84+
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
85+
},
86+
{
87+
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
88+
},
89+
{
90+
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
91+
},
92+
{
93+
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
94+
},
95+
]
96+
97+
# Internationalization
98+
# https://docs.djangoproject.com/en/3.0/topics/i18n/
99+
100+
LANGUAGE_CODE = 'en-us'
101+
102+
TIME_ZONE = 'UTC'
103+
104+
USE_I18N = True
105+
106+
USE_L10N = True
107+
108+
USE_TZ = True
109+
110+
# Static files (CSS, JavaScript, Images)
111+
# https://docs.djangoproject.com/en/3.0/howto/static-files/
112+
113+
STATIC_URL = '/static/'
114+
115+
STATICFILES_DIRS = [
116+
os.path.join(BASE_DIR, "static"),
117+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
"""app URL Configuration
2+
3+
The `urlpatterns` list routes URLs to views. For more information please see:
4+
https://docs.djangoproject.com/en/3.0/topics/http/urls/
5+
Examples:
6+
Function views
7+
1. Add an import: from my_app import views
8+
2. Add a URL to urlpatterns: path('', views.home, name='home')
9+
Class-based views
10+
1. Add an import: from other_app.views import Home
11+
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
12+
Including another URLconf
13+
1. Import the include() function: from django.urls import include, path
14+
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
15+
"""
16+
from django.contrib import admin
17+
from django.urls import path, include
18+
19+
urlpatterns = [
20+
path('admin/', admin.site.urls),
21+
path('erp/', include('core.erp.urls'))
22+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
WSGI config for config project.
3+
4+
It exposes the WSGI callable as a module-level variable named ``application``.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/
8+
"""
9+
10+
import os
11+
12+
from django.core.wsgi import get_wsgi_application
13+
14+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings')
15+
16+
application = get_wsgi_application()

ListView_vistas_basadas_en_clases/core/erp/__init__.py

Whitespace-only changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from django.contrib import admin
2+
from core.erp.models import *
3+
4+
# Register your models here.
5+
admin.site.register(Category)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from django.apps import AppConfig
2+
3+
4+
class ErpConfig(AppConfig):
5+
name = 'erp'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
gender_choices = (
2+
('male','Masculino'),
3+
('female','Femenino'),
4+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Generated by Django 3.0.4 on 2020-04-02 18:49
2+
3+
import datetime
4+
from django.db import migrations, models
5+
import django.db.models.deletion
6+
7+
8+
class Migration(migrations.Migration):
9+
10+
initial = True
11+
12+
dependencies = [
13+
]
14+
15+
operations = [
16+
migrations.CreateModel(
17+
name='Category',
18+
fields=[
19+
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
20+
('name', models.CharField(max_length=150, unique=True, verbose_name='Nombre')),
21+
],
22+
options={
23+
'verbose_name': 'Categoria',
24+
'verbose_name_plural': 'Categorias',
25+
'ordering': ['id'],
26+
},
27+
),
28+
migrations.CreateModel(
29+
name='Client',
30+
fields=[
31+
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
32+
('names', models.CharField(max_length=150, verbose_name='Nombres')),
33+
('surnames', models.CharField(max_length=150, verbose_name='Apellidos')),
34+
('dni', models.CharField(max_length=10, unique=True, verbose_name='Dni')),
35+
('birthday', models.DateField(default=datetime.datetime.now, verbose_name='Fecha de nacimiento')),
36+
('address', models.CharField(blank=True, max_length=150, null=True, verbose_name='Dirección')),
37+
('sexo', models.CharField(choices=[('male', 'Masculino'), ('female', 'Femenino')], default='male', max_length=10, verbose_name='Sexo')),
38+
],
39+
options={
40+
'verbose_name': 'Cliente',
41+
'verbose_name_plural': 'Clientes',
42+
'ordering': ['id'],
43+
},
44+
),
45+
migrations.CreateModel(
46+
name='Sale',
47+
fields=[
48+
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
49+
('date_joined', models.DateField(default=datetime.datetime.now)),
50+
('subtotal', models.DecimalField(decimal_places=2, default=0.0, max_digits=9)),
51+
('iva', models.DecimalField(decimal_places=2, default=0.0, max_digits=9)),
52+
('total', models.DecimalField(decimal_places=2, default=0.0, max_digits=9)),
53+
('cli', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='erp.Client')),
54+
],
55+
options={
56+
'verbose_name': 'Venta',
57+
'verbose_name_plural': 'Ventas',
58+
'ordering': ['id'],
59+
},
60+
),
61+
migrations.CreateModel(
62+
name='Product',
63+
fields=[
64+
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
65+
('name', models.CharField(max_length=150, unique=True, verbose_name='Nombre')),
66+
('image', models.ImageField(blank=True, null=True, upload_to='product/%Y/%m/%d')),
67+
('pvp', models.DecimalField(decimal_places=2, default=0.0, max_digits=9)),
68+
('cate', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='erp.Category')),
69+
],
70+
options={
71+
'verbose_name': 'Producto',
72+
'verbose_name_plural': 'Productos',
73+
'ordering': ['id'],
74+
},
75+
),
76+
migrations.CreateModel(
77+
name='DetSale',
78+
fields=[
79+
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
80+
('price', models.DecimalField(decimal_places=2, default=0.0, max_digits=9)),
81+
('cant', models.IntegerField(default=0)),
82+
('subtotal', models.DecimalField(decimal_places=2, default=0.0, max_digits=9)),
83+
('prod', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='erp.Product')),
84+
('sale', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='erp.Sale')),
85+
],
86+
options={
87+
'verbose_name': 'Detalle de Venta',
88+
'verbose_name_plural': 'Detalle de Ventas',
89+
'ordering': ['id'],
90+
},
91+
),
92+
]

ListView_vistas_basadas_en_clases/core/erp/migrations/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)