Skip to content

Commit

Permalink
api-mascota
Browse files Browse the repository at this point in the history
  • Loading branch information
PaolaBasualdo committed Dec 6, 2023
1 parent 1966a86 commit 8e64dd7
Show file tree
Hide file tree
Showing 14 changed files with 34 additions and 4 deletions.
Binary file modified alphafood_project/__pycache__/settings.cpython-310.pyc
Binary file not shown.
2 changes: 2 additions & 0 deletions alphafood_project/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
CUSTOM_APPS = ["mascotas_app"

]
EXTERNAL = ["rest_framework"]

INSTALLED_APPS = [
"django.contrib.admin",
Expand All @@ -44,6 +45,7 @@
#"mascotas_app",
]
INSTALLED_APPS += CUSTOM_APPS
INSTALLED_APPS += EXTERNAL

MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
Expand Down
Binary file modified db.sqlite3
Binary file not shown.
Binary file added mascotas_app/__pycache__/router.cpython-310.pyc
Binary file not shown.
Binary file added mascotas_app/__pycache__/serializers.cpython-310.pyc
Binary file not shown.
Binary file modified mascotas_app/__pycache__/urls.cpython-310.pyc
Binary file not shown.
Binary file added mascotas_app/__pycache__/viewsets.cpython-310.pyc
Binary file not shown.
7 changes: 7 additions & 0 deletions mascotas_app/router.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from rest_framework import routers
from .viewsets import MascotaViewSet

router = routers.SimpleRouter()

# en este caso se le anexa a la ruta de las urls de la app
router.register("api-mascota",MascotaViewSet)
7 changes: 7 additions & 0 deletions mascotas_app/serializers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from rest_framework.serializers import ModelSerializer
from .models import Mascota

class MascotaSerializer(ModelSerializer):
class Meta:
model = Mascota
fields = "__all__"
10 changes: 7 additions & 3 deletions mascotas_app/static/mascotas/css/form.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ input {

input[type="submit"],
a.button {
background-color: #4caf50;
color: #fff;
color:#fff;
background-color: #36A0FF;
padding: 10px 15px;
border: none;
border-radius: 4px;
Expand All @@ -41,5 +41,9 @@ a.button {

input[type="submit"]:hover,
a.button:hover {
background-color: #45a049;
background: #fff;
color:#36A0FF;
border: 1px solid #36A0FF;
border-radius: 4px;
transition: all 400ms ease;
}
1 change: 1 addition & 0 deletions mascotas_app/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">

<link rel="stylesheet" href="{% static './mascotas/css/styles2.css'%}">
<link rel="stylesheet" href="{% static './mascotas/css/form.css' %}">
<link rel="icon" href="{% static './mascotas/img/icono.ico'%}">

<title>{% block titulo %} {% endblock %}</title>
Expand Down
2 changes: 1 addition & 1 deletion mascotas_app/templates/mascotas/form.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<link rel="stylesheet" href="../../static/mascotas/css/form.css">



<form method="post" enctype="multipart/form-data">
Expand Down
2 changes: 2 additions & 0 deletions mascotas_app/urls.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from django.urls import path
from . import views
from .router import router


app_name = "mascotas_app"

Expand Down
7 changes: 7 additions & 0 deletions mascotas_app/viewsets.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from rest_framework.viewsets import ModelViewSet
from .models import Mascota
from .serializers import MascotaSerializer

class MascotaViewSet(ModelViewSet):
queryset = Mascota.objects.all()
serializer_class = MascotaSerializer

0 comments on commit 8e64dd7

Please sign in to comment.