Commit d5a1c5b3 authored by amandazk's avatar amandazk

Mudanças no banco - arrumando nomes

parent 59c51803
{
"python.formatting.provider": "black"
}
\ No newline at end of file
......@@ -95,7 +95,7 @@ DATABASES = {
'default': {
# 'ENGINE': 'django.contrib.gis.db.backends.postgis',
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'projeto',
'NAME': 'projeto-ifc',
'USER': 'postgres',
'PASSWORD': 'root',
'HOST': 'localhost',
......
from django.contrib import admin
from campanhas.models import TbCampanha
from campanhas.models import Campanha
class Campanhas(admin.ModelAdmin):
list_display = ('campanha_id', 'ativo', 'titulo_campanha', 'pessoa')
......@@ -7,4 +7,4 @@ class Campanhas(admin.ModelAdmin):
search_fields = ('titulo_campanha',)
list_per_page = 10
admin.site.register(TbCampanha, Campanhas)
admin.site.register(Campanha, Campanhas)
from django.apps import AppConfig
from django.apps import apps
model = apps.get_model('pessoas', 'TbPessoa')
model = apps.get_model('pessoas', 'Pessoa')
class CampanhasConfig(AppConfig):
name = 'campanhas'
# Generated by Django 3.1.3 on 2020-12-07 21:42
# Generated by Django 3.1.3 on 2021-01-04 13:19
from django.db import migrations, models
import django.db.models.deletion
......@@ -14,7 +14,7 @@ class Migration(migrations.Migration):
operations = [
migrations.CreateModel(
name='TbCampanha',
name='Campanha',
fields=[
('campanha_id', models.AutoField(primary_key=True, serialize=False)),
('ativo', models.BooleanField(default=False)),
......@@ -27,7 +27,7 @@ class Migration(migrations.Migration):
('bairro_campanha', models.CharField(blank=True, max_length=100, null=True)),
('cidade_campanha', models.CharField(blank=True, max_length=100, null=True)),
('link_campanha', models.URLField()),
('pessoa', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='campanhas', to='pessoas.tbpessoa')),
('pessoa', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='campanhas', to='pessoas.pessoa')),
],
options={
'verbose_name': 'Campanha',
......
from django.db import models
class TbCampanha(models.Model):
class Campanha(models.Model):
objects = models.Manager() #evitar erro no vscode
campanha_id = models.AutoField(primary_key=True)
ativo = models.BooleanField(default=False)
......@@ -15,7 +15,7 @@ class TbCampanha(models.Model):
link_campanha = models.URLField()
pessoa = models.ForeignKey(
'pessoas.TbPessoa',
'pessoas.Pessoa',
related_name='campanhas',
on_delete=models.CASCADE,
)
......
from rest_framework import serializers
from campanhas.models import TbCampanha
from campanhas.models import Campanha
class CampanhaSerializer(serializers.ModelSerializer):
class Meta:
model = TbCampanha
model = Campanha
fields = (
'__all__')
from rest_framework import generics, permissions
from campanhas.models import TbCampanha
from campanhas.models import Campanha
from campanhas.serializers import CampanhaSerializer
class CampanhaList(generics.ListAPIView):
"""Listando campanhas"""
queryset = TbCampanha.objects.all()
queryset = Campanha.objects.all()
serializer_class = CampanhaSerializer
permission_classes = ()
class CampanhaDestroy(generics.DestroyAPIView):
"""Excluindo campanha"""
queryset = TbCampanha.objects.all()
queryset = Campanha.objects.all()
serializer_class = CampanhaSerializer
permission_classes = (
permissions.IsAdminUser,
......@@ -19,7 +19,7 @@ class CampanhaDestroy(generics.DestroyAPIView):
class CampanhaUpdate(generics.UpdateAPIView):
"""Update de campanha"""
queryset = TbCampanha.objects.all()
queryset = Campanha.objects.all()
serializer_class = CampanhaSerializer
permission_classes = (
permissions.IsAuthenticated, #talvez deixar só pro admin
......@@ -27,7 +27,7 @@ class CampanhaUpdate(generics.UpdateAPIView):
class CampanhaCreate(generics.CreateAPIView):
"""Criando campanha"""
queryset = TbCampanha.objects.all()
queryset = Campanha.objects.all()
serializer_class = CampanhaSerializer
permission_classes = (
permissions.DjangoModelPermissions,
......@@ -35,7 +35,7 @@ class CampanhaCreate(generics.CreateAPIView):
class CampanhaGet(generics.RetrieveAPIView):
"""Listando uma campanha"""
queryset = TbCampanha.objects.all()
queryset = Campanha.objects.all()
serializer_class = CampanhaSerializer
permission_classes = ()
from django.contrib import admin
from demanda.models import TbDemanda
from demanda.models import Demanda
class Demanda(admin.ModelAdmin):
class Demandas(admin.ModelAdmin):
list_display = ('demanda_id', 'titulo_demanda',)
list_display_links = ('demanda_id', 'titulo_demanda', )
# search_fields = ('titulo_demanda',)
list_per_page = 10
admin.site.register(TbDemanda, Demanda)
admin.site.register(Demanda, Demandas)
from django.apps import AppConfig
from django.apps import apps
model = apps.get_model('pessoas', 'TbPessoa')
model = apps.get_model('servico', 'Tbservico')
model = apps.get_model('pessoas', 'Pessoa')
model = apps.get_model('servico', 'Servico')
class DemandaConfig(AppConfig):
name = 'demanda'
# Generated by Django 3.1.3 on 2020-12-07 21:42
# Generated by Django 3.1.3 on 2021-01-04 13:19
from django.db import migrations, models
import django.db.models.deletion
......@@ -9,13 +9,13 @@ class Migration(migrations.Migration):
initial = True
dependencies = [
('servico', '0001_initial'),
('pessoas', '0001_initial'),
('servico', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='TbDemanda',
name='Demanda',
fields=[
('demanda_id', models.AutoField(primary_key=True, serialize=False)),
('titulo_demanda', models.CharField(max_length=100)),
......@@ -25,8 +25,8 @@ class Migration(migrations.Migration):
('bairro_servico', models.CharField(max_length=100)),
('cidade_servico', models.CharField(max_length=100)),
('desc_demanda', models.TextField(max_length=1400)),
('pessoas', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='demanda', to='pessoas.tbpessoa')),
('servico', models.ManyToManyField(related_name='demanda', to='servico.TbServico')),
('pessoas', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='demanda', to='pessoas.pessoa')),
('servico', models.ManyToManyField(related_name='demanda', to='servico.Servico')),
],
options={
'verbose_name': 'Demanda',
......
......@@ -2,7 +2,7 @@ from django.db import models
# from django.contrib.gis.db import models
class TbDemanda(models.Model):
class Demanda(models.Model):
objects = models.Manager() # evitar erro no vscode
demanda_id = models.AutoField(primary_key=True)
titulo_demanda = models.CharField(max_length=100, blank=False)
......@@ -15,13 +15,13 @@ class TbDemanda(models.Model):
desc_demanda = models.TextField(max_length=1400, blank=False)
pessoas = models.ForeignKey(
'pessoas.TbPessoa',
'pessoas.Pessoa',
related_name='demanda',
on_delete=models.CASCADE,
)
servico = models.ManyToManyField(
'servico.TbServico',
'servico.Servico',
related_name='demanda'
)
......
from rest_framework import serializers
from demanda.models import TbDemanda
from demanda.models import Demanda
class DemandaSerializer(serializers.ModelSerializer):
class Meta:
model = TbDemanda
model = Demanda
fields = (
'__all__')
from rest_framework import generics, permissions
from demanda.models import TbDemanda
from demanda.models import Demanda
from demanda.serializers import DemandaSerializer
class DemandaList(generics.ListAPIView):
"""Listando demanda"""
queryset = TbDemanda.objects.all()
queryset = Demanda.objects.all()
serializer_class = DemandaSerializer
permission_classes = ()
class DemandaDestroy(generics.DestroyAPIView):
"""Excluindo demanda"""
queryset = TbDemanda.objects.all()
queryset = Demanda.objects.all()
serializer_class = DemandaSerializer
permission_classes = (
permissions.IsAdminUser,
......@@ -19,7 +19,7 @@ class DemandaDestroy(generics.DestroyAPIView):
class DemandaUpdate(generics.UpdateAPIView):
"""Update de demanda"""
queryset = TbDemanda.objects.all()
queryset = Demanda.objects.all()
serializer_class = DemandaSerializer
permission_classes = (
permissions.IsAuthenticated, #talvez deixar só pro admin
......@@ -27,7 +27,7 @@ class DemandaUpdate(generics.UpdateAPIView):
class DemandaCreate(generics.CreateAPIView):
"""Criando demanda"""
queryset = TbDemanda.objects.all()
queryset = Demanda.objects.all()
serializer_class = DemandaSerializer
permission_classes = (
permissions.DjangoModelPermissions,
......@@ -35,7 +35,7 @@ class DemandaCreate(generics.CreateAPIView):
class DemandaGet(generics.RetrieveAPIView):
"""Listando uma demanda"""
queryset = TbDemanda.objects.all()
queryset = Demanda.objects.all()
serializer_class = DemandaSerializer
permission_classes = ()
from django.contrib import admin
from noticia.models import TbNoticia
from noticia.models import Noticia
class Noticia(admin.ModelAdmin):
class Noticias(admin.ModelAdmin):
list_display = ('noticia_id', 'titulo_noticia')
list_display_links = ('noticia_id', 'titulo_noticia')
search_fields = ('titulo_noticia',)
list_per_page = 10
admin.site.register(TbNoticia, Noticia)
admin.site.register(Noticia, Noticias)
from django.apps import AppConfig
from django.apps import apps
model = apps.get_model('pessoas', 'TbPessoa')
model = apps.get_model('pessoas', 'Pessoa')
class NoticiaConfig(AppConfig):
name = 'noticia'
# Generated by Django 3.1.3 on 2020-12-07 21:42
# Generated by Django 3.1.3 on 2021-01-04 13:19
from django.db import migrations, models
import django.db.models.deletion
......@@ -14,13 +14,13 @@ class Migration(migrations.Migration):
operations = [
migrations.CreateModel(
name='TbNoticia',
name='Noticia',
fields=[
('noticia_id', models.AutoField(primary_key=True, serialize=False)),
('titulo_noticia', models.CharField(max_length=300)),
('subtitulo_noticia', models.CharField(max_length=300)),
('desc_noticia', models.TextField(max_length=10000)),
('pessoas', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='noticia', to='pessoas.tbpessoa')),
('pessoas', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='noticia', to='pessoas.pessoa')),
],
options={
'verbose_name': 'Noticia',
......
from django.db import models
class TbNoticia(models.Model):
class Noticia(models.Model):
objects = models.Manager() #evitar erro no vscode
noticia_id = models.AutoField(primary_key=True)
titulo_noticia = models.CharField(max_length=300, blank=False)
......@@ -8,7 +8,7 @@ class TbNoticia(models.Model):
desc_noticia = models.TextField(max_length=10000, blank=False)
pessoas = models.ForeignKey(
'pessoas.TbPessoa',
'pessoas.Pessoa',
related_name='noticia',
on_delete=models.CASCADE,
)
......
from rest_framework import serializers
from noticia.models import TbNoticia
from noticia.models import Noticia
class NoticiaSerializer(serializers.ModelSerializer):
class Meta:
model = TbNoticia
model = Noticia
fields = (
'__all__')
from rest_framework import generics, permissions
from noticia.models import TbNoticia
from noticia.models import Noticia
from noticia.serializers import NoticiaSerializer
class NoticiaList(generics.ListAPIView):
"""Listando noticia"""
queryset = TbNoticia.objects.all()
queryset = Noticia.objects.all()
serializer_class = NoticiaSerializer
permission_classes = ()
class NoticiaDestroy(generics.DestroyAPIView):
"""Excluindo noticia"""
queryset = TbNoticia.objects.all()
queryset = Noticia.objects.all()
serializer_class = NoticiaSerializer
permission_classes = (
permissions.IsAdminUser,
......@@ -19,7 +19,7 @@ class NoticiaDestroy(generics.DestroyAPIView):
class NoticiaUpdate(generics.UpdateAPIView):
"""Update de noticia"""
queryset = TbNoticia.objects.all()
queryset = Noticia.objects.all()
serializer_class =NoticiaSerializer
permission_classes = (
permissions.IsAuthenticated, #talvez deixar só pro admin
......@@ -27,7 +27,7 @@ class NoticiaUpdate(generics.UpdateAPIView):
class NoticiaCreate(generics.CreateAPIView):
"""Criando noticia"""
queryset = TbNoticia.objects.all()
queryset = Noticia.objects.all()
serializer_class = NoticiaSerializer
permission_classes = (
permissions.DjangoModelPermissions,
......@@ -35,7 +35,7 @@ class NoticiaCreate(generics.CreateAPIView):
class NoticiaGet(generics.RetrieveAPIView):
"""Listando uma noticia"""
queryset = TbNoticia.objects.all()
queryset = Noticia.objects.all()
serializer_class = NoticiaSerializer
permission_classes = ()
from django.contrib import admin
from oferta.models import TbOferta
from oferta.models import Oferta
class Oferta(admin.ModelAdmin):
class Ofertas(admin.ModelAdmin):
list_display = ('oferta_id', 'titulo_oferta')
list_display_links = ('oferta_id', 'titulo_oferta')
search_fields = ('titulo_oferta',)
list_per_page = 10
admin.site.register(TbOferta, Oferta)
admin.site.register(Oferta, Ofertas)
from django.apps import AppConfig
from django.apps import apps
model = apps.get_model('pessoas', 'TbPessoa')
model = apps.get_model('pessoas', 'Pessoa')
class DemandaConfig(AppConfig):
name = 'oferta'
# Generated by Django 3.1.3 on 2020-12-07 21:42
# Generated by Django 3.1.3 on 2021-01-04 13:19
from django.db import migrations, models
import django.db.models.deletion
......@@ -14,7 +14,7 @@ class Migration(migrations.Migration):
operations = [
migrations.CreateModel(
name='TbOferta',
name='Oferta',
fields=[
('oferta_id', models.AutoField(primary_key=True, serialize=False)),
('dt_oferta', models.DateField()),
......@@ -23,7 +23,7 @@ class Migration(migrations.Migration):
('numero_endereco_oferta', models.CharField(blank=True, max_length=10, null=True)),
('bairro_oferta', models.CharField(blank=True, max_length=100, null=True)),
('cidade_oferta', models.CharField(blank=True, max_length=100, null=True)),
('pessoas', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='oferta', to='pessoas.tbpessoa')),
('pessoas', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='oferta', to='pessoas.pessoa')),
],
options={
'verbose_name': 'Oferta',
......
from django.db import models
class TbOferta(models.Model):
class Oferta(models.Model):
objects = models.Manager() #evitar erro no vscode
oferta_id = models.AutoField(primary_key=True)
dt_oferta = models.DateField(blank=False)
......@@ -11,7 +11,7 @@ class TbOferta(models.Model):
cidade_oferta = models.CharField(max_length=100, blank=True, null=True)
pessoas = models.ForeignKey(
'pessoas.TbPessoa',
'pessoas.Pessoa',
related_name='oferta',
on_delete=models.CASCADE,
)
......
from rest_framework import serializers
from oferta.models import TbOferta
from oferta.models import Oferta
class OfertaSerializer(serializers.ModelSerializer):
class Meta:
model = TbOferta
model = Oferta
fields = (
'__all__')
from rest_framework import generics, permissions
from oferta.models import TbOferta
from oferta.models import Oferta
from oferta.serializers import OfertaSerializer
class OfertaList(generics.ListAPIView):
"""Listando oferta"""
queryset = TbOferta.objects.all()
queryset = Oferta.objects.all()
serializer_class = OfertaSerializer
permission_classes = ()
class OfertaDestroy(generics.DestroyAPIView):
"""Excluindo oferta"""
queryset = TbOferta.objects.all()
queryset = Oferta.objects.all()
serializer_class = OfertaSerializer
permission_classes = (
permissions.IsAdminUser,
......@@ -19,7 +19,7 @@ class OfertaDestroy(generics.DestroyAPIView):
class OfertaUpdate(generics.UpdateAPIView):
"""Update de oferta"""
queryset = TbOferta.objects.all()
queryset = Oferta.objects.all()
serializer_class = OfertaSerializer
permission_classes = (
permissions.IsAuthenticated, #talvez deixar só pro admin
......@@ -27,7 +27,7 @@ class OfertaUpdate(generics.UpdateAPIView):
class OfertaCreate(generics.CreateAPIView):
"""Criando oferta"""
queryset = TbOferta.objects.all()
queryset = Oferta.objects.all()
serializer_class = OfertaSerializer
permission_classes = (
permissions.DjangoModelPermissions,
......@@ -35,7 +35,7 @@ class OfertaCreate(generics.CreateAPIView):
class OfertaGet(generics.RetrieveAPIView):
"""Listando uma oferta"""
queryset = TbOferta.objects.all()
queryset = Oferta.objects.all()
serializer_class =OfertaSerializer
permission_classes = ()
from django.contrib import admin
from .models.pessoa import TbPessoa
from .models.fone import TbFone
from .models.pessoa import Pessoa
from .models.fone import Fone
class Pessoas(admin.ModelAdmin):
list_display = ('pessoa_id','cpf_pessoa', 'nome_pessoa')
......@@ -9,7 +9,7 @@ class Pessoas(admin.ModelAdmin):
search_fields = ('cpf_pessoa', 'nome_pessoa')
list_per_page = 10
admin.site.register(TbPessoa, Pessoas)
admin.site.register(Pessoa, Pessoas)
class Fones(admin.ModelAdmin):
list_display = ('fone_id', 'nr_fone',)
......@@ -17,4 +17,4 @@ class Fones(admin.ModelAdmin):
search_fields = ('nr_fone', )
list_per_page = 10
admin.site.register(TbFone, Fones)
admin.site.register(Fone, Fones)