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 24, 2023
1 parent a3c2bad commit 0314672
Show file tree
Hide file tree
Showing 30 changed files with 255 additions and 35 deletions.
Empty file added DJANGO/2.6/confapp/__init__.py
Empty file.
Binary file not shown.
Binary file not shown.
Binary file added DJANGO/2.6/confapp/__pycache__/urls.cpython-311.pyc
Binary file not shown.
Binary file added DJANGO/2.6/confapp/__pycache__/wsgi.cpython-311.pyc
Binary file not shown.
16 changes: 16 additions & 0 deletions DJANGO/2.6/confapp/asgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
ASGI config for confapp 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', 'confapp.settings')

application = get_asgi_application()
127 changes: 127 additions & 0 deletions DJANGO/2.6/confapp/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
"""
Django settings for confapp 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

# 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-q3ct$6qlo(!jqrrbd6)6c6p1qm=&sw101*meb))+g!7kk#6qdr'

# 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 = 'confapp.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 = 'confapp.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 = 'images/'
MEDIA_ROOT = 'images/'


# 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/confapp/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 include, path

urlpatterns = [
path('admin/', admin.site.urls),
path('', include('core.urls')),
]
16 changes: 16 additions & 0 deletions DJANGO/2.6/confapp/wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
WSGI config for confapp 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', 'confapp.settings')

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

@admin.register(models.ModelsProduto)
class Adminproduto(admin.ModelAdmin):
@admin.register(models.ModelAnime)
class AdminAnime(admin.ModelAdmin):
pass
10 changes: 4 additions & 6 deletions DJANGO/2.6/core/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 4.2.5 on 2023-09-20 16:24
# Generated by Django 4.2.5 on 2023-09-24 21:04

from django.db import migrations, models

Expand All @@ -12,13 +12,11 @@ class Migration(migrations.Migration):

operations = [
migrations.CreateModel(
name='ModelsProduto',
name='ModelAnime',
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='')),
('nome', models.CharField(max_length=20)),
('img_anime', models.ImageField(upload_to='')),
],
),
]
Binary file not shown.
Binary file modified DJANGO/2.6/core/migrations/__pycache__/__init__.cpython-311.pyc
Binary file not shown.
11 changes: 3 additions & 8 deletions DJANGO/2.6/core/models.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
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}'
class ModelAnime(models.Model):
nome = models.CharField(max_length=20)
img_anime = models.ImageField()
21 changes: 21 additions & 0 deletions DJANGO/2.6/core/static/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
body{
background-color: gray;
}

.container{
width: 1000px;
margin: 0 auto;
border: 1px solid red;
}
.titulo{
width: 100%;
margin: 0 auto;
display: flex;
justify-content: center;
border: 1px solid blue;
}
.box-products{
width: 100%;
margin: 0 auto;
border: 1px solid cyan;
}
26 changes: 26 additions & 0 deletions DJANGO/2.6/core/templates/core/page/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{% extends 'core/partials/base.html' %}





{% block 'tabela' %}

<table>
<thead>
<tr>
<th>Nome</th>
<th>Foto</th>
</tr>
</thead>
{% for user in dados %}
<tbody>
<tr>
<th><h3>{{ user.nome }}</h3></th>
<th><img src="{{ user.img_anime.url }}" alt=""></th>
</tr>
</tbody>
{% endfor %}
</table>
{% endblock%}

26 changes: 21 additions & 5 deletions DJANGO/2.6/core/templates/core/partials/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,28 @@
<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' %}">
<title></title>
<link rel="stylesheet" href=" {% static 'style.css' %}">
</head>
<body>
{% block 'base' %}
<h1>NADA AQUI</h1>
{% endblock %}

<section class="container">
<div class="base-box">

<div class="titulo">
{% block 'titulo' %}
<h1>titulo</h1>
{% endblock %}
</div>

<div class="box-products">
{% block 'tabela' %}
<h1>produtos</h1>
{% endblock %}
</div>

</div>
</section>

</body>
</html>
6 changes: 3 additions & 3 deletions DJANGO/2.6/core/urls.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from django.urls import path
from . import views
from django.conf import settings
from django.conf.urls.static import static
from . import views

urlpatterns = [
path('', views.IndexView.as_view())
urlpatterns= [
path('', views.index)
]
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
18 changes: 8 additions & 10 deletions DJANGO/2.6/core/views.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
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
def index(request):
return render(
request,
'core/page/index.html',
context={
'dados': models.ModelAnime.objects.all(),
}
)
Binary file modified DJANGO/2.6/db.sqlite3
Binary file not shown.
Binary file added DJANGO/2.6/images/goku.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/images/goku_LeFXcR7.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/images/goku_WctOB4K.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion DJANGO/2.6/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'appconfg.settings')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'confapp.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
Expand Down

0 comments on commit 0314672

Please sign in to comment.