Data Structures Basic Data Structures
Stack (Array & Linked List Implementation)
Queue (Array & Linked List Implementation)
Linked List (Single, Double & Circular)
Lists
Tree Data Structures
| from django.db import models | |
| from django.contrib.auth.models import AbstractUser | |
| class User(AbstractUser): | |
| bio = models.TextField(max_length=500, blank=True) | |
| location = models.CharField(max_length=30, blank=True) | |
| birth_date = models.DateField(null=True, blank=True) | |
| """ | |
| * EAFP: Easier to Ask Forgiveness than Permission | |
| * Tag line definition: If an object can quack & fly, then its a duck. | |
| * Do not worry about, if this object has this attribute or not, just try it inside try: block. If work then great, else handle the error. | |
| """ | |
| class Duck: | |
| def quack(self): | |
| print("Quack quack") |
Data Structures Basic Data Structures
Stack (Array & Linked List Implementation)
Queue (Array & Linked List Implementation)
Linked List (Single, Double & Circular)
Lists
Tree Data Structures
| from itertools import product | |
| def get_string_comb(): | |
| alpha_list = [chr(i) for i in range(97, 123)] | |
| for size in range(1, 10): | |
| for s in product(alpha_list, repeat=size): | |
| yield "".join(s) | |
| from rest_framework import viewsets | |
| from .models import Blog | |
| from .serializers import BlogSerializer | |
| # Create your views here. | |
| class BlogViewSet(viewsets.ModelViewSet): | |
| """ | |
| Using viewset instead of generic ListCreateAPIView & RetrieveUpdateDestroyAPIView. |
| #!/usr/bin/env python3.6.4 | |
| # coding="UTF-8" | |
| __author__ = 'Toran Sahu <toran.sahu@yahoo.com>' | |
| __copyright__ = 'Copyright (C) 2018 Ethereal Machines Pvt. Ltd. All rights reserved' | |
| from rest_framework import viewsets, mixins | |
| from .models import Job, JobEnquiry | |
| from .serializers import JobSerializer, JobEnquirySerializer |
| #!/usr/bin/python3.6.4 | |
| # coding="UTF-8" | |
| __author__ = 'Toran Sahu <toran.sahu@yahoo.com>' | |
| __copyright__ = 'Copyright (C) 2018 Ethereal Machines Pvt. Ltd. All rights reserved' | |
| from rest_framework.permissions import BasePermission, AllowAny | |
| #!/usr/bin/env python3.6.4 | |
| # coding="UTF-8" | |
| __author__ = 'Toran Sahu <toran.sahu@yahoo.com>' | |
| __copyright__ = 'Copyright (C) 2018 Ethereal Machines Pvt. Ltd. All rights reserved' | |
| from django.db import models | |
| def directory_path(instance, filename): |
| # EditorConfig is awesome | |
| # http://EditorConfig.org | |
| root = true | |
| # defaults | |
| [*] | |
| indent_style = space | |
| indent_size = 2 | |
| end_of_line = lf | |
| charset = utf-8 |