Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
D4Fi committed Sep 20, 2023
1 parent 726258d commit 2d46b43
Show file tree
Hide file tree
Showing 37 changed files with 353 additions and 0 deletions.
Empty file added DJANGO/2.6/appconfg/__init__.py
Empty file.
Binary file not shown.
Binary file not shown.
Binary file added DJANGO/2.6/appconfg/__pycache__/urls.cpython-311.pyc
Binary file not shown.
Binary file added DJANGO/2.6/appconfg/__pycache__/wsgi.cpython-311.pyc
Binary file not shown.
16 changes: 16 additions & 0 deletions DJANGO/2.6/appconfg/asgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
ASGI config for appconfg project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/
"""

import os

from django.core.asgi import get_asgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'appconfg.settings')

application = get_asgi_application()
127 changes: 127 additions & 0 deletions DJANGO/2.6/appconfg/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
"""
Django settings for appconfg project.
Generated by 'django-admin startproject' using Django 4.2.5.
For more information on this file, see
https://docs.djangoproject.com/en/4.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.2/ref/settings/
"""

from pathlib import Path
import os

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-c%5uqf&7l2msj%emo#@ij_)1xn%kw*iqfa%06x$4$4^4!r0jxd'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []


# Application definition

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'core',
]

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'appconfg.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]

WSGI_APPLICATION = 'appconfg.wsgi.application'


# Database
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}


# Password validation
# https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]


# Internationalization
# https://docs.djangoproject.com/en/4.2/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.2/howto/static-files/

STATIC_URL = 'static/'
MEDIA_URL = 'dados/'
MEDIA_ROOT = os.path.join(BASE_DIR,'dados')

# Default primary key field type
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
7 changes: 7 additions & 0 deletions DJANGO/2.6/appconfg/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from django.contrib import admin
from django.urls import path, include

urlpatterns = [
path('admin/', admin.site.urls),
path('', include('core.urls')),
]
16 changes: 16 additions & 0 deletions DJANGO/2.6/appconfg/wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
WSGI config for appconfg project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'appconfg.settings')

application = get_wsgi_application()
Empty file added DJANGO/2.6/core/__init__.py
Empty file.
Binary file added DJANGO/2.6/core/__pycache__/__init__.cpython-311.pyc
Binary file not shown.
Binary file added DJANGO/2.6/core/__pycache__/admin.cpython-311.pyc
Binary file not shown.
Binary file added DJANGO/2.6/core/__pycache__/apps.cpython-311.pyc
Binary file not shown.
Binary file added DJANGO/2.6/core/__pycache__/forms.cpython-311.pyc
Binary file not shown.
Binary file added DJANGO/2.6/core/__pycache__/models.cpython-311.pyc
Binary file not shown.
Binary file added DJANGO/2.6/core/__pycache__/urls.cpython-311.pyc
Binary file not shown.
Binary file added DJANGO/2.6/core/__pycache__/views.cpython-311.pyc
Binary file not shown.
6 changes: 6 additions & 0 deletions DJANGO/2.6/core/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.contrib import admin
from . import models

@admin.register(models.ModelsProduto)
class Adminproduto(admin.ModelAdmin):
pass
6 changes: 6 additions & 0 deletions DJANGO/2.6/core/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class CoreConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'core'
7 changes: 7 additions & 0 deletions DJANGO/2.6/core/forms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from django import forms

class FormsProduto(forms.ModelForm):
nome = forms.CharField(max_length=30)
valor = forms.DecimalField(max_digits=2, decimal_places=2)
estoque = forms.IntegerField()
img_produto = forms.ImageField()
24 changes: 24 additions & 0 deletions DJANGO/2.6/core/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated by Django 4.2.5 on 2023-09-20 16:24

from django.db import migrations, models


class Migration(migrations.Migration):

initial = True

dependencies = [
]

operations = [
migrations.CreateModel(
name='ModelsProduto',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('nome', models.CharField(max_length=30)),
('valor', models.DecimalField(decimal_places=2, max_digits=2)),
('estoque', models.IntegerField()),
('img_produto', models.ImageField(upload_to='')),
],
),
]
Empty file.
Binary file not shown.
Binary file not shown.
10 changes: 10 additions & 0 deletions DJANGO/2.6/core/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from django.db import models

class ModelsProduto(models.Model):
nome = models.CharField(max_length=30)
valor = models.DecimalField(max_digits=10, decimal_places=2)
estoque = models.IntegerField()
img_produto = models.ImageField(upload_to='dados')

def __str__(self):
return f'{self.nome}'
34 changes: 34 additions & 0 deletions DJANGO/2.6/core/static/core/css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
body {
}

/* OPEN MENU-PRODUTOS */
.menu-produtos {
width: 1000px;
display: flex;
justify-content: flex-start;
flex-wrap: wrap;
margin: 0 auto;
justify-content: center;
background-color: gray;
}
/* CLOSE MENU-PROTUDOS */

/* OPEN CARD */
.card {
width: 250px;
height: 400px;
margin: 20px;
background-color: #c9c9c9;
}

.card-logo {
width: 150px;
height: 150px;
margin: 0 auto;
}

.card-logo img {
width: 100%;
height: 100%;
}
/* CLOSE CARD */
5 changes: 5 additions & 0 deletions DJANGO/2.6/core/templates/core/pages/add.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{% extends 'core/partials/base.html' %}

{% block 'base' %}
<h1>add</h1>
{% endblock %}
5 changes: 5 additions & 0 deletions DJANGO/2.6/core/templates/core/pages/edit.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{% extends 'core/partials/base.html' %}

{% block 'base' %}
<h1>edit</h1>
{% endblock %}
27 changes: 27 additions & 0 deletions DJANGO/2.6/core/templates/core/pages/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{% extends 'core/partials/base.html' %}
{% block 'base' %}

<section class="menu-produtos">
{% for i in dados %}
<div class="card">
<div class="card-logo">
<img src="{{ i.img_produto.url }}" alt="">
</div>
<div>
<h1>Nome: {{ i.nome }}</h1>
<h1>Valor: {{ i.valor }}</h1>
<h1>Estoque:{{ i.estoque }}</h1>
</div>
<div>
<a>
<button height="100px">More...</button>
</a>
<a>
<button>Delet</button>
</a>
</div>
</div>
{% endfor %}
</section>

{% endblock %}
16 changes: 16 additions & 0 deletions DJANGO/2.6/core/templates/core/partials/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>HTML 5 Boilerplate</title>
<link rel="stylesheet" href="{% static 'core/css/style.css' %}">
</head>
<body>
{% block 'base' %}
<h1>NADA AQUI</h1>
{% endblock %}
</body>
</html>
3 changes: 3 additions & 0 deletions DJANGO/2.6/core/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.test import TestCase

# Create your tests here.
9 changes: 9 additions & 0 deletions DJANGO/2.6/core/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from django.urls import path
from . import views
from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [
path('', views.IndexView.as_view())
]
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
13 changes: 13 additions & 0 deletions DJANGO/2.6/core/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from django.shortcuts import render
from django.views.generic import TemplateView
from . import models
from . import forms

# Create your views here.
class IndexView(TemplateView):
template_name = 'core/pages/index.html'

def get_context_data(self, **kwargs):
context = super(IndexView, self).get_context_data(**kwargs)
context['dados'] = models.ModelsProduto.objects.all()
return context
Binary file added DJANGO/2.6/dados/dados/ps2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added DJANGO/2.6/dados/dados/ps3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added DJANGO/2.6/db.sqlite3
Binary file not shown.
22 changes: 22 additions & 0 deletions DJANGO/2.6/manage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys


def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'appconfg.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)


if __name__ == '__main__':
main()

0 comments on commit 2d46b43

Please sign in to comment.