Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
# MySQL | |
DATABASE_URL=mysql://hogehoge:[email protected]:3306/db_name | |
# AWS Settings | |
DJANGO_AWS_S3_BUCKET_NAME=huga-storage | |
DJANGO_AWS_ACCESS_KEY=xxxxxxxxxxxxxxxxxx | |
DJANGO_AWS_SECRET_KEY=xxxxxxxxxxxxxxxxxx |
This file contains hidden or 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
def list(self, request, *args, **kwargs): | |
"""GET the List of Obj""" | |
qs = self.paginate_queryset(self.get_queryset()) | |
serializer_data = self.serializer_class(qs, many=True).data | |
paginated_data = self.get_paginated_response(serializer_data).data | |
return Response(data=paginated_data, status=status.HTTP_200_OK) | |
class XYZAPIView(APIView): |
This file contains hidden or 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
""" | |
src: https://github.com/bitsy-ai/printnanny-webapp/blob/04bb214fc83f1f860b1b2aa157dd2e90b610a06f/print_nanny_webapp/subscriptions/views.py#L19 | |
""" | |
from django.http.response import JsonResponse | |
from typing import Any, Dict | |
from django.apps import apps | |
from django.views.generic.base import RedirectView | |
from django.contrib.auth.mixins import LoginRequiredMixin | |
import json, logging | |
import stripe |
This file contains hidden or 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
m2m | |
class Post(models.Model): | |
slug = models.SlugField(max_length=200, unique=True) | |
likes = models.ManyToManyField(User, related_name='blogpost_like', blank=True) | |
post = get_object_or_404(Post, slug=slug) | |
if post.likes.filter(id=request.user.id).exists(): | |
post.likes.remove(request.user) |
This file contains hidden or 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
Uppercase in pycharm: Ctrl+Shift+U | |
How to Unstage changes? | |
>> git reset . | |
>> all red | |
Remove all unstage changes (remove changes in red) | |
>> git clean -f | |
This file contains hidden or 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
# Best | |
def lengthOfLongestSubstring(self, s: str) -> int: | |
l = 0 | |
r = 0 | |
occ = {} | |
mx = 0 | |
while r < len(s): | |
if s[r] not in occ: | |
occ[s[r]] = 1 | |
r += 1 |
This file contains hidden or 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 Solution: | |
"""BEST""" | |
def merge(self, li1, li2): | |
merged = [] | |
i, j = 0, 0 | |
while i < len(li1) and j < len(li2): | |
if li1[i] <= li2[j]: | |
merged.append(li1[i]) |
This file contains hidden or 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
""" | |
Author: Deepanshu Mehta | |
Script to Fetch data from EV Gsheets and Populate them into db | |
it requires `car-master-sheet.json` | |
python -m venv env_ev_allocation | |
source env_ev_allocation/bin/activate | |
pip3 install -r requirements.txt | |
python3 EV_allocation_data_dump.py | |
to check for psql: |
This file contains hidden or 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
import math | |
from django.db import connection | |
from rest_framework.response import Response | |
class CustomPagination(object): | |
""" | |
author: Deepanshu Mehta |
OlderNewer