Skip to content

Commit 86c7254

Browse files
Feat ORM START
1 parent f15218a commit 86c7254

File tree

439 files changed

+1216
-607
lines changed

Some content is hidden

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

439 files changed

+1216
-607
lines changed

Models/Models/asgi.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
ASGI config for Models project.
2+
ASGI config for ORM project.
33
44
It exposes the ASGI callable as a module-level variable named ``application``.
55
@@ -11,6 +11,6 @@
1111

1212
from django.core.asgi import get_asgi_application
1313

14-
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Models.settings')
14+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ORM.settings')
1515

1616
application = get_asgi_application()

Models/Models/settings.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Django settings for Models project.
2+
Django settings for ORM project.
33
44
Generated by 'django-admin startproject' using Django 3.1.3.
55
@@ -54,7 +54,7 @@
5454
'django.middleware.clickjacking.XFrameOptionsMiddleware',
5555
]
5656

57-
ROOT_URLCONF = 'Models.urls'
57+
ROOT_URLCONF = 'ORM.urls'
5858

5959
TEMPLATES = [
6060
{
@@ -72,7 +72,7 @@
7272
},
7373
]
7474

75-
WSGI_APPLICATION = 'Models.wsgi.application'
75+
WSGI_APPLICATION = 'ORM.wsgi.application'
7676

7777

7878
# Database

Models/Models/urls.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Models URL Configuration
1+
"""ORM URL Configuration
22
33
The `urlpatterns` list routes URLs to views. For more information please see:
44
https://docs.djangoproject.com/en/3.1/topics/http/urls/

Models/Models/wsgi.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
WSGI config for Models project.
2+
WSGI config for ORM project.
33
44
It exposes the WSGI callable as a module-level variable named ``application``.
55
@@ -11,6 +11,6 @@
1111

1212
from django.core.wsgi import get_wsgi_application
1313

14-
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Models.settings')
14+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ORM.settings')
1515

1616
application = get_wsgi_application()

Models/manage.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
def main():
88
"""Run administrative tasks."""
9-
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Models.settings')
9+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ORM.settings')
1010
try:
1111
from django.core.management import execute_from_command_line
1212
except ImportError as exc:

ORM/.idea/.gitignore

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ORM/.idea/Models.iml

+29
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ORM/.idea/inspectionProfiles/profiles_settings.xml

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

ORM/.idea/misc.xml

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

ORM/.idea/modules.xml

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ORM/.idea/vcs.xml

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

ORM/INFO

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* ORM

ORM/ORM/__init__.py

Whitespace-only changes.
149 Bytes
Binary file not shown.

ORM/ORM/__pycache__/db.cpython-38.pyc

498 Bytes
Binary file not shown.
2.19 KB
Binary file not shown.
922 Bytes
Binary file not shown.
544 Bytes
Binary file not shown.

ORM/ORM/asgi.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
ASGI config for ORM 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.1/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', 'ORM.settings')
15+
16+
application = get_asgi_application()

ORM/ORM/db.py

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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/sqlite/db.sqlite3'),
9+
}
10+
}
11+
12+
MARIADB = {
13+
'default': {
14+
'ENGINE': 'django.db.backends.mysql',
15+
'NAME': 'db',
16+
'USER': 'briandb',
17+
'PASSWORD': 'briandb',
18+
'HOST': '127.0.0.1',
19+
'PORT': 3307,
20+
}
21+
}

ORM/ORM/settings.py

+119
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
"""
2+
Django settings for ORM project.
3+
4+
Generated by 'django-admin startproject' using Django 3.1.3.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/3.1/topics/settings/
8+
9+
For the full list of settings and their values, see
10+
https://docs.djangoproject.com/en/3.1/ref/settings/
11+
"""
12+
13+
import os
14+
from pathlib import Path
15+
16+
import ORM.db as db
17+
18+
# Build paths inside the project like this: BASE_DIR / 'subdir'.
19+
BASE_DIR = Path(__file__).resolve().parent.parent
20+
21+
22+
# Quick-start development settings - unsuitable for production
23+
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
24+
25+
# SECURITY WARNING: keep the secret key used in production secret!
26+
SECRET_KEY = '(qcp^nnqrl0a7%5kyd-xx%b%f!2$fa*l^w(fdh_3g(c)1)4=(7'
27+
28+
# SECURITY WARNING: don't run with debug turned on in production!
29+
DEBUG = True
30+
31+
ALLOWED_HOSTS = []
32+
33+
34+
# Application definition
35+
36+
INSTALLED_APPS = [
37+
'django.contrib.admin',
38+
'django.contrib.auth',
39+
'django.contrib.contenttypes',
40+
'django.contrib.sessions',
41+
'django.contrib.messages',
42+
'django.contrib.staticfiles',
43+
# My App
44+
'core.erp',
45+
]
46+
47+
MIDDLEWARE = [
48+
'django.middleware.security.SecurityMiddleware',
49+
'django.contrib.sessions.middleware.SessionMiddleware',
50+
'django.middleware.common.CommonMiddleware',
51+
'django.middleware.csrf.CsrfViewMiddleware',
52+
'django.contrib.auth.middleware.AuthenticationMiddleware',
53+
'django.contrib.messages.middleware.MessageMiddleware',
54+
'django.middleware.clickjacking.XFrameOptionsMiddleware',
55+
]
56+
57+
ROOT_URLCONF = 'ORM.urls'
58+
59+
TEMPLATES = [
60+
{
61+
'BACKEND': 'django.template.backends.django.DjangoTemplates',
62+
'DIRS': [],
63+
'APP_DIRS': True,
64+
'OPTIONS': {
65+
'context_processors': [
66+
'django.template.context_processors.debug',
67+
'django.template.context_processors.request',
68+
'django.contrib.auth.context_processors.auth',
69+
'django.contrib.messages.context_processors.messages',
70+
],
71+
},
72+
},
73+
]
74+
75+
WSGI_APPLICATION = 'ORM.wsgi.application'
76+
77+
78+
# Database
79+
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
80+
81+
DATABASES = db.MARIADB
82+
83+
# Password validation
84+
# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
85+
86+
AUTH_PASSWORD_VALIDATORS = [
87+
{
88+
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
89+
},
90+
{
91+
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
92+
},
93+
{
94+
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
95+
},
96+
{
97+
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
98+
},
99+
]
100+
101+
102+
# Internationalization
103+
# https://docs.djangoproject.com/en/3.1/topics/i18n/
104+
105+
LANGUAGE_CODE = 'en-us'
106+
107+
TIME_ZONE = 'UTC'
108+
109+
USE_I18N = True
110+
111+
USE_L10N = True
112+
113+
USE_TZ = True
114+
115+
116+
# Static files (CSS, JavaScript, Images)
117+
# https://docs.djangoproject.com/en/3.1/howto/static-files/
118+
119+
STATIC_URL = '/static/'

ORM/ORM/urls.py

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
"""ORM URL Configuration
2+
3+
The `urlpatterns` list routes URLs to views. For more information please see:
4+
https://docs.djangoproject.com/en/3.1/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
18+
19+
urlpatterns = [
20+
path('admin/', admin.site.urls),
21+
]

ORM/ORM/wsgi.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
WSGI config for ORM 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.1/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', 'ORM.settings')
15+
16+
application = get_wsgi_application()

ORM/core/erp/__init__.py

Whitespace-only changes.
154 Bytes
Binary file not shown.
195 Bytes
Binary file not shown.
2.3 KB
Binary file not shown.

ORM/core/erp/admin.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.contrib import admin
2+
3+
# Register your models here.

ORM/core/erp/apps.py

+5
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'
+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Generated by Django 3.1.3 on 2020-11-17 16:41
2+
3+
import datetime
4+
from django.db import migrations, models
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
initial = True
10+
11+
dependencies = [
12+
]
13+
14+
operations = [
15+
migrations.CreateModel(
16+
name='Employee',
17+
fields=[
18+
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
19+
('names', models.CharField(max_length=150, verbose_name='Nombres')),
20+
('dni', models.CharField(max_length=10, unique=True, verbose_name='Dni')),
21+
('date_joined', models.DateField(default=datetime.datetime.now, verbose_name='Fecha de registro')),
22+
('date_creation', models.DateTimeField(auto_now=True)),
23+
('date_updated', models.DateTimeField(auto_now_add=True)),
24+
('age', models.PositiveIntegerField(default=0)),
25+
('salary', models.DecimalField(decimal_places=2, default=0.0, max_digits=9)),
26+
('state', models.BooleanField(default=True)),
27+
('avatar', models.ImageField(blank=True, null=True, upload_to='avatar/%Y/%m/%d')),
28+
('cvitae', models.FileField(blank=True, null=True, upload_to='cvitae/%Y/%m/%d')),
29+
],
30+
options={
31+
'verbose_name': 'Empleado',
32+
'verbose_name_plural': 'Empleados',
33+
'ordering': ['id'],
34+
},
35+
),
36+
]

0 commit comments

Comments
 (0)