Skip to content

KennethMiller18/django-rest-api

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Django REST API

Description

This repository is a Software of Application with Python, Django, etc.

Installation

Using Django, djangorestframework,etc preferably.

DataBase

Using SQLite3 preferably.

Apps

Using pipenv.

Usage

$ git clone https://github.com/DanielArturoAlejoAlvarez/django-rest-api.git
[NAME APP]

Follow the following steps and you're good to go! Important:

alt text

Coding

Models

...
from django.db import models

class Language(models.Model):
    name = models.CharField(max_length=100)
    paradigm = models.CharField(max_length=128)

    def __str__(self):
        return self.name
...

Controllers

...
from rest_framework import serializers
from .models import Language 

class LanguageSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = Language 
        fields = ('id','url','name','paradigm')
...

Views

...
from django.shortcuts import render
from rest_framework import viewsets 

from .models import Language 
from .serializers import LanguageSerializer

class LanguageView(viewsets.ModelViewSet):
    queryset = Language.objects.all()
    serializer_class = LanguageSerializer

...

Routes

...
from django.urls import path,include

from . import views
from rest_framework import routers

router = routers.DefaultRouter()
router.register('languages', views.LanguageView)

urlpatterns = [
    path('', include(router.urls))
]
...

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/DanielArturoAlejoAlvarez/django-rest-api. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

About

Software of Development with Django (REST API)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%