diff --git a/biblioteca/__init__.py b/biblioteca/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/biblioteca/settings.py b/biblioteca/settings.py new file mode 100644 index 0000000..0569ed3 --- /dev/null +++ b/biblioteca/settings.py @@ -0,0 +1,121 @@ +""" +Django settings for biblioteca project. + +Generated by 'django-admin startproject' using Django 2.0.4. + +For more information on this file, see +https://docs.djangoproject.com/en/2.0/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/2.0/ref/settings/ +""" + +import os + +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'a#ectq**sn3^c3r5%lir^16&)aq6kzn5x#j!l&tg6y1y1b1m%y' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = [] + + +# Application definition + +INSTALLED_APPS = [ + 'controle', + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', +] + +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 = 'biblioteca.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 = 'biblioteca.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/2.0/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + } +} + + +# Password validation +# https://docs.djangoproject.com/en/2.0/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/2.0/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_L10N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/2.0/howto/static-files/ + +STATIC_URL = '/static/' diff --git a/biblioteca/urls.py b/biblioteca/urls.py new file mode 100644 index 0000000..25cac9f --- /dev/null +++ b/biblioteca/urls.py @@ -0,0 +1,22 @@ +"""biblioteca URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/2.0/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: path('', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') +Including another URLconf + 1. Import the include() function: from django.urls import include, path + 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) +""" +from django.contrib import admin +from django.urls import path, include + +urlpatterns = [ + path('admin/', admin.site.urls), + path('', include('controle.urls')), +] diff --git a/biblioteca/wsgi.py b/biblioteca/wsgi.py new file mode 100644 index 0000000..10efa7b --- /dev/null +++ b/biblioteca/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for biblioteca 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/2.0/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "biblioteca.settings") + +application = get_wsgi_application() diff --git a/controle/__init__.py b/controle/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/controle/admin.py b/controle/admin.py new file mode 100644 index 0000000..add53bb --- /dev/null +++ b/controle/admin.py @@ -0,0 +1,7 @@ +from django.contrib import admin +from .models import * + +admin.site.register(Cliente) +admin.site.register(Funcionario) +admin.site.register(Livros) +admin.site.register(Processo) diff --git a/controle/apps.py b/controle/apps.py new file mode 100644 index 0000000..82ccc3c --- /dev/null +++ b/controle/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class ControleConfig(AppConfig): + name = 'controle' diff --git a/controle/forms.py b/controle/forms.py new file mode 100644 index 0000000..222e74a --- /dev/null +++ b/controle/forms.py @@ -0,0 +1,30 @@ +from django import forms +from .models import Cliente +from .models import Funcionario +from .models import Livros +from .models import Processo + + +class ClienteForm(forms.ModelForm): + class Meta: + model=Cliente + fields="__all__" + + +class FuncionarioForm(forms.ModelForm): + class Meta: + model=Funcionario + fields="__all__" + +class LivrosForm(forms.ModelForm): + class Meta: + model=Livros + fields="__all__" + +class ProcessoForm(forms.ModelForm): + class Meta: + model=Processo + fields="__all__" + +class BuscaForm(forms.Form): + nome = forms.CharField(max_length=255) diff --git a/controle/migrations/0001_initial.py b/controle/migrations/0001_initial.py new file mode 100644 index 0000000..a4af911 --- /dev/null +++ b/controle/migrations/0001_initial.py @@ -0,0 +1,44 @@ +# Generated by Django 2.0.4 on 2018-05-23 00:09 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Cliente', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('nome_text', models.CharField(max_length=255)), + ('CPF_cliente', models.IntegerField(default=0)), + ('Tel_cliente', models.IntegerField(default=0)), + ], + ), + migrations.CreateModel( + name='Funcionario', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('id_funcionario', models.IntegerField(default=0)), + ('nome_text', models.CharField(max_length=255)), + ('CPF_cliente', models.IntegerField(default=0)), + ('Tel_cliente', models.IntegerField(default=0)), + ('Cargo_Func', models.CharField(max_length=200)), + ], + ), + migrations.CreateModel( + name='Livros', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('id_livro', models.IntegerField(default=0)), + ('nome_livro', models.CharField(max_length=255)), + ('descricao_livro', models.CharField(max_length=200)), + ('quantidade_paginas', models.IntegerField(default=0)), + ], + ), + ] diff --git a/controle/migrations/0002_auto_20180605_2228.py b/controle/migrations/0002_auto_20180605_2228.py new file mode 100644 index 0000000..9d008dc --- /dev/null +++ b/controle/migrations/0002_auto_20180605_2228.py @@ -0,0 +1,56 @@ +# Generated by Django 2.0.4 on 2018-06-05 22:28 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('controle', '0001_initial'), + ] + + operations = [ + migrations.RenameField( + model_name='cliente', + old_name='nome_text', + new_name='nome_Cliente', + ), + migrations.RenameField( + model_name='funcionario', + old_name='nome_text', + new_name='nome_Funcionario', + ), + migrations.RemoveField( + model_name='funcionario', + name='id_funcionario', + ), + migrations.RemoveField( + model_name='livros', + name='id_livro', + ), + migrations.AlterField( + model_name='cliente', + name='CPF_cliente', + field=models.CharField(max_length=255), + ), + migrations.AlterField( + model_name='cliente', + name='Tel_cliente', + field=models.CharField(max_length=255), + ), + migrations.AlterField( + model_name='funcionario', + name='CPF_cliente', + field=models.CharField(max_length=255), + ), + migrations.AlterField( + model_name='funcionario', + name='Tel_cliente', + field=models.CharField(max_length=255), + ), + migrations.AlterField( + model_name='livros', + name='quantidade_paginas', + field=models.CharField(max_length=255), + ), + ] diff --git a/controle/migrations/0003_auto_20180605_2344.py b/controle/migrations/0003_auto_20180605_2344.py new file mode 100644 index 0000000..874399f --- /dev/null +++ b/controle/migrations/0003_auto_20180605_2344.py @@ -0,0 +1,63 @@ +# Generated by Django 2.0.4 on 2018-06-05 23:44 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('controle', '0002_auto_20180605_2228'), + ] + + operations = [ + migrations.RenameField( + model_name='cliente', + old_name='CPF_cliente', + new_name='cpf', + ), + migrations.RenameField( + model_name='cliente', + old_name='Tel_cliente', + new_name='nome', + ), + migrations.RenameField( + model_name='cliente', + old_name='nome_Cliente', + new_name='telefone', + ), + migrations.RenameField( + model_name='funcionario', + old_name='Cargo_Func', + new_name='Cargo', + ), + migrations.RenameField( + model_name='funcionario', + old_name='CPF_cliente', + new_name='Telefone', + ), + migrations.RenameField( + model_name='funcionario', + old_name='Tel_cliente', + new_name='cpf', + ), + migrations.RenameField( + model_name='funcionario', + old_name='nome_Funcionario', + new_name='nome', + ), + migrations.RenameField( + model_name='livros', + old_name='descricao_livro', + new_name='descricao', + ), + migrations.RenameField( + model_name='livros', + old_name='nome_livro', + new_name='nome', + ), + migrations.RenameField( + model_name='livros', + old_name='quantidade_paginas', + new_name='quantidade', + ), + ] diff --git a/controle/migrations/0004_auto_20180605_2345.py b/controle/migrations/0004_auto_20180605_2345.py new file mode 100644 index 0000000..36caa76 --- /dev/null +++ b/controle/migrations/0004_auto_20180605_2345.py @@ -0,0 +1,23 @@ +# Generated by Django 2.0.4 on 2018-06-05 23:45 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('controle', '0003_auto_20180605_2344'), + ] + + operations = [ + migrations.RenameField( + model_name='funcionario', + old_name='Cargo', + new_name='cargo', + ), + migrations.RenameField( + model_name='funcionario', + old_name='Telefone', + new_name='telefone', + ), + ] diff --git a/controle/migrations/0005_livros_autor.py b/controle/migrations/0005_livros_autor.py new file mode 100644 index 0000000..a8de09e --- /dev/null +++ b/controle/migrations/0005_livros_autor.py @@ -0,0 +1,19 @@ +# Generated by Django 2.0.4 on 2018-06-20 00:00 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('controle', '0004_auto_20180605_2345'), + ] + + operations = [ + migrations.AddField( + model_name='livros', + name='autor', + field=models.CharField(default=1, max_length=255), + preserve_default=False, + ), + ] diff --git a/controle/migrations/0006_processo.py b/controle/migrations/0006_processo.py new file mode 100644 index 0000000..63b1b04 --- /dev/null +++ b/controle/migrations/0006_processo.py @@ -0,0 +1,24 @@ +# Generated by Django 2.0.4 on 2018-07-10 22:06 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('controle', '0005_livros_autor'), + ] + + operations = [ + migrations.CreateModel( + name='Processo', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('emprestimo', models.BooleanField(default=False)), + ('cliente', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='controle.Cliente')), + ('funcionario', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='controle.Funcionario')), + ('livro', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='controle.Livros')), + ], + ), + ] diff --git a/controle/migrations/__init__.py b/controle/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/controle/models.py b/controle/models.py new file mode 100644 index 0000000..54c6dfc --- /dev/null +++ b/controle/models.py @@ -0,0 +1,42 @@ +from django.db import models + +# Create your models here. + +class Cliente(models.Model): + nome = models.CharField(max_length = 255) + cpf = models.CharField(max_length = 255) + telefone = models.CharField(max_length = 255) + + def __str__(self): + return '{} ({}) '.format(self.nome , self.cpf) + + +class Funcionario(models.Model): + + nome= models.CharField(max_length = 255) + cpf= models.CharField(max_length = 255) + telefone= models.CharField(max_length = 255) + cargo = models.CharField(max_length = 200) + + def __str__(self): + return '{} , {}'.format(self.nome , self.cargo) + + +class Livros(models.Model): + + nome = models.CharField(max_length = 255) + descricao = models.CharField(max_length = 200) + quantidade = models.CharField(max_length = 255) + autor = models.CharField(max_length = 255) + + def __str__(self): + return '{} , {} , {}'.format( self.nome , self.descricao ,self.autor) + +class Processo(models.Model): + cliente = models.ForeignKey(Cliente,on_delete = models.CASCADE) + funcionario = models.ForeignKey(Funcionario,on_delete = models.CASCADE) + livro = models.ForeignKey(Livros,on_delete = models.CASCADE) + emprestimo= models.BooleanField(default = False) + + def __str__(self): + return '{} , {} , {}, {}'.format(self.id, self.cliente , self.funcionario , self.livro , self.emprestimo) diff --git a/controle/static/controle/css/style.css b/controle/static/controle/css/style.css new file mode 100644 index 0000000..6bb61b9 --- /dev/null +++ b/controle/static/controle/css/style.css @@ -0,0 +1,132 @@ +.botao{ + background-color: black; + color: white; + padding: 12px 20px; + border: none; + border-radius: 4px; + cursor: pointer; +} +.botao:hover{ + background-color: #45a049; +} + +body { + background-image: url("../img/livros.jpg"); + background-repeat: no-repeat; + background-size: cover; +} +* { + box-sizing: border-box; +} + +input[type=text], select, textarea { + width: 100%; + padding: 12px; + border: 1px solid #ccc; + border-radius: 4px; + resize: vertical; +} + +label { + padding: 12px 12px 12px 0; + display: inline-block; +} + +input[type=submit] { + background-color: black; + color: white; + padding: 12px 20px; + border: none; + border-radius: 4px; + cursor: pointer; +} + +input[type=submit]:hover { + background-color: #45a049; +} + +.container { + border-radius: 5px; + background-color: #f2f2f2; + padding: 20px; +} + +.col-25 { + float: left; + width: 25%; + margin-top: 6px; +} + +.col-75 { + float: left; + width: 75%; + margin-top: 6px; +} + +/* Clear floats after the columns */ +.row:after { + content: ""; + display: table; + clear: both; +} + + +@media screen and (max-width: 600px) { + .col-25, .col-75, input[type=submit] { + width: 100%; + margin-top: 0; + } +} +imput[class="salvar"]{ +float:right +} +ul { + list-style-type: none; + margin: 0; + padding: 0; + overflow: hidden; + background-color: #333; +} + +li { + float: left; +} + +li a, .dropbtn { + display: inline-block; + color: white; + text-align: center; + padding: 14px 16px; + text-decoration: none; +} + +li a:hover, .dropdown:hover .dropbtn { + background-color: red; +} + +li.dropdown { + display: inline-block; +} + +.dropdown-content { + display: none; + position: absolute; + background-color: #f9f9f9; + min-width: 160px; + box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); + z-index: 1; +} + +.dropdown-content a { + color: black; + padding: 12px 16px; + text-decoration: none; + display: block; + text-align: left; +} + +.dropdown-content a:hover {background-color: #f1f1f1} + +.dropdown:hover .dropdown-content { + display: block; +} diff --git a/controle/static/controle/img/livros.jpg b/controle/static/controle/img/livros.jpg new file mode 100644 index 0000000..c21504a Binary files /dev/null and b/controle/static/controle/img/livros.jpg differ diff --git a/controle/templates/controle/busca_cliente.html b/controle/templates/controle/busca_cliente.html new file mode 100644 index 0000000..77e81de --- /dev/null +++ b/controle/templates/controle/busca_cliente.html @@ -0,0 +1,41 @@ +{% load static %} + + + +
+