Skip to content

Commit ac68aad

Browse files
authoredSep 18, 2023
primera-subida
0 parents  commit ac68aad

37 files changed

+634
-0
lines changed
 

‎proyecto_vehiculos_django/db.sqlite3

136 KB
Binary file not shown.

‎proyecto_vehiculos_django/manage.py

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env python
2+
"""Django's command-line utility for administrative tasks."""
3+
import os
4+
import sys
5+
6+
7+
def main():
8+
"""Run administrative tasks."""
9+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'proyecto_vehiculos_django.settings')
10+
try:
11+
from django.core.management import execute_from_command_line
12+
except ImportError as exc:
13+
raise ImportError(
14+
"Couldn't import Django. Are you sure it's installed and "
15+
"available on your PYTHONPATH environment variable? Did you "
16+
"forget to activate a virtual environment?"
17+
) from exc
18+
execute_from_command_line(sys.argv)
19+
20+
21+
if __name__ == '__main__':
22+
main()

‎proyecto_vehiculos_django/proyecto_vehiculos_django/__init__.py

Whitespace-only changes.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
ASGI config for proyecto_vehiculos_django 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/4.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', 'proyecto_vehiculos_django.settings')
15+
16+
application = get_asgi_application()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
"""
2+
Django settings for proyecto_vehiculos_django project.
3+
4+
Generated by 'django-admin startproject' using Django 4.0.5.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/4.0/topics/settings/
8+
9+
For the full list of settings and their values, see
10+
https://docs.djangoproject.com/en/4.0/ref/settings/
11+
"""
12+
13+
from pathlib import Path
14+
15+
# Build paths inside the project like this: BASE_DIR / 'subdir'.
16+
BASE_DIR = Path(__file__).resolve().parent.parent
17+
18+
19+
# Quick-start development settings - unsuitable for production
20+
# See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/
21+
22+
# SECURITY WARNING: keep the secret key used in production secret!
23+
SECRET_KEY = 'django-insecure-g0p@bqfa_=w*hb&o7!^&yc$-^$7bj_m33$br%#fo6w3x^k&2d&'
24+
25+
# SECURITY WARNING: don't run with debug turned on in production!
26+
DEBUG = True
27+
28+
ALLOWED_HOSTS = []
29+
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+
'vehiculo',
41+
]
42+
43+
44+
45+
MIDDLEWARE = [
46+
'django.middleware.security.SecurityMiddleware',
47+
'django.contrib.sessions.middleware.SessionMiddleware',
48+
'django.middleware.common.CommonMiddleware',
49+
'django.middleware.csrf.CsrfViewMiddleware',
50+
'django.contrib.auth.middleware.AuthenticationMiddleware',
51+
'django.contrib.messages.middleware.MessageMiddleware',
52+
'django.middleware.clickjacking.XFrameOptionsMiddleware',
53+
]
54+
55+
ROOT_URLCONF = 'proyecto_vehiculos_django.urls'
56+
57+
TEMPLATES = [
58+
{
59+
'BACKEND': 'django.template.backends.django.DjangoTemplates',
60+
'DIRS': [],
61+
'APP_DIRS': True,
62+
'OPTIONS': {
63+
'context_processors': [
64+
'django.template.context_processors.debug',
65+
'django.template.context_processors.request',
66+
'django.contrib.auth.context_processors.auth',
67+
'django.contrib.messages.context_processors.messages',
68+
],
69+
},
70+
},
71+
]
72+
73+
WSGI_APPLICATION = 'proyecto_vehiculos_django.wsgi.application'
74+
75+
76+
# Database
77+
# https://docs.djangoproject.com/en/4.0/ref/settings/#databases
78+
79+
DATABASES = {
80+
'default': {
81+
'ENGINE': 'django.db.backends.sqlite3',
82+
'NAME': BASE_DIR / 'db.sqlite3',
83+
}
84+
}
85+
86+
87+
# Password validation
88+
# https://docs.djangoproject.com/en/4.0/ref/settings/#auth-password-validators
89+
90+
AUTH_PASSWORD_VALIDATORS = [
91+
{
92+
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
93+
},
94+
{
95+
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
96+
},
97+
{
98+
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
99+
},
100+
{
101+
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
102+
},
103+
]
104+
105+
106+
# Internationalization
107+
# https://docs.djangoproject.com/en/4.0/topics/i18n/
108+
109+
LANGUAGE_CODE = 'en-us'
110+
111+
TIME_ZONE = 'UTC'
112+
113+
USE_I18N = True
114+
115+
USE_TZ = True
116+
117+
118+
# Static files (CSS, JavaScript, Images)
119+
# https://docs.djangoproject.com/en/4.0/howto/static-files/
120+
121+
STATIC_URL = 'static/'
122+
123+
# STATICFILES_DIRS = (os.path.join(BASE_DIR, 'proyecto_vehiculos_django/static'))
124+
125+
# Default primary key field type
126+
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field
127+
128+
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
129+
130+
LOGIN_REDIRECT_URL = '/'
131+
LOGOUT_REDIRECT_URL = '/'
132+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
"""proyecto_vehiculos_django URL Configuration
2+
3+
The `urlpatterns` list routes URLs to views. For more information please see:
4+
https://docs.djangoproject.com/en/4.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+
from vehiculo import views
19+
from vehiculo.views import firts_view
20+
21+
urlpatterns = [
22+
path('admin/', admin.site.urls),
23+
path('', firts_view, name='home'),
24+
path('vehiculo/', include('vehiculo.urls')),
25+
path('accounts/', include('django.contrib.auth.urls')),
26+
27+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
WSGI config for proyecto_vehiculos_django 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/4.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', 'proyecto_vehiculos_django.settings')
15+
16+
application = get_wsgi_application()

‎proyecto_vehiculos_django/vehiculo/__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.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from django.contrib import admin
2+
from .models import Vehiculo
3+
# Register your models here.
4+
5+
admin.site.register(Vehiculo)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from django.apps import AppConfig
2+
3+
4+
class VehiculoConfig(AppConfig):
5+
default_auto_field = 'django.db.models.BigAutoField'
6+
name = 'vehiculo'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Generated by Django 4.0.5 on 2023-07-11 01:56
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
initial = True
9+
10+
dependencies = [
11+
]
12+
13+
operations = [
14+
migrations.CreateModel(
15+
name='Vehiculo',
16+
fields=[
17+
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
18+
('marca', models.CharField(default='Ford', max_length=20)),
19+
('modelo', models.CharField(max_length=100)),
20+
('serial_carroceria', models.CharField(max_length=50)),
21+
('serial_motor', models.CharField(max_length=50)),
22+
('categoria', models.CharField(default='Particular', max_length=20)),
23+
('precio', models.IntegerField()),
24+
('fecha_creacion', models.DateField()),
25+
('fecha_modificacion', models.DateField()),
26+
],
27+
),
28+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Generated by Django 4.0.5 on 2023-07-12 21:10
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('vehiculo', '0001_initial'),
10+
]
11+
12+
operations = [
13+
migrations.AlterField(
14+
model_name='vehiculo',
15+
name='categoria',
16+
field=models.CharField(choices=[('particular', 'Particular'), ('transporte', 'Transporte'), ('carga', 'Carga')], default='particular', max_length=20),
17+
),
18+
migrations.AlterField(
19+
model_name='vehiculo',
20+
name='fecha_creacion',
21+
field=models.DateField(auto_now_add=True),
22+
),
23+
migrations.AlterField(
24+
model_name='vehiculo',
25+
name='fecha_modificacion',
26+
field=models.DateField(auto_now=True),
27+
),
28+
migrations.AlterField(
29+
model_name='vehiculo',
30+
name='marca',
31+
field=models.CharField(choices=[('fiat', 'Fiat'), ('chevrolet', 'Chevrolet'), ('toyota', 'Toyota'), ('ford', 'Ford')], default='ford', max_length=20),
32+
),
33+
]

‎proyecto_vehiculos_django/vehiculo/migrations/__init__.py

Whitespace-only changes.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
from django.db import models
2+
3+
# Create your models here.
4+
CATEGORIAS = [
5+
('fiat', 'Fiat'),
6+
('chevrolet', 'Chevrolet'),
7+
('toyota', 'Toyota'),
8+
('ford', 'Ford'),
9+
]
10+
CATEGORIAS2 = [
11+
('particular', 'Particular'),
12+
('transporte', 'Transporte'),
13+
('carga', 'Carga'),
14+
]
15+
class Vehiculo(models.Model):
16+
17+
marca = models.CharField(max_length=20, choices=CATEGORIAS, default='ford')
18+
modelo = models.CharField(max_length=100)
19+
serial_carroceria = models.CharField(max_length=50)
20+
serial_motor = models.CharField(max_length=50)
21+
categoria = models.CharField(max_length=20, choices=CATEGORIAS2, default='particular')
22+
precio = models.IntegerField()
23+
fecha_creacion = models.DateField(auto_now_add=True)
24+
fecha_modificacion = models.DateField(auto_now=True)
25+
26+
def __str__(self) -> str:
27+
return f'{self.marca} {self.modelo} {self.serial_carroceria} {self.serial_motor} {self.categoria} {self.precio} {self.fecha_creacion} {self.fecha_modificacion}'
28+
29+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>{% block title%} {% endblock %}</title>
8+
<!-- cdn bootstrap -->
9+
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet"
10+
integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous">
11+
<!-- link css-->
12+
<link rel="stylesheet" href="">
13+
14+
</head>
15+
16+
<body>
17+
18+
{% include 'navbar.html' %}
19+
20+
21+
{% block content %}
22+
{% endblock %}
23+
</body>
24+
25+
</html>

0 commit comments

Comments
 (0)
Please sign in to comment.