-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configpostgres #11
Open
elizuzurilu
wants to merge
3
commits into
develop
Choose a base branch
from
configpostgres
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Configpostgres #11
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.contrib import admin | ||
|
||
# Register your models here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class ListadoDeLugaresConfig(AppConfig): | ||
default_auto_field = 'django.db.models.BigAutoField' | ||
name = 'listado_de_lugares' |
30 changes: 30 additions & 0 deletions
30
lugares_seguros/listado_de_lugares/migrations/0001_initial.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Generated by Django 4.1.7 on 2023-03-10 08:58 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='listado_de_lugares', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('name', models.CharField(max_length=56)), | ||
('description', models.CharField(max_length=256)), | ||
('address_state', models.CharField(max_length=32)), | ||
('address_city', models.CharField(max_length=32)), | ||
('address_colonia', models.CharField(max_length=32)), | ||
('address_street', models.CharField(max_length=32)), | ||
('address_zipcode', models.CharField(max_length=32)), | ||
], | ||
options={ | ||
'db_table': 'listado_de_lugares', | ||
}, | ||
), | ||
] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from django.db import models | ||
|
||
# Create your models here. | ||
|
||
|
||
class listado_de_lugares(models.Model): | ||
|
||
name = models.CharField(max_length=56) | ||
description = models.CharField(max_length=256) | ||
address_state = models.CharField(max_length=32) | ||
address_city = models.CharField(max_length=32) | ||
address_colonia = models.CharField(max_length=32) | ||
address_street = models.CharField(max_length=32) | ||
address_zipcode = models.CharField(max_length=32) | ||
|
||
class Meta: | ||
db_table = 'listado_de_lugares' | ||
|
||
def __str__(self): | ||
return self.name | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from rest_framework import serializers | ||
from.models import listado_de_lugares | ||
|
||
class listado_de_lugaresSerializer(serializers.ModelSerializer): | ||
class Meta: | ||
model = listado_de_lugares | ||
fields = '_all_' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.test import TestCase | ||
|
||
# Create your tests here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#from django.shortcuts import render | ||
|
||
from rest_framework.views import APIView | ||
from rest_framework.response import Response | ||
from rest_framework import status | ||
from .models import Place | ||
from .serializers import PlaceSerializer | ||
|
||
# Create your views here | ||
class PlaceAPIView(APIView): | ||
|
||
def get(self, request): | ||
places = Place.objects.all() | ||
serializer = PlaceSerializer(places, many=True) | ||
return Response(serializer.data, status=status.HTTP_200_OK) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Como buena practica, y por cuestiones de seguridad, se recomienda no versionar datos de conexión a bases de datos u otros datos de usuarios y contraseñas, lo mejor es usar desde un inicio variables de entorno, pueden usar el modulo python-decouple para caargar y configurar estas variables de entorno