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
#!/bin/bash | |
### USAGE | |
### | |
### ./ElasticSearch.sh 1.7 will install Elasticsearch 1.7 | |
### ./ElasticSearch.sh will fail because no version was specified (exit code 1) | |
### | |
### CLI options Contributed by @janpieper | |
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch |
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
class ToDo(models.Model): | |
task_title = models.CharField(max_length=200, default="") | |
task_description = models.TextField(default="", null=True, blank=True) | |
created_at = models.DateTimeField(auto_now_add=True) | |
updated_at = models.DateTimeField(auto_now=True) | |
completed = models.BooleanField(default=False) | |
def _str_(self): | |
return self.task_title | |
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
""" | |
Django settings for backend project. | |
Generated by 'django-admin startproject' using Django 2.2.4. | |
For more information on this file, see | |
https://docs.djangoproject.com/en/2.2/topics/settings/ | |
For the full list of settings and their values, see | |
https://docs.djangoproject.com/en/2.2/ref/settings/ |
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
from rest_framework import serializers | |
from .models import ToDo | |
class TodoSerializer(serializers.ModelSerializer): | |
class Meta: | |
model = ToDo | |
fields = ('id', 'task_title', 'task_description', 'completed') |
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
from django.shortcuts import render | |
from rest_framework import viewsets # add this | |
from todo.serializers import TodoSerializer # add this | |
from todo.models import ToDo # add this | |
class TodoView(viewsets.ModelViewSet): # add this | |
serializer_class = TodoSerializer # add this | |
queryset = ToDo.objects.all() |